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 to make your char die on game map?

Scuff

Member

How to make your char die on game map? All i need is a very simple script, so when your hp reaches "1", yes i mean 1 it takes you to the game over screen.
 
Well, a common event would be easiest I would think. Otherwise, wouldn't it look something like this:

nevermind...I just realized a major mistake that I made here....

I really don't know if that will work or not, but it's worth a shot...

~xgamexfreakx
 
Why a script? Events can do the job.

Parallel Process event >
@>Control Variables: [xxxx] = [YourActor]'s HP
@>Conditional Branch: Variable [xxxx] == 1
@>Game Over (3rd page of events, bottom-right)
: Branch End
@>Wait 1 frame
 
Um.. couldn't you just use a conditional branch so then when HP is x, then the Game-Over screen comes up, or you could even make your own game-over screen, like set it up so that a balck screen comes up and then you have the load screen.
 
that is what I was thinking, however, i got a script to work and it's actually really easy.

under Scene_Map in frame update add this code right below Update Message Window.

Code:
if $game_actors[1].hp == 1
      then
        $scene = Scene_Gameover.new
      return
      end

and that will do it for you!

Hope this helps!
~xgamexfreakx
 
Mmm...this is for SDK.. maybe will work without it.
Code:
#==============================================================================
# ** Scene_Map **Check for Actors alive. SDK 2.4 Version.
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================

class Scene_Map
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :meph_scene_map_update, :update
  #--------------------------------------------------------------------------
  # * Update
  #-------------------------------------------------------------------------- 
  def update
    meph_scene_map_update
    map_all_dead?
  end
  #--------------------------------------------------------------------------
  # * Map All Dead?
  #   Check if x.Actors are/is dead.
  #--------------------------------------------------------------------------
  def map_all_dead?
    if $game_party.actors[0].hp <= 0
      $scene = Scene_Gameover.new
    end
  end
end
 
yeah I know, I just like being picky :tongue:

that would be only if it's == , right? the <= is less than or equal to unless I'm mistaken. Which, now that i check back over my script, I should have used that. Though I guess it's not necessary because when you reach 0 HP, you die anyways....
 
Well, maybe but imagine this.

You have the == 1, but if the player reaches 0 in the map, I mean, you rest 100 to the player and the HP == 0, the player will not die, because you set == 1... (only if hp is equal to 1, if it's 0..nothing happens).

And there is a bug with the XP, when you reach 0 in the map, you don't die, you still alive, only when you enter to a battle you die.. curious :).

That.
 

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