public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers

XPIncapacitate States XP

BMM Archive · July 16, 2026

Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: Incapacitate States XP
  • Original author: Gidan90
  • Original date: February 11, 2022
  • Source thread: https://forums.rpgmakerweb.com/threads/incapacitate-states-xp.144835/
  • Source forum path: Game Development Engines > Ruby Game System (RGSS) Scripts > RGSS Scripts (RMXP)

Summary

Incapacitate States XP by Gidan90​ This script allows setup states that makes the character to be set as dead even if not actually dead, an example is a petrification state.

Archived First Post

Incapacitate States XP

by

Gidan90​

This script allows setup states that makes the character to be set as dead even if not actually dead, an example is a petrification state.

Features
- If all party members are hit by this state, it’s game over.
- If all enemies are hit by this state the battle ends, and you not receive any experience points, items or money.
v. 1.0.1
- You can choose if obtain or not exp and gil when all foes are incapacitated.
- You can choose if change or not battler color when incapacitated.


How to Use
Copy the script into the script editor below the default scripts but above Main. Follow the instructions and configuration guidance within the script itself.


Script
Ruby:
#-------------------------------------------------------------------------------
# Gidan90 - Incapacitate States XP 
#-------------------------------------------------------------------------------
# Description:
# This script allows setup states that makes the character to be set as dead 
# even if not actually dead, an example is a petrification state. 
# Features:
# v. 1.0.0
# - If all party members are hit by this state, it’s game over.
# - If all enemies are hit by this state the battle ends, and 
#   you not receive any experience points, items or money.
# - Enemy or party members color tone changed when incapacitated 
#   status is applied.
# v. 1.0.1
# - Aliased Sprite_Battler method for more compatibilities. 
# - You can choose if obtain or not exp and gil when all foes are incapacitated.
# - You can choose if change or not battler color when incapacitated.
#-------------------------------------------------------------------------------
# * This script was made with the default battle system in mind. Custom battle
#   scripts will most likely not work with this script without edits.
# * Changes made to Game_Party, Game_Troop, Game_Battler, Scene_Battle
#   and Sprite_Battler.
#-------------------------------------------------------------------------------

module Gidan
  module IncapacitateStates
    # ID from database of incapacitate states.
    PETRIFY_STATE = 18  # Petrify State.
    #CUSTOM_STATE = 19  # Rename it and add your custom state to line 90 and 268.
    
    # Option (TRUE/FALSE)
    OBT_EXP = false # Set true to obtain exp and gil when all foes are incapacitated.
    INC_TONE = true # Set false if you don't want to change battler color tone when incapacitated.
  end
end

class Game_Party
  #--------------------------------------------------------------------------
  # * Get Array of Living Members
  #--------------------------------------------------------------------------
  def alive_members
    @actors.select{|member| member.alive?} 
  end
  #--------------------------------------------------------------------------
  # * Determine Everyone is Incapacitated
  #--------------------------------------------------------------------------
  def all_incapacitate? 
    # If an actor is in the party not incapacitate
    for actor in self.alive_members
      unless actor.incapacitate? 
        # End Method
        return false
      end
    end
    # All members incapacitate
    return true
  end
end

class Game_Troop
  #--------------------------------------------------------------------------
  # * Get Array of Living Members
  #--------------------------------------------------------------------------
  def alive_members
    @enemies.select{|member| member.alive?} 
  end
  #--------------------------------------------------------------------------
  # * Determine Everyone is Incapacitated
  #--------------------------------------------------------------------------
  def all_incapacitate? 
    # If an enemy is in the party not incapacitate
    for enemy in self.alive_members
      unless enemy.incapacitate?
        # End Method
        return false
      end
    end
    # All members incapacitate
    return true
  end
end

class Game_Battler
  include Gidan::IncapacitateStates
  #--------------------------------------------------------------------------
  # * Get State ID of Incapacitate
  #--------------------------------------------------------------------------
  def incapacitate_state?
    state?(PETRIFY_STATE) # or
    #state?(CUSTOM_STATE) # Add here your custom states.
  end
  #--------------------------------------------------------------------------
  # * Check Incapacitate State
  #--------------------------------------------------------------------------
  def incapacitate?
    return (incapacitate_state?)
  end
  #--------------------------------------------------------------------------
  # * Get State ID of K.O.
  #--------------------------------------------------------------------------
  def death_state?
    state?(1)
  end
  #--------------------------------------------------------------------------
  # * Determine Survival
  #--------------------------------------------------------------------------
  def alive?
    return (not @hidden and !death_state?)
  end
  #--------------------------------------------------------------------------
  # * Add State
  #     state_id : state ID
  #     force    : forcefully added flag (used to deal with auto state)
  #--------------------------------------------------------------------------
  alias incapacitate_add_state add_state
  def add_state(state_id, force = false)
      # If incapacitate
      if incapacitate? and !dead?
        # End Method
        return
      end
    incapacitate_add_state(state_id, force = false)
  end
