Go Back   The PokéCommunity Forums > Create & Discover > Game Development > Scripts & Tutorials
Reload this Page Essentials script Setting Self Switch in one map from another map

For all updates, view the main page.

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Thread Tools
Old March 10th, 2013 (7:06 AM).
Derxwna Kapsyla's Avatar
Derxwna Kapsyla Derxwna Kapsyla is offline
X-Class Project, Derxwna, #003
Join Date: Jun 2011
Location: Margate, FL
Age: 22
Gender: Male
Nature: Lax
Posts: 328
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.
  def pbSetSelfSwitch(event,swtch,value)
    $game_map.need_refresh = true
The above script is the original script, the one used to set Self Switches across the map its in.
  def pbSetSelfSwitch2(map,event,swtch,value)
    $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?
Development Blog:
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.
Game Projects:
In Progress:
Reply With Quote
Old April 7th, 2013 (8:40 PM).
Black Eternity's Avatar
Black Eternity Black Eternity is offline
Lord of Eternity
Join Date: Sep 2012
Age: 22
Gender: Male
Posts: 59
Thank you for sharing this!
One thing you should note, "for beginners", to actually use it in an event...

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
Reply With Quote
Old April 14th, 2013 (4:52 AM).
ppooookkkkkkk ppooookkkkkkk is offline
Join Date: May 2012
Location: Newbud town (Pokemon Morning/Night)
Age: 14
Gender: Male
Nature: Gentle
Posts: 229
Nice script yo gonna surely use it.

It will solve most of my problem ^.^
Reply With Quote
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are UTC -8. The time now is 6:28 PM.