Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------------------------------------------------------------------------------
- # After Battle Events (Vlue) Addon by mjshi
- # Version 1.0
- # Automatically turns off switches after battle event processing
- #-------------------------------------------------------------------------------
- # Usage: Put in scripts, above Main.
- #-- Victory is called after all enemies are dead and before exp/gold/etc
- #-- Escape is called when the escape command is chosen and before the result
- #-- Abort is called when successfully escaping or manual battle abort
- #-- Defeat is called when all allies are dead
- # Requires: None
- #-------------------------------------------------------------------------------
- module AfterBattleEvents
- #-----------------------------------------------------------------------------
- # Configuration:
- # These switches will be turned on when each respective event occurs.
- #-----------------------------------------------------------------------------
- VICTORY_EVENT_SWITCH = 90
- ESCAPE_EVENT_SWITCH = 91
- ABORT_EVENT_SWITCH = 92
- DEFEAT_EVENT_SWITCH = 93
- end
- module BattleManager
- class << self
- alias event_process_victory process_victory
- alias event_process_escape process_escape
- alias event_process_abort process_abort
- alias event_process_defeat process_defeat
- end
- def self.process_victory
- SceneManager.scene.play_victory_event
- return event_process_victory
- end
- def self.process_escape
- SceneManager.scene.play_escape_event
- return event_process_escape
- end
- def self.process_abort
- SceneManager.scene.play_abort_event
- return event_process_abort
- end
- def self.process_defeat
- SceneManager.scene.play_defeat_event
- return event_process_defeat
- end
- end
- class Scene_Battle
- include AfterBattleEvents
- def play_victory_event
- $game_switches[VICTORY_EVENT_SWITCH] = true
- process_end_event
- end
- def play_escape_event
- $game_switches[ESCAPE_EVENT_SWITCH] = true
- process_end_event
- end
- def play_abort_event
- $game_switches[ABORT_EVENT_SWITCH] = true
- process_end_event
- end
- def play_defeat_event
- $game_switches[DEFEAT_EVENT_SWITCH] = true
- process_end_event
- end
- def process_end_event
- while !scene_changing?
- $game_troop.interpreter.update
- $game_troop.setup_battle_event
- wait_for_message
- wait_for_effect if $game_troop.all_dead?
- process_forced_action
- $game_switches[VICTORY_EVENT_SWITCH] ? $game_switches[VICTORY_EVENT_SWITCH] = false : nil
- $game_switches[ESCAPE_EVENT_SWITCH] ? $game_switches[ESCAPE_EVENT_SWITCH] = false : nil
- $game_switches[ABORT_EVENT_SWITCH] ? $game_switches[ABORT_EVENT_SWITCH] = false : nil
- $game_switches[DEFEAT_EVENT_SWITCH] ? $game_switches[DEFEAT_EVENT_SWITCH] = false : nil
- break unless $game_troop.interpreter.running?
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement