I am not sure if this has been asked or not, but surely I have used Google with "site:forum.rpgmakerweb.com" in the search keyword tail everytime I searched for this question. It could be that this question is too easy to answer or may be I am just bad with keyword searching.
Anyway, here is the case:
Let's say I want to spawn an enemy in a room when the total playing time is 3600 seconds (and up), except if you manage to turn off one switch in that room before the total playing time reaches 3600 seconds. But that's not everything; turning off the switch in that room will just delay the enemy spawn for ....hmmm.... let's say 1800 seconds.
So here what I did:
For the part where the enemy spawn after 3600 seconds unless you turn off the switch is quite easy
0. Created a switch called "start", and set it to ON when the game starts using auto run effects.
1. Created a common event called "whatever" with parallel process on "start" switch.
2. Created a switch called "delay" and variable called "playing time"
2. In "whatever", made a conditional branch in which if switch called "delay" is ON, then "playing time" is set to 0, else, "playing time" is set to "play time"
3 Created the switch event on that room with action button trigger that will turn the switch called "delay" and self switch A on.
4. Created the enemy event on that same room with "playing time" condition = 3600 or above.
Done, at least for the first part.
Now, instead of setting "playing time" to 0, I would want it to be set to "play time - 1800".
I have tried:
1. $game_variables[n] = $game_system.playtime_s - 1800 on script call in "whatever" conditional branch, and it gives out error when I turn off the switch in that room.
2. $game_variables[n] = Time.now.to_i - 1800 on script call on script call in "whatever" conditional branch, and nothing happened!
What should it be?
Guess....I am such a big newbie in scripting lol.
Thanks for at least reading!
Anyway, here is the case:
Let's say I want to spawn an enemy in a room when the total playing time is 3600 seconds (and up), except if you manage to turn off one switch in that room before the total playing time reaches 3600 seconds. But that's not everything; turning off the switch in that room will just delay the enemy spawn for ....hmmm.... let's say 1800 seconds.
So here what I did:
For the part where the enemy spawn after 3600 seconds unless you turn off the switch is quite easy
0. Created a switch called "start", and set it to ON when the game starts using auto run effects.
1. Created a common event called "whatever" with parallel process on "start" switch.
2. Created a switch called "delay" and variable called "playing time"
2. In "whatever", made a conditional branch in which if switch called "delay" is ON, then "playing time" is set to 0, else, "playing time" is set to "play time"
3 Created the switch event on that room with action button trigger that will turn the switch called "delay" and self switch A on.
4. Created the enemy event on that same room with "playing time" condition = 3600 or above.
Done, at least for the first part.
Now, instead of setting "playing time" to 0, I would want it to be set to "play time - 1800".
I have tried:
1. $game_variables[n] = $game_system.playtime_s - 1800 on script call in "whatever" conditional branch, and it gives out error when I turn off the switch in that room.
2. $game_variables[n] = Time.now.to_i - 1800 on script call on script call in "whatever" conditional branch, and nothing happened!
What should it be?
Guess....I am such a big newbie in scripting lol.
Thanks for at least reading!

