Advertisement
Guest User

Simple Self Switches

a guest
Dec 29th, 2011
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.32 KB | None | 0 0
  1. #==============================================================================
  2. #   Simple Self Switches
  3. #   Author: Nicke
  4. #   Created: 16/06/2011
  5. #   Edited: 12/12/2011
  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. # Example: setSelfSwitch(1, "A", true)
  16. # This will change the Self Switch of event ID 1 to true.
  17. #
  18. # If you want to change a Self Switch on another map do like this:
  19. # Change EVENT_ID in the script to your Event ID variable.
  20. # Then set the variable in a event to the ID you want to change.
  21. #
  22. # You can also check if Self Switch is true/false.
  23. # Example: isSelfSwitch?(1, "A") # True
  24. # Example: !isSelfSwitch?(1, "A") # False
  25. # Put this in a Conditional Branch.
  26. #
  27. # Last but not least you can turn all Self Switches to true/false.
  28. # Example: setAllSelfTo(1, true)
  29. # This will set all Self Switches to true of Event ID 1.
  30. #==============================================================================
  31. ($imported ||= {})["NICKE-EVENT-SELFSWITCHES"] = true
  32. module NICKE
  33.   module SELF_SWITCHES
  34. #==============================================================================#
  35. # ** Settings
  36. #==============================================================================#
  37.   EVENT_ID = 944     # Event ID variable.
  38.   end
  39. end
  40. # *** Don't edit below unless you know what you are doing. ***
  41. class Game_Interpreter
  42.      
  43.   # Set SelfSwitch Event ID true/false.
  44.   def setSelfSwitch(eID, selfSwitch, trueFalse)
  45.     switch = [@map_id, eID, selfSwitch]
  46.     $game_self_switches[switch] = trueFalse
  47.     $game_map.need_refresh = true
  48.   end
  49.  
  50.   # Is SelfSwitch of Event ID true/false?
  51.   def isSelfSwitch?(eID, selfSwitch)
  52.     switch = [@map_id, eID, selfSwitch]
  53.     return $game_self_switches[switch]
  54.   end
  55.  
  56.   # Set SelfSwitch of Event var ID to true/false.
  57.   def setSelfEvent(selfSwitch, trueFalse)
  58.      eID = $game_variables[NICKE::SELF_SWITCHES::EVENT_ID]
  59.      key = [@map_id, eID, selfSwitch]
  60.      $game_self_switches[key] = trueFalse
  61.      $game_map.need_refresh = true
  62.    end
  63.  
  64.   # Is SelfSwitch of Event var ID true/false?
  65.   def isSelfEvent?(selfSwitch)    
  66.     eID = $game_variables[NICKE::SELF_SWITCHES::EVENT_ID]
  67.     switch = [@map_id, eID, selfSwitch]
  68.     return $game_self_switches[switch]
  69.   end
  70.  
  71.   # Set all SelfSwitches to true/false.
  72.   def setAllSelfTo(eID, trueFalse)
  73.     setSelfSwitch(eID, "A", trueFalse)
  74.     setSelfSwitch(eID, "B", trueFalse)
  75.     setSelfSwitch(eID, "C", trueFalse)
  76.     setSelfSwitch(eID, "D", trueFalse)
  77.   end
  78.  
  79.   # Set all SelfSwitches Event var ID to true/false.
  80.   def setAllSelfEventTo(trueFalse)
  81.     eID = $game_variables[NICKE::SELF_SWITCHES::EVENT_ID]
  82.     setSelfSwitch(eID, "A", trueFalse)
  83.     setSelfSwitch(eID, "B", trueFalse)
  84.     setSelfSwitch(eID, "C", trueFalse)
  85.     setSelfSwitch(eID, "D", trueFalse)
  86.   end
  87.  
  88. end # END OF FILE
  89.  
  90. #=*==========================================================================*=#
  91. # ** END OF FILE
  92. #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement