Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials
Reload this Page [Question] Script Switches

Notices
For all updates, view the main page.

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.



Reply
 
Thread Tools
  #1    
Old March 9th, 2013 (08:42 AM).
Rayd12smitty's Avatar
Rayd12smitty Rayd12smitty is offline
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
Posts: 647
Ok so I recently posted about Hidden Grottos, and now I am confused about script switches, mainly switch 23. "s:cooledDown?(86400)" I understand that it is off until the 24 hour time period has ended, and know how to use it in time sensitive events.

Now, my question comes when you have 2 different time sensitive events, and both want a 24 hour cool down. Can I use the same switch 23 for both of them? I don't understand how a Global Switch could be ON and OFF at the same time for different events. I read everything on the wiki about it, and couldn't find an answer.

I am rereading this and realizing it is hard to understand... Can someone explain this?
__________________
Reply With Quote
  #2    
Old March 9th, 2013 (03:21 PM).
Maruno's Avatar
Maruno Maruno is offline
Lead Dev of Pokémon Essentials
Moderator
 
Join Date: Jan 2008
Location: England
Posts: 4,423
It's not publicised, but as well as each event having a set of Self Switches, each event also has a single Self Variable. It's an Essentials feature.

You'll have seen pbSetEventTime floating around here and there in time-sensitive events. What this does is set the event's Self Variable to the current time.

One other thing to know is that the game doesn't constantly check all the events to make sure they're on the right pages. This stuff is only checked when the map is refreshed, and each event's "active page" is remembered. Refreshing the map is done automatically as part of a few event commands, such as Control Self Switches; you can also force it to happen manually if you want to (unlikely).

Anyway, when a map loads, each event is checked in turn to figure out which page it should be on. For each event in turn, Global Switch 23 checks that event's Self Variable (the time when it was set) and sees whether the current time is later than the set time plus 86400 seconds. If so, it's ON (and vice versa) and the event's page is decided. The next event may calculate it to be OFF again, but that doesn't matter; the event's page has already been decided and remembered. It'll do the same thing if the map is refreshed.

This kind of thing isn't publicised because it's not really something people ever need to know. It just works, that's fair enough. For the rare few who want to know how it works, there's your explanation.
__________________
Reply With Quote
  #3    
Old March 9th, 2013 (03:45 PM).
Rayd12smitty's Avatar
Rayd12smitty Rayd12smitty is offline
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
Posts: 647
Awesome thanks. I kinda assumed you would have just made it work, but I like to understand how things work, not just that they do. This makes perfect sense thanks for the explanation.
__________________
Reply With Quote
  #4    
Old March 9th, 2013 (03:57 PM).
Maruno's Avatar
Maruno Maruno is offline
Lead Dev of Pokémon Essentials
Moderator
 
Join Date: Jan 2008
Location: England
Posts: 4,423
That was done way before my time. I just figured out how it works.

Global Switches 21 and 22 are fairly similar. Each event also has a set of temporary Self Switches ("ts") which are the same as regular Self Switches but they only remember their setting while the event is still loaded, and they flip back to false when they are reloaded. They're used for boulders and Cut trees to reset them upon leaving and returning, as well as doors to make the player walk out of them.
__________________
Reply With Quote
Reply
Quick Reply

Sponsored Links

You may also like.. (Beta)
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 07:45 AM.