end

class Scene_Battle
  include Gidan::IncapacitateStates
  #--------------------------------------------------------------------------
  # * Determine Battle Win/Loss Results
  #--------------------------------------------------------------------------
  def judge
    # If all dead determinant is true, if all incapacitate determinant is true
    # or number of members in party is 0
    if $game_party.all_dead? or $game_party.all_incapacitate? or $game_party.actors.size == 0
      # If possible to lose
      if $game_temp.battle_can_lose
        # Return to BGM before battle starts
        $game_system.bgm_play($game_temp.map_bgm)
        # Battle ends
        battle_end(2)
        # Return true
        return true
      end
      # Set game over flag
      $game_temp.gameover = true
      # Return true
      return true
    end
    # Return false if even all enemies are incapacitated
    if $game_troop.all_incapacitate?
      start_phase5
      return true
    end
    # Return false if even 1 enemy exists
    for enemy in $game_troop.enemies
      if enemy.exist?
        return false
      end
    end
    # Start after battle phase (win)
    start_phase5
    # Return true
    return true
  end
  #--------------------------------------------------------------------------
  # * Start After Battle Phase
  #--------------------------------------------------------------------------
  def start_phase5
    # Shift to phase 5
    @phase = 5
    # Play battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # Return to BGM before battle started
    $game_system.bgm_play($game_temp.map_bgm)
    # Initialize EXP, amount of gold, and treasure
    exp = 0
    gold = 0
    treasures = []
    # Loop
    for enemy in $game_troop.enemies
      # If EXP_RECEIVE is true
      if OBT_EXP
        # If enemy is not hidden
        unless enemy.hidden 
          # Add EXP and amount of gold obtained
          exp += enemy.exp
          gold += enemy.gold
          # Determine if treasure appears
          if rand(100) < enemy.treasure_prob
            if enemy.item_id > 0
              treasures.push($data_items[enemy.item_id])
            end
            if enemy.weapon_id > 0
              treasures.push($data_weapons[enemy.weapon_id])
            end
            if enemy.armor_id > 0
              treasures.push($data_armors[enemy.armor_id])
            end
          end
        end
      else
        # If enemy is not hidden or incapacitate
        unless enemy.hidden or enemy.incapacitate? 
          # Add EXP and amount of gold obtained
          exp += enemy.exp
          gold += enemy.gold
          # Determine if treasure appears
          if rand(100) < enemy.treasure_prob
            if enemy.item_id > 0
              treasures.push($data_items[enemy.item_id])
            end
            if enemy.weapon_id > 0
              treasures.push($data_weapons[enemy.weapon_id])
            end
            if enemy.armor_id > 0
              treasures.push($data_armors[enemy.armor_id])
            end
          end
        end
      end
    end
    # Treasure is limited to a maximum of 6 items
    treasures = treasures[0..5]
    # Obtaining EXP
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    # Obtaining gold
    $game_party.gain_gold(gold)
    # Obtaining treasure
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # Make battle result window
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # Set wait count
    @phase5_wait_count = 100
  end
end

class Sprite_Battler < RPG::Sprite
  include Gidan::IncapacitateStates
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias tone_change_update update
  def update
    tone_change_update
    # If visible
    if @battler_visible and INC_TONE
      # Incapacitate state set color tone
      if @battler.state?(PETRIFY_STATE) and @battler.damage == nil
        self.tone.set(0, 0, 0, 255)
      #elsif @battler.state?(CUSTOM_STATE) and @battler.damage == nil
        #self.tone.set(0, 80, 255, 0) #self.tone.set(0, 0, 0, 255)
      else
        self.tone.set(0, 0, 0, 0) unless @battler.incapacitate?
      end
    end
  end
end

Demo
DEMO

Credits and Thanks
- Kyonides for exp suggestion

License
You can use it for both commercial and non-commercial games!

Features Mentioned

  • If all party members are hit by this state, it’s game over.
  • If all enemies are hit by this state the battle ends, and you not receive any experience points, items or money.
  • v. 1.0.1
  • You can choose if obtain or not exp and gil when all foes are incapacitated.
  • You can choose if change or not battler color when incapacitated.

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download

License / Terms Note

Credits and Thanks - Kyonides for exp suggestion License You can use it for both commercial and non-commercial games!

Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#custom_state#state#elsif#self#rgss

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar