Advertisement
Guest User

XS - Self Switches

a guest
Apr 5th, 2012
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.66 KB | None | 0 0
  1. #==============================================================================
  2. #   XaiL System - Self Switches
  3. #   Author: Nicke
  4. #   Created: 16/06/2011
  5. #   Edited: 03/01/2012
  6. #   Version: 1.0
  7. #==============================================================================
  8. # Instructions
  9. # -----------------------------------------------------------------------------
  10. # To install this script, open up your script editor and copy/paste this script
  11. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  12. #
  13. # Use the call script to use this script.
  14. #
  15. # setSelfSwitch (map, id, A-D, true/false)
  16. # isSelfSwitch?(map, id, A-D, true)
  17. # setAllSelf(map, id, true/false)
  18. #
  19. # Note: You can use @map_id if you change the self switches on the same map.
  20. #
  21. # Example 1: setSelfSwitch(@map_id, 1, "A", true)
  22. # This will change the Self Switch "A" of event ID 1 to true on current map.
  23. # Example 2: setSelfSwitch(2, 1, "A", false)
  24. # This will change the Self Switch "A" of event ID 1 to false on map id 2.
  25. #
  26. # You can also check if Self Switch is true/false.
  27. # Example: isSelfSwitch?(2, 1, "A") # Is event_id 1 true on map id 2?
  28. # Example: !isSelfSwitch?(@map_id, 1, "A") # Is event_id 1 false on current map?
  29. # Put this in a Conditional Branch.
  30. #
  31. # Last but not least you can turn all Self Switches to true/false.
  32. # Example 1: setAllSelf(2, 1, true) Set all of event id 1 true on map id 2.
  33. # Example 2: setAllSelf(@map_id, 1, true) Set all of event id 1 to true on current map.
  34. #
  35. # *** Only for RPG Maker VX Ace. ***
  36. #==============================================================================
  37. ($imported ||= {})["XAIL-EVENT-SELFSWITCHES"] = true
  38. # *** Don't edit below unless you know what you are doing. ***
  39. #==============================================================================#
  40. # ** Game_Interpreter
  41. #==============================================================================#
  42. class Game_Interpreter
  43.  
  44.   # // Set SelfSwitch to true/false.
  45.   def setSelfSwitch(map, eID, selfSwitch, trueFalse)
  46.     switch = [map, eID, selfSwitch]
  47.     $game_self_switches[switch] = trueFalse
  48.   end
  49.    
  50.   # // Is SelfSwitch true/false?
  51.   def isSelfSwitch?(map, eID, selfSwitch)
  52.     switch = [map, eID, selfSwitch]
  53.     $game_self_switches[switch]
  54.   end
  55.  
  56.   # // Set all SelfSwitches to true/false.
  57.   def setAllSelf(map, eID, trueFalse)
  58.     switches = ["A","B","C","D"]
  59.     for i in switches
  60.       setSelfSwitch(map, eID, i, trueFalse)
  61.     end
  62.   end
  63.  
  64. end # END OF FILE
  65.  
  66. #=*==========================================================================*=#
  67. # ** END OF FILE
  68. #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement