Nicke 150 Posted January 3, 2012 (edited) Simple Self Switches Version: 1.0a. Introduction Change your Self Switches easy by using this script. Simply use the call script function to change self switch of the Event ID to true or false. Features Plug and play. Easy to change Self Switches. Use a variable to change Self Switches on another map. Set all Self Switches of an Event ID to true/false with a single call script. Check if a Self Switch is on using a Conditional Branch. Screenshots No. How to Use To install this script, open up your script editor and copy/paste this script to an open slot below Materials but above Main. Remember to save. Script #============================================================================== # Simple Self Switches # Author: Nicke # Created: 16/06/2011 # Edited: 03/01/2012 # Version: 1.0a #============================================================================== # Instructions # ----------------------------------------------------------------------------- # To install this script, open up your script editor and copy/paste this script # to an open slot below â–¼ Materials but above â–¼ Main. Remember to save. # # Use the call script to use this script. # # setSelfSwitch (map, id, A-D, true/false) # isSelfSwitch?(map, id, A-D, true) # setAllSelf(map, id, true/false) # # Note: You can use @map_id if you change the self switches on the same map. # # Example 1: setSelfSwitch(@map_id, 1, "A", true) # This will change the Self Switch "A" of event ID 1 to true on current map. # Example 2: setSelfSwitch(2, 1, "A", false) # This will change the Self Switch "A" of event ID 1 to false on map id 2. # # You can also check if Self Switch is true/false. # Example: isSelfSwitch?(2, 1, "A") # Is event_id 1 true on map id 2? # Example: !isSelfSwitch?(@map_id, 1, "A") # Is event_id 1 false on current map? # Put this in a Conditional Branch. # # Last but not least you can turn all Self Switches to true/false. # Example 1: setAllSelf(2, 1, true) Set all of event id 1 true on map id 2. # Example 2: setAllSelf(@map_id, 1, true) Set all of event id 1 to true on current map. # # *** Only for RPG Maker VX Ace. *** #============================================================================== ($imported ||= {})["NICKE-EVENT-SELFSWITCHES"] = true # *** Don't edit below unless you know what you are doing. *** #==============================================================================# # ** Game_Interpreter #==============================================================================# class Game_Interpreter # // Set SelfSwitch to true/false. def setSelfSwitch(map, eID, selfSwitch, trueFalse) switch = [map, eID, selfSwitch] $game_self_switches[switch] = trueFalse end # // Is SelfSwitch true/false? def isSelfSwitch?(map, eID, selfSwitch) switch = [map, eID, selfSwitch] $game_self_switches[switch] end # // Set all SelfSwitches to true/false. def setAllSelf(map, eID, trueFalse) switches = ["A","B","C","D"] for i in switches setSelfSwitch(map, eID, i, trueFalse) end end end # END OF FILE #=*==========================================================================*=# # ** END OF FILE #=*==========================================================================*=# Updates Released 1.0a. Should be pretty easy now changing a self switch on another map. Credit Credit me, Nicke, if you are going to use it. Thanks. Can be use in a commercial project. Edited February 18, 2012 by Niclas 1 SixShotSamael reacted to this Share this post Link to post Share on other sites
+ Abscond 149 Posted January 3, 2012 Nice script you got there. I love Self Switch scripts because I hate using control switches for simple things Self Switches can fix. Definitely using this. Share this post Link to post Share on other sites
Nicke 150 Posted January 3, 2012 @rgangsta: Thanks. I've updated it now too since I forgot to add the option to change self switches on another map. Share this post Link to post Share on other sites
BulletPlus 7 Posted January 4, 2012 a very useful script. thank you. Share this post Link to post Share on other sites
Chantal 21 Posted May 3, 2012 One of the most usefull scripts out there. To be honest I'm having difficulty understanding why RPG Maker doesn't come with this function build in. Thank you for making this Share this post Link to post Share on other sites
Tsukihime 1,487 Posted May 3, 2012 They do. They give you 4 self-switches lol Share this post Link to post Share on other sites
Nicke 150 Posted May 4, 2012 I think he meant the options to do as the script I made. That it should have been in the default scripts already. Share this post Link to post Share on other sites
Bird Eater 7 Posted May 6, 2012 (edited) I think he meant the options to do as the script I made. That it should have been in the default scripts already. But it's not really that different from what's already built in, right? $game_self_switches[map_id,event_id,switch] = true/false Isn't that much harder to type out than setSelfSwitch(map, eID, selfSwitch, trueFalse) Still pretty useful for those who don't know the syntax, though. Edited May 6, 2012 by Bird Eater 2 ZumataScream and SixShotSamael reacted to this Share this post Link to post Share on other sites
Nicke 150 Posted May 13, 2012 Yeah I guess. But I found it easier using my script if you want to change an events self switch on another map Share this post Link to post Share on other sites
KayDgirl91 99 Posted September 22, 2013 (edited) I love this script! So useful! Got a question though, would it be possible to make it so with a script call command you could make it so it changes all self switches based on mapID to false/true? Instead of having to specify every single event you want to change the self switch for? Edit: For example: setAllSelf(8, false) Instead of setAllSelf(8, 1, false) setAllSelf(8, 2, false) setAllSelf(8, 3, false) setAllSelf(8, 4, false) Etc. Because I have a lot of events (30+) on almost every map (planning a couple hundred.) in my project that I have reset when you leave that map. And having to type in that same script call for every event is very time consuming. Edited September 22, 2013 by KevinFrost Share this post Link to post Share on other sites
Lord Zonar 0 Posted September 30, 2017 I need help, when the script command was activated and I went to the map where the events were supposed to be, they dissapeared and wouldn't come back no matter what. they would only be their before the command is turned on, but permanently dissapear after Share this post Link to post Share on other sites