The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

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.


Advertise here

Reply
 
Thread Tools
  #1    
Old March 10th, 2013, 07:06 AM
Derxwna Kapsyla's Avatar
Derxwna Kapsyla
X-Class Project, Derxwna, #003
 
Join Date: Jun 2011
Location: Margate, FL
Age: 21
Gender: Male
Nature: Lax

Advertise here
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.
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
The above script is the original script, the one used to set Self Switches across the map its in.
Code:
  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. 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:
  • Touhoumon Essentials Development Starter Kit for RMXP - Version 1 finished and released.
    The following version is outdated a great deal. Do not bother downloading it. I will have a new, revised version up eventually. If you really want the engine, I can provide you with the current engine Faith & Prayer version uses.
  • Touhoumon: Faith and Prayer Version - Demo 3.1 Released
Reply With Quote
  #2    
Old April 7th, 2013, 08:40 PM
Black Eternity's Avatar
Black Eternity
Lord of Eternity
 
Join Date: Sep 2012
Age: 21
Gender: Male
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:
pbSetSelfSwitch2(5,19,"A",true)

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
  #3    
Old April 14th, 2013, 04:52 AM
ppooookkkkkkk
Banned
 
Join Date: May 2012
Location: Newbud town (Pokemon Morning/Night)
Age: 13
Gender: Male
Nature: Gentle
Nice script yo gonna surely use it.

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

Sponsored Links


Advertise here
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 02:33 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.