(SOLVED) Turn self switch off after x frames/seconds etc

Hi there!
I'm looking for a plugin that turn a self switch on for a time then after that time is over, the self switch it will be turn off again.

I'm pretty sure that i 'am already found this or something simillar. But i cannot found it anymore.

I have an event with two pages. And this two pages are triggered with "event touch". I want when the first page is activated by the event touch, it will turn a self switch a on, then the event will go to the page 2.

But the page 2 will only be active for a "x" time, then the self switch will go off again.

I know i can make this with parallel events, but it will lag the game since there will be 30 + events with this configuration.
I know i can make this with parallel events, but it will lag the game since there will be 30 + events with this configuration.

Not necessarily, you can actually do it with a single parallel process that handles all of those events, and the effect on processing will be almost the same as if you code it into a plugin.

Of course, depending on complexity it might be way better to just request a plugin especially if you cannot setup the event yourself.
Since I like scripts, instead of eventing, you can do it like this.
eee1.jpg

eee2.jpg


In place of "x" in script type your desired number (multiplication by 60 will return time in seconds instead of frames, but you can remove it)

Code:
var key = [this._mapId, this._eventId, "A"]

this.wait(60 * x)

$gameSelfSwitches.setValue(key, false)

explanation of code:

var key = [this._mapId, this._eventId, "A"] - define array of Self Switch in event
this._mapId - returns ID of map, where event runs
this._eventId - returns ID of event you run
"A" - Your self switch, you can choose following: "A", "B", "C" and "D"
this.wait(x) - sets event delay in frames (multiply it by 60 to get delay in seconds)
$gameSelfSwitches.setValue(key, false) - method to turn on (set to true second argument) or turn of (set to false)

This parallel event should not cause any lags, since I'm using this method very often to toggle traps on my maps, check, test, and give me a reply.
Why not just use event commands?

Code:
Wait 600 frames
Control Self Switches: A = OFF

The problem with this (and the scripting solution above) is that a parallel process event page will reset when you leave the map and return. So if you had a wait of 10 minutes, and you left the map at 9 minutes and 30 then came back, you'd have to wait another 10 minutes.


The OP has found my multi timer plugin and is working on getting it up and running.
Hi people!
Not necessarily, you can actually do it with a single parallel process that handles all of those events, and the effect on processing will be almost the same as if you code it into a plugin.

Of course, depending on complexity it might be way better to just request a plugin especially if you cannot setup the event yourself.
@Engr. Adiktuzmiko
This will not work for me, because if i use only parallel for all events, their time will be syncronized, and i dont want that =/


Since I like scripts, instead of eventing, you can do it like this.
eee1.jpg

eee2.jpg


In place of "x" in script type your desired number (multiplication by 60 will return time in seconds instead of frames, but you can remove it)

Code:
var key = [this._mapId, this._eventId, "A"]

this.wait(60 * x)

$gameSelfSwitches.setValue(key, false)

explanation of code:

var key = [this._mapId, this._eventId, "A"] - define array of Self Switch in event
this._mapId - returns ID of map, where event runs
this._eventId - returns ID of event you run
"A" - Your self switch, you can choose following: "A", "B", "C" and "D"
this.wait(x) - sets event delay in frames (multiply it by 60 to get delay in seconds)
$gameSelfSwitches.setValue(key, false) - method to turn on (set to true second argument) or turn of (set to false)

This parallel event should not cause any lags, since I'm using this method very often to toggle traps on my maps, check, test, and give me a reply.

Hi @Soulrender I aprreciate the script call function, surely i will use it for another ocasion! But my second page cannot be a parallel trigger =/


Why not just use event commands?

Code:
Wait 600 frames
Control Self Switches: A = OFF

The problem with this (and the scripting solution above) is that a parallel process event page will reset when you leave the map and return. So if you had a wait of 10 minutes, and you left the map at 9 minutes and 30 then came back, you'd have to wait another 10 minutes.


The OP has found my multi timer plugin and is working on getting it up and running.

Thank you again @Shaz, he problem has been solved with you plugin multi timers ^^
Anyone who want this to work just go here:
https://forums.rpgmakerweb.com/index.php?threads/multi-timers.50474/page-4#post-943285

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-turn-self-switch-off-after-x-frames-seconds-etc.105663/