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.

Character Gameover

Can anyone please make me a script where it works without calling it and if a certain actor dies the gameover comes up.
Please help.
And please don't say you can do this with events because I do not want to.

Thanks in Advanced.
 
Try this:
Code:
Actor_ID = 0

class Game_Actor
  #--------------------------------------------------------------------------
  # * Change HP
  #     hp : new HP
  #--------------------------------------------------------------------------
  def hp=(hp)
    @hp = [[hp, maxhp].min, 0].max
    if @actor_id == Actor_ID
      $game_temp.gameover = true
      return
    end
    # add or exclude incapacitation
    for i in 1...$data_states.size
      if $data_states[i].zero_hp
        if self.dead?
          add_state(i)
        else
          remove_state(i)
        end
      end
    end
  end
end

Change the constant at line 1 to change the actor :)
 
Well I think that it is wrong because whenever that actor takes damage it will be game over correct?

shouldn't it be:

Code:
Actor_ID = 0

class Game_Actor
  #--------------------------------------------------------------------------
  # * Change HP
  #     hp : new HP
  #--------------------------------------------------------------------------
  def hp=(hp)
    @hp = [[hp, maxhp].min, 0].max
    
    # add or exclude incapacitation
    for i in 1...$data_states.size
      if $data_states[i].zero_hp
        if self.dead?
        if @actor_id == Actor_ID
          $game_temp.gameover = true
        return
    end
          add_state(i)
        else
          remove_state(i)
        end
      end
    end
  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