Advertisement
TroyZ

TroyZ - Preemptive Surprise Toggler

Jun 12th, 2013
521
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.08 KB | None | 0 0
  1. # ==============================================================================
  2. # ▼▼▼▼▼▼                TroyZ - Preemptive Surprise Toggler               ▼▼▼▼▼▼
  3. # ==============================================================================
  4. # Script by : Agung Prasetyo(TroyZ)
  5. # Contact me by : - Email agung.endisnear.xyz@gmail.com
  6. #                 - Forum RPGMakerID, username TroyZ
  7. #                 - Handphone 085756289121
  8. # Engine : VXAce
  9. # Level : Easy
  10. # Version : 1.0
  11. # ------------------------------------------------------------------------------
  12. # Change Logs :
  13. # 17 June 2013 : Version 1.0 released
  14. # ------------------------------------------------------------------------------
  15. # How this work :
  16. # This little script will give you an ability to control preemptive and surprise
  17. # battle at exact rate by using switch.
  18. # ------------------------------------------------------------------------------
  19. # How to use :
  20. # Place it between material and main. Set your preemptive and surprise switch
  21. # in the module. If preemptive switch is ON, the battle will be in a preemptive
  22. # conditions. If surprise switch is ON, the battle will be in a surprise conditions.
  23. # If both switches are ON or OFF, then the default preemptive and suprise rate
  24. # will be used. It works on random encounters and event battle.
  25. # ------------------------------------------------------------------------------
  26. # Compatibility issues :
  27. # I haven't get any compatibility issues actually. If you get some, let me know,
  28. # and bug fixes will come.
  29. # ------------------------------------------------------------------------------
  30. # Who to credit :
  31. # - Allah swt. : For the chance of living that he has given to me.
  32. # - Nabi Muhammad saw. : As a leader and messenger and prophet of Muslim.
  33. #                        I'm proud to be your follower. :)
  34. # - Agung Prasetyo(TroyZ) : Thats me, of course, the ones that made this script. :P
  35. # ------------------------------------------------------------------------------
  36. # License :
  37. # - Free Game : Just credit those two first names. My name in the credit?
  38. # If you pleased, but if you don't, no problem, this is just a simple script actually.
  39. # - Commercial Game : Same as free game's license.
  40. # ------------------------------------------------------------------------------
  41. $imported = {} if $imported.nil?
  42. $imported[:TroyZ_PreemptiveSurpriseToggler] = true
  43. module AGUNG
  44.   PREEMPTIVE_SWITCH = 1 # set the preemptive switch. If ON, preemptive battle will come
  45.   SURPRISE_SWITCH = 2 # set the surprise switch. If ON, surprise battle will come
  46. end
  47.  
  48. module BattleManager  
  49.   def self.on_encounter
  50.     if $game_switches[AGUNG::PREEMPTIVE_SWITCH] && $game_switches[AGUNG::PREEMPTIVE_SWITCH] != $game_switches[AGUNG::SURPRISE_SWITCH]
  51.       @preemptive = true
  52.     elsif $game_switches[AGUNG::SURPRISE_SWITCH] && $game_switches[AGUNG::PREEMPTIVE_SWITCH] != $game_switches[AGUNG::SURPRISE_SWITCH]
  53.       @surprise = true
  54.     else
  55.       @preemptive = (rand < rate_preemptive)
  56.       @surprise = (rand < rate_surprise && !@preemptive)
  57.     end    
  58.   end
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement