Simple Auto State Removal
By: FamilyGamer7
By: FamilyGamer7
Introduction
Features
Screenshot(s)
Script
Ruby:
#==============================================================================
# Title: Simple Auto State Removal
# Author: FamilyGamer7 (FG7)
# Version: 1.2
# Engine: RPG Maker VX Ace
#==============================================================================
# ** Change Log |
# ---------------
# 1.0 => Created script
# 1.1 => Added ability to turn off/on script effect anytime in game (script call)
# 1.2 => Fixed error with certain states when clearing all states
#==============================================================================
# ** Description |
# ----------------
# Quick and easy script snippet that will remove all current states on the
# actor once a new state is added on. The actor(s) will only ever have 1 state
# added at one time with this script.
#==============================================================================
# ** Terms of Use |
# -----------------
# * Free to use in non-commercial projects and commercial projects
# * Feel free to modify and improve the script. Credit is still required.
# * Credit FamilyGamer7
#==============================================================================
# ** Usage |
# ----------
# * Plug & Play
# -----------------------------------------------------------------------------
# By default, the script has the auto state removal as turned ON. But, to turn
# off/on the auto state removal, see the script calls below.
#
# To turn OFF auto state removal:
# - $game_system.auto_state_removal_off = true
#
# To turn ON auto state removal:
# - $game_system.auto_state_removal_off = false
#==============================================================================
#==============================================================================
# ** Module: FG7::Auto_State_Removal
#------------------------------------------------------------------------------
# This modules creates a static variable to be used within the script.
#==============================================================================
module FG7
module Auto_State_Removal
#==============================================================================
# -------------------- ALLOWED TO EDIT BELOW THIS LINE ---------------------- #
#==============================================================================
# Sets the value for the $game_switch used for the auto state removal
Auto_State_Removal_Switch = 311
#==============================================================================
# ---------- DO NOT EDIT BELOW THIS LINE (FOR ADVANCED USERS) --------------- #
#==============================================================================
end
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles system data. It saves the disable state of saving and
# menus. Instances of this class are referenced by $game_system.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * New Method: auto_state_removal_off (Flag to turn on/off during game)
#--------------------------------------------------------------------------
def auto_state_removal_off=(string)
@auto_state_removal_off = string
$game_switches[FG7::Auto_State_Removal::Auto_State_Removal_Switch] = @auto_state_removal_off
end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# A battler class with methods for sprites and actions added. This class
# is used as a super class of the Game_Actor class and Game_Enemy class.
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# * Alias Method: Add New State
#--------------------------------------------------------------------------
alias :fg7_auto_state_removal_add_new_state :add_new_state
def add_new_state(state_id)
# Removea any current state when adding a new state
clear_states if $game_switches[FG7::Auto_State_Removal::Auto_State_Removal_Switch] == false
# Calls original method
fg7_auto_state_removal_add_new_state(state_id)
end
end
How to Use
Terms of Use