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.

How do i make my char be able to die "on screen"

Scuff

Member

How do i make my char be able to die "on screen". My game is a adventure game(not really a fighting game). I need my char to be able to "Die" on screen, not in a battle.

Oh a BTW, i did not know where to post this(i hope this is where it goes)
 
Maybe you can also use a script made by me,

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

Its easy to use, it calls common event id 1, in that you set what you want, for example transfer to blabla, and in the script, you can set the loss percentage of your money, in line 100.
 

Scuff

Member

Just a quick question, will i have to call this script for each map?
EDIT: I have not used RMXP in a long time, so i dont *coughs* know how to "Call" a script.
 

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