Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=============================================================================
- # Battle Result Switches
- # by Shaz
- # Last updated: 2016.11.13
- #=============================================================================
- #
- # This script allows you to turn on switches when a battle ends, which you can
- # then use to trigger common events or map events.
- #
- #-----------------------------------------------------------------------------
- # Terms of use:
- # Can be used in commercial games
- # Please do not repost this script - link back to the original source
- #=============================================================================
- # CUSTOMIZATION
- # Replace 0 with the id of the switch you want turned on when the battle ends
- # with the specified result. 0 means no switch will be turned on. You can
- # use the same switch number for all results if appropriate. No leading zeros.
- module SHAZ
- module BRS
- WIN = 0
- LOSE = 0
- ESCAPE = 0
- ABORT = 0
- end
- end
- module BattleManager
- class << self
- alias shaz_battle_result_setup setup
- alias shaz_battle_result_process_victory process_victory
- alias shaz_battle_result_process_escape process_escape
- alias shaz_battle_result_process_abort process_abort
- alias shaz_battle_result_process_defeat process_defeat
- end
- def self.setup(troop_id, can_escape = true, can_lose = false)
- shaz_battle_result_setup(troop_id, can_escape, can_lose)
- $game_switches[SHAZ::BRS::WIN] = false if SHAZ::BRS::WIN != 0
- $game_switches[SHAZ::BRS::LOSE] = false if SHAZ::BRS::LOSE != 0
- $game_switches[SHAZ::BRS::ESCAPE] = false if SHAZ::BRS::ESCAPE != 0
- $game_switches[SHAZ::BRS::ABORT] = false if SHAZ::BRS::ABORT != 0
- @escaping = false
- end
- def self.process_victory
- res = shaz_battle_result_process_victory
- $game_switches[SHAZ::BRS::WIN] = true if SHAZ::BRS::WIN != 0
- return res
- end
- def self.process_escape
- @escaping = true
- res = shaz_battle_result_process_escape
- @escaping = false
- $game_switches[SHAZ::BRS::ESCAPE] = true if res && SHAZ::BRS::ESCAPE != 0
- return res
- end
- def self.process_abort
- res = shaz_battle_result_process_abort
- $game_switches[SHAZ::BRS::ABORT] = true if !@escaping && SHAZ::BRS::ABORT != 0
- return res
- end
- def self.process_defeat
- res = shaz_battle_result_process_defeat
- $game_switches[SHAZ::BRS::LOSE] = true if SHAZ::BRS::LOSE != 0
- return res
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment