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 V 1.0

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!
 
Hey man good work on this script! ^^ I have only some comments to add...
The amount could easily be changed by calling this
Code:
$game_system.loss_percentage = number
where number is a *preferrably* a Float number. For example, you could do
Code:
$game_system.loss_percentage = -1
to double the gold amount for example ^^
But for our normal use, this variable must be a float raging from 0 to 1, like in
Code:
$game_system.loss_percentage = 0.25
so the gold amount could be reduced in 25%. Pretty easy, and probably most of people won?t even need to mess with it. But it?s a cool feature to have, if you ever decide to change the amount of money that will be lost during gameplay. For example, you could have an item that reduces the money loss after gameover in half, or totally nullify the money loss... It all depends on you, dear final user >.<
 
Linkin, what do you mean with that? And I know that you can have 0.25, I think you can even have 0.3458983579298574 if you want...
 
<snicker> I like the heading :p

"... to heaven." Certainly caught my attention.

I'll leave the critiquing to the people who actually understand Ruby, but kudos on your first script~ Onwards and upwards right?
 
EJ, that the player can choose where to respawn? Well, I think that 's possible, but than I have to make certain locations. The player have to choose between that. (Switches will do the job.)
 

EJlol

Member

What I actually meant was, that the player automatically goes to the latest inn / some other location he visited. The user of the script just do something like this when a player visit a inn:
$game_system.gameover_id = new_id
$game_system.gameover_x = new_x
$game_system.gameover_y = new_y
 
Yes, that is what I mean. Switches, if a player touch a switch, a new location is selected. That must nog VERY difficult to make...
 
I', a little slow today...@_@
Can this script be turned on/off at will?
So it can be made dependable on a switch/variable/item/whatever?
(Let say,for example, switch 01 = on, then you'll revive at X place. switch 01 = off, just your normal game over)

Thanks. Great Script btw.
 
Myself.
Mi idea is limiting the amount of times players may "revive" themselves.
If they exceed the number of times, resurrect items, lifes, whatever, the script goes "off" so the next time they die is just game over.
 

Mac

Member

This is nice... a classical system....you seem to have utilised the script very well with aliasing....good job Mr_Smit!

~Mac
 

AKAndy

Member

Where am I going wrong with this script? I've got it set to the correct map ID to transfer to, but it still comes up with the gameover screen.
 
Perhaps you haven't replaced the default game over(Scene_Gameover) with this one. If you don't, you'll continue to have the same problem...
 
i have the same problem as AKAndy  but i have done every thing that you have said in the instruction here is the code that is in my game please tell me where i have gone wrong.

Code:
#==============================================================================
# ** Scene_Gameover
#------------------------------------------------------------------------------
#  This class performs game over screen processing.
#==============================================================================

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.player_transferring = true
     $game_temp.player_new_map_id = "Heaven"#Change this to the map ID
     $game_temp.player_new_x = 13 #This is for the X position
     $game_temp.player_new_y = 15 #This is for the Y postition
     $game_temp.player_new_direction = up #This is for the direction. 
     $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

class Game_System
  attr_accessor :loss_percentage
  alias old_game_system_init initialize
  def initialize
    old_game_system_init
    @loss_percentage = 0
  end
end
 

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