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.

Making status ailment lead to game over?

Aevin

Member

Forgive me if this is a silly question, I'm pretty new to this.

I want to make it so that my "stone" status leads to game over if the whole party is affected. Sitting helplessly until the enemy finally gets around to finishing me off is ... not ideal. Is there an easy way to accomplish this?

Thanks for any help!

EDIT: Figured it out, using a set of conditions which compared the number of party members to the number with stone status. Thanks anyway, though.
 
If every actor has a dead-like state, then it is Gameover. If all enemies have a dead-like state, then you've won the battle. That is how you want it to work, right? Hmm, I can't imagine how you can do this easily and effectively with common events so I'll go ahead and write you something real quick...

Code:
#===============================================================================

# ** States : Like-Dead States

#===============================================================================

 

#-------------------------------------------------------------------------------

# * SDK Log

#-------------------------------------------------------------------------------

if Object.const_defined?(:SDK)

  SDK.log('States.LikeDeadStates', 'Kain Nobel ©', 3.0, '04.20.2009')

end

 

#-------------------------------------------------------------------------------

# * Customizable Constants

#-------------------------------------------------------------------------------

RPG::State::Like_Dead_States = [2]

#===============================================================================

# ** Game_Battler

#===============================================================================

 

class Game_Battler

  #-----------------------------------------------------------------------------

  # * Game Over State?

  #-----------------------------------------------------------------------------

  def like_dead_state?

    RPG::State::Like_Dead_States.each {|s|

    return true if self.states.include?(s)}

    return false

  end

end

 

#===============================================================================

# ** Game_Party

#===============================================================================

 

class Game_Party

  #-----------------------------------------------------------------------------

  # * Everybody Dead States?

  #-----------------------------------------------------------------------------

  def everybody_dead_states?

    dead = Array.new

    for i in 0...@actors.size

      dead << @actors[i].like_dead_state?

    end

    return !dead.include?(false)

  end

end

 

#===============================================================================

# ** Game_Troop

#===============================================================================

 

class Game_Troop

  #-----------------------------------------------------------------------------

  # * Everybody Dead States?

  #-----------------------------------------------------------------------------

  def everybody_dead_states?

    dead = Array.new

    for i in 0...@enemies.size

      dead << @enemies[i].like_dead_state?

    end

    return !dead.include?(false)

  end

end

 

#===============================================================================

# ** Scene_Battle

#===============================================================================

 

class Scene_Battle

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :gameoverstates_scnbtl_judge, :judge

  #-----------------------------------------------------------------------------

  # * Judge

  #-----------------------------------------------------------------------------

  def judge

    if $game_party.everybody_dead_states?

      if $game_temp.battle_can_lose

        $game_system.bgm_play($game_temp.map_bgm)

        battle_end(2)

        return true

      end

      $game_temp.gameover = true

      return true

    elsif $game_troop.everybody_dead_states?

      start_phase5

      return true

    end

    gameoverstates_scnbtl_judge

  end

end

Any states that are supposed to be referred to as dead-like states (such as your Stone state), you'll be putting its database ID in the brackets in the top of the script where it says RPG::State::Dead_Like_States = []. So, for instance if Stone is state #17 in the database then you'd put a 17 in the brackets. You can put as many state IDs as you wish in there, states with those IDs will be considered dead-like states.

Enjoy :thumb:

PS; Although I doubt you will, if you come across any problems related to this script feel free to PM me, I don't watch topics.
 

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