Advertisement
Vlue

After Battle Events

Sep 3rd, 2014
863
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.51 KB | None | 0 0
  1. #After Battle Events v1.0
  2. #----------#
  3. #Features: Process Troop Events when the player wins, escapes, or is defeated by setting a page
  4. #           with the appropriate switch as it's conditional.
  5. #
  6. #Usage:   Set your switches, set up your pages, run hog wild.
  7. #
  8. #          Victory is called after all enemies are dead and before exp/gold/etc
  9. #          Escape is called when the escape command is chosen and before the result
  10. #          Abort is called when successfully escaping or manual battle abort
  11. #          Defeat is called when all allies are dead
  12. #
  13. #~ #----------#
  14. #-- Script by: V.M of D.T
  15. #
  16. #- Questions or comments can be:
  17. #    given by email: sumptuaryspade@live.ca
  18. #    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
  19. #   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
  20. #
  21. #--- Free to use in any project, commercial or non-commercial, with credit given
  22. # - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
  23.  
  24. VICTORY_EVENT_SWITCH = 90
  25. ESCAPE_EVENT_SWITCH = 91
  26. ABORT_EVENT_SWITCH = 92
  27. DEFEAT_EVENT_SWITCH = 93
  28.  
  29. module BattleManager
  30.   class << self
  31.     alias event_process_victory process_victory
  32.     alias event_process_escape process_escape
  33.     alias event_process_abort process_abort
  34.     alias event_process_defeat process_defeat
  35.   end
  36.   def self.process_victory
  37.     SceneManager.scene.play_victory_event
  38.     return event_process_victory
  39.   end
  40.   def self.process_escape
  41.     SceneManager.scene.play_escape_event
  42.     return event_process_escape
  43.   end
  44.   def self.process_abort
  45.     SceneManager.scene.play_abort_event
  46.     return event_process_abort
  47.   end
  48.   def self.process_defeat
  49.     SceneManager.scene.play_defeat_event
  50.     return event_process_defeat
  51.   end
  52. end
  53.  
  54. class Scene_Battle
  55.   def play_victory_event
  56.     $game_switches[VICTORY_EVENT_SWITCH] = true
  57.     process_end_event
  58.   end
  59.   def play_escape_event
  60.     $game_switches[ESCAPE_EVENT_SWITCH] = true
  61.     process_end_event
  62.   end
  63.   def play_abort_event
  64.     $game_switches[ABORT_EVENT_SWITCH] = true
  65.     process_end_event
  66.   end
  67.   def play_defeat_event
  68.     $game_switches[DEFEAT_EVENT_SWITCH] = true
  69.     process_end_event
  70.   end
  71.   def process_end_event
  72.     while !scene_changing?
  73.       $game_troop.interpreter.update
  74.       $game_troop.setup_battle_event
  75.       wait_for_message
  76.       wait_for_effect if $game_troop.all_dead?
  77.       process_forced_action
  78.       break unless $game_troop.interpreter.running?
  79.     end
  80.   end
  81. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement