Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #============================================================================
- #
- # "Remove Single State Stack with Remove Command" - Script
- #
- # Version: 1.0 (January 18th, 2016)
- # Author: Another Fen <forums.rpgmakerweb.com>
- #
- # Requires:
- # - "Stacking States" V1.1 by Neon Black
- # http://forums.rpgmakerweb.com/index.php?/topic/14110-stacking-states/
- # - "State Add/Remove Commands" V1.01 by Shaz
- # http://forums.rpgmakerweb.com/index.php?/topic/18593-state-addremove-commands/
- #
- # Contents: -----------------------------------------------------------------
- #
- # Removing states by skill effects and event commands should now remove only
- # one stack. The state will still get completely removed when it expires or
- # is resisted.
- #
- # This script is meant to be inserted below the required scripts but as
- # close to "▼ Materials" as possible. It might not work with future versions
- # of either script.
- #
- #============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # * Remove Single State Stack
- # Future changes to remove_state/erase_state may have to be reflected here!
- #--------------------------------------------------------------------------
- def remove_state_stack(state_id)
- case @states.count(state_id)
- when 0
- return
- when 1
- remove_state(state_id)
- else
- @states.delete_at(@states.index(state_id))
- @result.removed_states.push(state_id).uniq!
- refresh
- state_remove_command(state_id)
- end
- end
- #--------------------------------------------------------------------------
- # * Erase State (Redefined)
- # Now calls "state_remove_command" once for every removed stack
- #--------------------------------------------------------------------------
- def erase_state(state_id)
- erase_count = state_stack(state_id)
- super
- erase_count.times { state_remove_command(state_id) }
- end
- #--------------------------------------------------------------------------
- # * [Remove State] Effect (Redefined)
- # Modified to remove only one stack. Removed "remove_state" call!
- #--------------------------------------------------------------------------
- def item_effect_remove_state(user, item, effect)
- chance = effect.value1
- if rand < chance
- remove_state_stack(effect.data_id) # <- Modified
- @result.success = true
- end
- end
- end
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # * Change State (Redefined)
- # Modified to remove only one stack. Removed "remove_state" call!
- #--------------------------------------------------------------------------
- def command_313
- iterate_actor_var(@params[0], @params[1]) do |actor|
- already_dead = actor.dead?
- if @params[2] == 0
- actor.add_state(@params[3])
- else
- actor.remove_state_stack(@params[3]) # <- Modified
- end
- actor.perform_collapse_effect if actor.dead? && !already_dead
- end
- $game_party.clear_results
- end
- #--------------------------------------------------------------------------
- # * Change Enemy State (Redefined)
- # Modified to remove only one stack. Removed "remove_state" call!
- #--------------------------------------------------------------------------
- def command_333
- iterate_enemy_index(@params[0]) do |enemy|
- already_dead = enemy.dead?
- if @params[1] == 0
- enemy.add_state(@params[2])
- else
- enemy.remove_state_stack(@params[2]) # <- Modified
- end
- enemy.perform_collapse_effect if enemy.dead? && !already_dead
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement