How can I generate items over time?

Hey there, I'm brand new to RPG Maker. I'm trying to implement the following, but am having hard time wrapping my head around it. I want to...

1. Walk up to an object on the map and "turn it on," so to speak.
2. While the object is on, I'd like an item automatically added to my inventory every 10 minutes.
3. I'd also like to be able to walk back to the object and "turn it off," when I want to (so I can keep it on as I play for an hour or so, but also switch it off.)

I'm still learning how everything works (even though Steam says I've "played" RPG Maker for 72 hours. I've been learning about Conditional Branches and trying to do this with the Timer and the self on/off switches -- but I'm just having a difficult time to conceptually put it all together.

Thank you!! 🙂
Doable with common event with parallel option. Just add wait 600 (600 seconds) at the end.
Perhaps your object has two pages. Page 1 has no conditions and interacting with it turns Switch 1 on. Page 2 has the condition "Switch 1 ON" and it turns Switch 1 off.

Then create two variables - seconds and minutes. So variable 1 is seconds, variable 2 is minutes.

Then you could have a common event that's a parallel process and requires Switch 1 to be on. We'll have it run every 60 frames (since 1 frame is 1/60th of a second). It will increment variable 1 by 1, then if variable 1 is equal to 60, set variable 1 to 0 and increment variable 2 by 1. Once variable 2 is equal to 10, add the item to the player's inventory, then set variable 2 to 0. At the end of it all, put a "wait 60 frames".

Your common event won't run during battle and I think there might be a few other scenes or occasions where it's not running, so your timer won't increment, but that's one way you could do it without any Plugins or script calls.

Spoiler: Example Common Event
vmjeBaZ.png

@sura_tc One thing to consider - does the wait timer for a common event start over when you change Scenes? For example, if you have a common event that says wait 600 frames, then you get into a battle after 200 frames, does the wait timer start over at 0 when you get out of the battle? If so, then this more complicated method of tracking seconds and variables could work better since you're better able to keep track of your out-of-battle time.

If it doesn't, then yes, that would be simpler.
Perhaps your object has two pages. Page 1 has no conditions and interacting with it turns Switch 1 on. Page 2 has the condition "Switch 1 ON" and it turns Switch 1 off.

Then create two variables - seconds and minutes. So variable 1 is seconds, variable 2 is minutes.

Then you could have a common event that's a parallel process and requires Switch 1 to be on. We'll have it run every 60 frames (since 1 frame is 1/60th of a second). It will increment variable 1 by 1, then if variable 1 is equal to 60, set variable 1 to 0 and increment variable 2 by 1. Once variable 2 is equal to 10, add the item to the player's inventory, then set variable 2 to 0. At the end of it all, put a "wait 60 frames".

Your common event won't run during battle and I think there might be a few other scenes or occasions where it's not running, so your timer won't increment, but that's one way you could do it without any Plugins or script calls.

Thank you! I think this makes sense to me. One issue, however, I think I did something wrong because the item I created is not being added to my inventory 😀

Do you mind looking at my attempt to following your instructions? 🙂 (I changed the minutes from 10 to 1 so I could test it faster, but I wonder now if that might be an issue.)

Common Event
r2jC4rk.png


Event (Page 1)

Wt2UP5L.png


Event (Page 2)
P4YveDb.png


Thank you!!
First line of your common event sets your seconds variable to 0. You want it to add 1. Otherwise, every second, you're setting seconds to 0 and it never increments.
First line of your common event sets your seconds variable to 0. You want it to add 1. Otherwise, every second, you're setting seconds to 0 and it never increments.

Durrr, thank you. It works!! Thanks so much for your help.

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-generate-items-over-time.105190/