State Add/Remove Commands v1.01
Shaz
IntroductionShaz
This script lets you enter RGSS script commands to be run when a state is added or removed. Like calling a common event when a state is added, or setting one state to be replaced by another after a certain number of turns.
Versions
Spoiler
Code:
1.01 26 May 14 Fix issue with + sign in regular expressionsFeatures
- Make something happen when a state is removed.
- Multiple commands may be run for a single state.
How to Use
Paste the script into a new slot below Materials.
In a state's note box, enter onadd: command or onremove: command, where command is any valid RGSS script command.
If a command requires more than will fit in the note box, allow it to wrap to the next line automatically - do NOT use the enter key to go to a new line.
Anything from onadd: or onremove: to the next manual line break will be executed.
You may have several onadd: or onremove: commands for a single state.
Script
Get it here
Examples
If you want to call common event 8 when a state is added, enter the following as the note:
Code:
If you want state 16 to be added when state 15 is removed (replace one state with another), enter the following into the note of state 15:onadd: $game_temp.reserve_common_event(8)Code:
If you want to add a new state when state 20 is removed, and that new state will be 21 if the battler’s hp is 50% or higher, and 22 if lower, enter the following into the note of state 20 (allow it to wrap automatically)onremove: add_state(16)Code:
You could also enter this to achieve the same thing:onremove: if hp_rate < 0.5; add_state(20); else; add_state(21); end;Code:
Feel free to provide a scenario in the comments, and I will give you the command you should use. Game_Interpreter is a good place to look, and any of the properties or methods in Game_Battler or Game_BattlerBase can be used.onremove: add_state(hp_rate < 0.5 ? 20 : 21)FAQ
Credit and Thanks
- Shaz
Author's Notes
Free to use in commercial games. Please give credit.