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.

Easiest request in the world... Please Read!

Kraft

Sponsor

Okay, in a nutshell, I would like a script that runs a certain common event when the player dies.

Thats all there is to it.


Somewhere in the script I would like to be able to set which common event is triggered when you die.

This will be for a dungon that I am making, where if the player dies, he returns back to the surface (or a savepoint) and loses several items, and some money... etc...

I can do that in a common event though, and in the event I would set the heroes life to 1 or something... so he is not dead.

Thanks!
 
Hey,

here, the code:
Code:
$ce_id = 1
$stop_gameover = false

module Gameover_Stop
  def self.on
    $stop_gameover = true
    $game_map.update
  end
  def self.off
    $stop_gameover = false
    $game_map.update
  end
end

class Scene_Battle
  alias update_thndrblt33 update
  def update
    if $game_temp.gameover and $stop_gameover
      $game_temp.gameover = false
      $game_party.actors[0].hp = 1
      $game_temp.common_event_id = $ce_id
      $scene = Scene_Map.new
    end
    update_thndrblt33
  end
end

In line 1 you write the ID of the common event which will be called after you died.
With Gameover_Stop.on you can active this script an with Gameover_Stop.off it doesn't will work.
 

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