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

Status
Not open for further replies.

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,710
Reaction score
1,127
First Language
Portuguese - Br
Primarily Uses
RMMZ
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.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
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.
 

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
843
Reaction score
470
First Language
Poland
Primarily Uses
RMMV
Since I like scripts, instead of eventing, you can do it like this.



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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
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.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,710
Reaction score
1,127
First Language
Portuguese - Br
Primarily Uses
RMMZ
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.



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
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,867
Reaction score
5,240
First Language
Dutch
Primarily Uses
RMXP

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.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,551
Members
137,837
Latest member
Dabi
Top