Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

GameOver to Heaven version Common_Event

GameOver To Heaven
Common_Event version


Hello community, this is the first crappy script made by me. Its called GameOver to Heaven, and its simply, when you die a common event is called instead of going to the gameover screen. You can decide what you put in the common event, so its very adjustable. Its common event 1, but you can change that in line 65.
Also it features a command called loss percentage, in there you can set how many of your money is lost. This is done in line 100, just change the 0.5 to what you want to do. Be aware, this is what you loose, not what you keep.

The Script
Code:
#==============================================================================
# ** Scene_Gameover
#------------------------------------------------------------------------------
#  
#   GameOver to Heaven, v2.0
#   Made by Mr_Smith, ©Mr_Smith, all rights reserved
#   
#   What this does? Very easy. It just calls a common event when you die,
#   resulting that you lose items or whatever the gamemaker want to. 
#   Everything you want to happen, is evented in the common event nr. 1.
#   Some features, like loss percentage, cant be evented. That is scripted. 
#   Look furter down for the instructions how to change the percentage.
#
#==============================================================================

class Scene_Gameover
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
     $game_temp.gameover = false
    # Make game over graphic
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
    # Stop BGM and BGS
    $game_system.bgm_play(nil)
    $game_system.bgs_play(nil)
    # Play game over ME
    $game_system.me_play($data_system.gameover_me)
    # Execute transition
    Graphics.transition(120)
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of game over graphic
    @sprite.bitmap.dispose
    @sprite.dispose
    # Execute transition
    Graphics.transition(40)
    # Prepare for transition
    Graphics.freeze
    # If battle test
    if $BTEST
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If C button was pressed
    if Input.trigger?(Input::C)
     $game_temp.common_event_id = 1
     $scene = Scene_Map.new
     # Loses the 50% (or any value put in $game_system.loss_percentage)
     amount = $game_party.gold * $game_system.loss_percentage
     $game_party.lose_gold(amount.to_i) # To force it to be converted into an integer
     $game_map.autoplay
    end
  end
end  

class Interpreter
  #--------------------------------------------------------------------------
  # * Game Over
  #--------------------------------------------------------------------------
  def command_353
    # Set game over flag
    $game_temp.gameover = true
    # End
    # Increases the index
    @index += 1
    return false
  end
end
  #-----------------------------------------------------------------------------
  # * Money loose percentage.
  #   In line 100, you see a number. 0.5, in this case. This means you loose 
  #   50% of the money you have. So, if you have 10.000, you have only 5.000 
  #   left, in this case. You can change it in whatever you want, even
  #   0.3485782978479312 if you really want to.
  #-----------------------------------------------------------------------------
class Game_System
  attr_accessor :loss_percentage
  alias old_game_system_init initialize
  def initialize
    old_game_system_init
    @loss_percentage = 0.5
  end
end

Screenshots
How can you screenshot this? Lol.

To be made:
- fully scripted, everything done in the script
- switches, after a certain event in the game you get to another spawning spot. (I know, you can do this with the common event now, but its more difficult after the fully scripted version.



Questions? Suggestions? Just post here!
~ Smiff

Oh, and you may use this for everything you want, as long as you give credit.
 
Well, the script is bad coded I must say, but its ok for a first script, you should use alias for the methods you changed, otherwise there will be HUGE compatibility problems with other scripts that modifie the Scene_GameOver.

also you should use a Constant for the money loss and another one for the Common EvenT Id, it would be easier to use that way.

Hope to see better scripts from you.

Good luck!
 
Hmm yea, that might be an issue for other gameover scripts. Forgot to say, this one is a complete rewrite from Scene_Gameover.
Can you explain that alias and constant? I dont understand what you mean...
 
Can you post the original code, I don't have RMXP on this Pc, although want I mean why not add the constant in Scene_GameOver, if ti is a fixed value then you you just set the constant at the top of the script? Also I think you only change the update method correct?

You could alias the update aswell since you aliased game_temp
 
Code:
#==============================================================================
# ** Scene_Gameover
#------------------------------------------------------------------------------
#  This class performs game over screen processing.
#==============================================================================

class Scene_Gameover
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make game over graphic
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
    # Stop BGM and BGS
    $game_system.bgm_play(nil)
    $game_system.bgs_play(nil)
    # Play game over ME
    $game_system.me_play($data_system.gameover_me)
    # Execute transition
    Graphics.transition(120)
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of game over graphic
    @sprite.bitmap.dispose
    @sprite.dispose
    # Execute transition
    Graphics.transition(40)
    # Prepare for transition
    Graphics.freeze
    # If battle test
    if $BTEST
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Switch to title screen
      $scene = Scene_Title.new
    end
  end
end

I still dont understand what you mean, and that alias, I didnt write the loss_percentage, if Im right Stevo did that... Should credit him though...
 
your script would look something like this then
Code:
class Scene_GameOver
AMOUNTTOKEEP = 0.5
def update
    # If C button was pressed
    if Input.trigger?(Input::C)
     $game_temp.common_event_id = 1
     $scene = Scene_Map.new
     # Loses the 50% (or any value put in $game_system.loss_percentage)
     amount = $game_party.gold * AMOUNTTOKEEP
     $game_party.lose_gold(amount.to_i) # To force it to be converted into an integer
     $game_map.autoplay
   end
end
end

It should work I guess
 
Well if anyone who knew how to work this script gets back on this, please tell me why i can't get the transport player command to work in the common events, thanks.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top