• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

Setting Self-Switches across multiple maps 1.0

So, I decided to port over some of the stuff I had on Pokecommunity to here; to start off the porting: Setting Self-Switches across different maps

This code expands upon the existing Self-Switch functionality, which currently only allows you to set events self-switches on the same map. I stumbled across this code when looking for how to get Self Switches working in RPG Maker VX Ace, and it's been extraordinarily useful. I asked my friend Maralis if she could reverse engineer the code to work in XP, and fortunately there wasn't much that needed to be done.

First, find the original script, around line 343 in Messages (or just use Shift+Alt+F to do a Global Search), which unedited should be this:
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

Then, place the following underneath it
Code:
# Sets another event's self switch on a different map (eg. pbSetSelfSwitch(420,15,"A",true) ).
# To be used in a script event command.
	def pbSetSelfSwitch2(map,event,swtch,value)
		 $game_self_switches[[map,event,swtch]]=value
		 $game_map.need_refresh = true
	 end

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.
Credits
I can't find the script that inspired this one, so I don't know who to offer credit to there, however in regards to this script, credit is mostly directed at a friend of mine named Maralis (Since she made the code) and then myself.
  • Like
Reactions: Marina
Author
DerxwnaKapsyla
Views
1,492
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from DerxwnaKapsyla

Back
Top