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.

Knockout = Gameover

Is it possible to make a snippet of code, so that if any actor in the party dies, it's game over? This would be essential in my game, where there are no random encounters, and one character not getting EXP from battle would have the player would be screwed anyway. :x Thanks!
 
Events in every battle that check for each player's status going to "down" would do it.  (Making it a common event would save coding time, of course.)

No resurrection items, eh?  That's going to be a challenge for some players, but it could be fun...
 

khmp

Sponsor

Code:
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Constant Variables
  #--------------------------------------------------------------------------
  KNOCKOUTLOSS_SWITCH = 1 # The ID of the switch that enables loss by any 
                          # party member fainting.
  #--------------------------------------------------------------------------
  # * Alias Methods
  #--------------------------------------------------------------------------
  alias_method :krop_knockoutloss_scene_battle_update_basic, :update_basic
  #--------------------------------------------------------------------------
  # * Basic Update Processing                                         !ALIAS!
  #     main : Call from main update method
  #--------------------------------------------------------------------------
  def update_basic(main = false)
    # Call the old code.
    krop_knockoutloss_scene_battle_update_basic(main)
    
    # If we are checking for any knockout.
    if $game_switches[KNOCKOUTLOSS_SWITCH]
      for actor in $game_party.members
        if actor.hp <= 0
          $scene = Scene_Gameover.new
          break
        end
      end
    end
  end
end

Good luck with it King Red Of Pancakes! :thumb:
 
Unka Josh, that method could work, but it sounds a bit time consuming and my planned release date is disturbingly close.
@khmp: So I just replace the default scene battle with this?
 

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