The current version of pbSetSelfSwitch is a really good addition to Pokemon Essentials, as it allows you to remotely set the self switch of an event. This nullifies the need to make another global switch which only effects 1 solitary event. The only downside to it was that it only worked locally, within the same map. Sometimes, you needed an event which did something, but only after you were many maps away, and would be solved much easier with a Self Switch than a Global Switch, as it would only effect that one event. Not to mention, RPG Maker XP has a limit of 999 Global Switches, and after that you can't create anymore. If you have your entire Global Switches filled up with switches that effect one event and only one event, on a repetitive basis, you'll eventually find yourself running short on space for switches when you need them.
While I was messing around with RPG Maker VX Ace, I found a script that allowed you set the Self Switch of an event from anywhere to any event across the game. This was a much useful, and I had asked my friend if he could figure out how to reverse-engineer (if that's the right term) the script so it would would in RPG Maker XP. Fortunately, the process was so simple that reverse-engineering wasn't really needed.
# Sets another event's self switch (eg. pbSetSelfSwitch(20,"A",true) ).
# To be used in a script event command.
$game_map.need_refresh = true
The above script is the original script, the one used to set Self Switches across the map its in.
$game_map.need_refresh = true
This script changes @map_id so that it's an actual variable and not dependent on the map you're currently on. This script, however, cannot replace the original one, as it will break areas where you've currently used pbSetSelfSwitch. The script has been tested, and is shown to remain in effect even after you leave the maps where the event was set and the map where the set event was. The script should be placed below the original, in the PokemonMessages script section, around Line 364.
Hopefully you find a use for this script, I know it's going to be useful to me.
If used, you should probably give credit to Mugendai/DoctorInfinity for this, as he's the one who modified it to work across the game. Maruno why wasn't this in Essentials by default?
For more information future news and updates to any projects, the following blogs are where I post information. You can usually hit me with a message there when it comes to bug reports or feedback, or general conversation about something.
http://chaoticinfinitydev.tumblr.com/ - Specialized blog for ChaoticInfinity Development related projects, mostly used to post releases or important and critical information regarding future versions and releases.
Thank you for sharing this!
One thing you should note, "for beginners", to actually use it in an event...
pbSetSelfSwitch2(MAP ID,EVENT ID,SWITCH,TRUE/FALSE)
Map ID = Going to map list on the side, right click and select "Map Properties" (ID:###)
Event ID = When editing event you will also see "ID:###"
Switch = "A,B,C,D"
True/False = .............
an full example:
Also, make sure not to place these events too close to the edge of the map,
as it will not be refreshed until upon entering the map. (Can still see the event from other map)
Just trying to make it easier. I am a noob.
[Pokemon Essentials Scripts]
Banking System: Here
Berry Trading System: Here