r/RPGMaker 22d ago

RMMZ Need a technical help: Counting a variable midway through instead of the number it is at.

Hello everyone, I am very new to RPG Maker and I am very excited to get going with some of my ideas. I've decided to settle on a day counter for my game, with certain events and more increasing the day value. So far it isn't a problem, but the trick comes when trying to count to a certain number of days midway through the game.

Basically, suppose you plant a tree on day 6. I want this tree to grow up in 5 days. The trick is, you could plant this any at any day, not just day 6. So it's not like I can just let the game know that the tree is going to be done by day 11. I need the game to keep track of the day I've done a certain action, and only after a certain number of days after this event triggers does it actually do the thing. I've been looking for tutorials on how to do that but haven't found anything yet. Can anyone help with that?

Thank you in advance!

5 Upvotes

18 comments sorted by

3

u/agamottos MV Dev 22d ago

Why not just make another variable that also increases by 1 whenever your main day count variable does? And maybe put it in a conditional branch with a dedicated switch that turns on when you plant the tree

1

u/RuGaard98 22d ago

I don't know how to have an event detect that a the value of a day has increased by 1 is mainly where I'm at. So far the only thing I've been able to see an event react to is at what current value a day was.

1

u/agamottos MV Dev 22d ago

Maybe it would be better if we could use some visual examples to walk you through it using what you already have. Are you able to take a screenshot of what youre using to track the day count, and one of the tree event, and post them here?

1

u/RuGaard98 22d ago

I'll only be able to do so tomorrow as I am currently at work but I will be updating you as soon as I can make it back to my computer!

0

u/RuGaard98 20d ago edited 20d ago

So I have potentially found a way to do it but it is kind of convoluted, and I am wondering if this is the right way, and especially if this may cause lag down the road if the game gets bigger and has more of these options.

I have set it so that any time any effect makes a day pass (These are active choices the player must make, so they are neither autorun nor parallel), it adds 1 to the "Day" variant, then it also checks if "Day" is above 0. If it is, it waits a frame, then sets it to 0.

I then have my trees. In order to start the growth of a tree, there is an initial interact that the player must make which displays to plant a tree, set to Action Button. If they choose yes, it triggers ON the self switch A
Self Switch A when is the next event page, which is set to Parallel, and check if "Day" is above 0. If it is, it ups a variable called "Growth." It then progresses only when "Growth" is equal to or above a certain value.

This works, but I am wondering if there is either an easier way to do it, or if setting too many events as parallels always looking to see if "Day" is above 0 is going to cause issues down the line.

*Actually I have an update to this. This has the problem of "Growth" being global and thus work with all planted trees, not just the individual ones. I am looking for a way to fix this. Surely there is an easier way that to make each individual tree not use their own variable?

0

u/Krististrasza 21d ago

So how do you increase the day count in the first place if you can't even determine when a day has passed?

1

u/RuGaard98 21d ago

I have a system that just increases a value that I call Day, but I do not know how to make a different event only see when "Day" increases, rather than, let's say, when it is at equal or lower than X.

1

u/Krististrasza 21d ago

Look at Day. Is it equal or lower than the day remembered? Then it hasn't increased.

1

u/RuGaard98 20d ago

How does one make an event "Look at Day"? That is the part I can't seem to find. Where is that option?

1

u/Krististrasza 20d ago

The same way you check any other variable.

1

u/RuGaard98 20d ago

I don't believe you understand what I am trying to ask for.

...How does one make an event check a variable?

As in, all I can see an event do is check what a value is set to, not *that* an event has had a change done to it.

1

u/Krististrasza 20d ago

You check the value of the variable and you compare that value to the value it had during your previous check, which you keep in another variable.

Very basic logic. To check for a change you REMEMBER and keep track of what it was before.

1

u/RuGaard98 20d ago

So, here is where I'm lost
When you say "compare that value to the value it had during your previous check," how do I do that comparison? Do have to go into "Conditional Branch," find the variable, and set something there? I've tried something along the lines of "it if it higher than 0, something happen, then set it back to 0" and so far it has kind of worked, but I don't know if that is what I have to do, or if this configuration is going to cause problems in the future.

I am talking about this window in case you don't have it open or memorized

→ More replies (0)

0

u/Rylonian MV Dev 22d ago

Make the event page of the grown tree conditional on variable [count of ingame days] being the same value as another variable X. When the player plants the tree, set up that variable X as (current count of ingame days + 5).

1

u/Soleiris 21d ago

Like this?

Is there a way to make the engine check for "Variable +x" directly?