Derxwna Kapsyla
Derxwna "The Badman" Kapsyla
- 437
- Posts
- 13
- Years
- Everywhere, yet Nowhere
- Seen Apr 15, 2025
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.
The above script is the original script, the one used to set Self Switches across the map its in.
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?
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.
Code:
# Sets another event's self switch (eg. pbSetSelfSwitch(20,"A",true) ).
# To be used in a script event command.
def pbSetSelfSwitch(event,swtch,value)
$game_self_switches[[@map_id,event,swtch]]=value
$game_map.need_refresh = true
end
Code:
def pbSetSelfSwitch2(map,event,swtch,value)
$game_self_switches[[map,event,swtch]]=value
$game_map.need_refresh = true
end
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.