Keep Events Running When Player Leaves the Map

Redbank3k

Warper
Member
Joined
Jan 3, 2015
Messages
3
Reaction score
1
First Language
English
Primarily Uses
Hi all,

I'm fairly new to RPG Maker, and I get the generals of it, but some specifics are baffling me. I was wondering if someone could help with a problem I'm up against.

Basically, in the game I'm making, you have a hunger bar that goes down incrementally and goes back up again whenever you eat food. The amount this goes up by depends on the food you eat. The bigger the meal, the more the bar increases.

To that end, you make friends with a gardener who will grow food for you if you bring him the right ingredients. To make sure I don't babble on endlessly, I'll just talk about strawberries. In order for the gardener to grow strawberries, you have to bring him two items: Compost [Item:0058] and Strawberry Runners [Item:0055]. When you give him the compost, it increases a variable [Variable:0005], and likewise with the Strawberry Runners [Variable:0006].

This then calls a common event called "Grow Strawberries", which says when Variable:0005 is equal to or greater than 1, and Variable:0006 is equal to or greater than 1, then reduce each variable by 1, wait 18,000frames (five minutes), then increase Variable:0012 (Strawberry Grown).

There is also a graphic that appears when Variable:0012 is equal to or greater than 1, so the player can then pick up the grown strawberry.

Everything works fine so long as I stay on the garden map, but I don't want the player to have to hang around for five minutes waiting for it to grow, and nor do I want them to get a grown strawberry straight away. The trouble is, if I leave the map, the event stops running and the strawberry never grows, not even if I later return to the map and hang around for five minutes.

Is there a way to keep the count going even if I'm on a different map?

Sorry if this is really obvious and I'm just being thick, and thanks in advance for any help.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,634
Reaction score
5,115
First Language
English
Primarily Uses
RMVXA
As far as I know there's absolutely no way to run events on other maps (although I think there's a workaround script somewhere out there - @Shaz did you release something with growing timers?).

The way I would do this is to have a single Common Event running in your game to control Time. This will run on every map, so that you don't need to worry about being on a certain map to make time pass. Track Time using a single variable, or a set of variables, which is incremented each time your Time Common Event cycles. Time would be 0 at the start of your game and keep increasing forever as the player plays.

Then, whenever you enter each map, have an Autorun event that checks how much time passed since you last picked the strawberry (you might need to store the last time you picked a strawberry in a variable). If at least 5 minutes have passed, set a switch or variable or self-switch to make the "strawberry is ready to be picked" event page active for that plant.
  • Alternatively, instead of this Autorun Event, you could use Tsukihime's "Custom Page Conditions" script, and make the page condition (for the strawberry is ready page) that the Time variable must be at least five minutes greater than the Strawberry Last Picked At variable).

Also, if you're using my approach, I would probably recommend using a smaller amount of time than 18000 frames before incrementing the variable, since the event might start over when you change maps. You could increment it by one, say, every 10 seconds (600 frames), and so you're looking for a change of +30 to the variable (10 seconds * 30 = 5 minutes) in order to indicate that the berry grew.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
I made a whole tutorial to explain how to use events for timed systems such as growing plants, spawning new things in another map, etc.
You can check it in my signature.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,425
Reaction score
7,710
First Language
German
Primarily Uses
RMMV
it is technically impossible to run events on different maps - and to give that possibility would increase the RAM requirement beyond all limits.

however as said above there is absolutely no need for such a function due to other ways to handle things, especially by using common events (which exist outside maps and always run) with variables (especially variables to store time sequences and calculate how much happens while the player is off the map)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV

This will allow the timer to keep running when you go to a different map.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,672
Reaction score
566
First Language
English
Primarily Uses
RMVXA
This will allow the timer to keep running when you go to a different map
We'll just call that an oops. MV plugin for Ace thread.
Unless you have a script that does the same?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Ah, crumbs! I'll blame @Wavelength for pinging me :D

However, the OP didn't actually say they're using Ace, and don't have anything on their profile to say so, and we all know how often people post in Ace support because they can't find MV support, so maybe it's still relevant.

I didn't write such a script for Ace, but I'm sure it wouldn't take much effort to do so, and I am just getting started moving all my scripts and plugins and seeing which ones I can improve, and this one seems like a good candidate.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,634
Reaction score
5,115
First Language
English
Primarily Uses
RMVXA
I'll take the blame for baiting you @Shaz - my memories of seeing that script were very distant, but I felt like I remembered it was yours and I know you've done a lot of good work for both engines. And I had no idea what it was called, so I didn't look it up. ;)
 

Redbank3k

Warper
Member
Joined
Jan 3, 2015
Messages
3
Reaction score
1
First Language
English
Primarily Uses
I made a whole tutorial to explain how to use events for timed systems such as growing plants, spawning new things in another map, etc.
You can check it in my signature.
Thanks so much to everyone, but especially @Heirukichi. That's solved the problem, and given me a bunch of new ideas to try out!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,017
Messages
1,018,356
Members
137,802
Latest member
rencarbali
Top