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.

HBGames

GameOver to Heaven, v2.0
My first script, updated!
This is very easy, just calls a common event.
In that common event, you can change the things
you loose, where you go to, etc.
For further instructions, read the comments.

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 further down for the instructions how to change the percentage.
#   And, you really HAVE to set a new starting place in the common event.
#   Otherwise, this script doenst really have affect as you keep at the same place.
#==============================================================================

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 101, 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

Questions? Bugs found? Anything else?
Reply! Nothing helps as much as a reply.

Credits
This script couldn't be made without the help of Linkin_T. He made the loss percentage working. Thanks man!

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