Hellu everyone! I’ve been racking my brain out on how to do this and maybe you all can help me!
So, I have an object variable which is “Growth” it grows plants at a certain number in a scene. - I want a GLOBAL variable that counts days and I can link the passing of days. I have no idea how to do this. I fiddled around, I looked up stuff. I know what I want and I know what “needs to be done” but I have no idea how to execute this.
Also, the global variable I did make, counts weird.
The TL;DR - I want a global variable to count days and be able to link scene and object variables to it so it all works together.
I hope I made sense explaining, I’m not very good at that.
Thank you!
Maybe you could try using second object variable VegetablePlantDate and set it to current global variable CurrentDay variable only once when the vegetable is being planted. Then you could create third object variable DaysToMaturity which you could set for each vegetable type manually.
Then you could create an event to calculate your objects variables Growth like this:
object variable Growth = global variable CurrentDay - object variable VegetablePlantDate
Then you could create a check:
if object variable Growth >= object variable DaysToMaturity
then plant has matured
Basically, you need to create more object variables to track more data.
You’ve done it correctly by the looks of things, the only issue is that you aren’t setting the days text in each scene when it starts up or resumes.
Add an event in each scene with a “At the beginning of the scene” condition, and an action that sets the text object “Days_global_text” (as you already do in the bed click event). That will see the number appearing when the scene starts.
However, if you are pausing one scene to start the second and then resuming the first scene from the second, then modify the events you just added so the conditions are “At the beginning of the scene” OR “The scene has just resumed”.
Alright that all makes sense but where do I put those conditions?
This is how I have it now, before adding those in. Do I put all that where “e key press” is, or someplace else?
do you mean the “Growth in 10 days” condition?
that depends on your game logic and how you manage days in your game, but a bulletproof way would be removing any preconditions for “Growth in 10 days” section, so that they will be making checks “all the time”. think of it as a part that only watches how much the plants have grown.
the second task would be setting this object variable Growth value.
you can use the action i wrote above
you can now monitor changes in growth and set growth for every plant automatically.
And do I put “DaysOfMaturity” instead of a number where “Growth of Plants = 2” or do I use both?
If you want to implement this like on your screenshot above, then this object variable is not really needed anymore because your plant has matured(bloomed) when the object growth value = 10.
if you still would like to use this variable, then you could use this like this:
the variable growth of Plants ⩾ Plants.Variable(DaysToMaturity) -> change the animation of Plants set to "bloom"
My advice for you is to take complex mechanics, break them into smaller and simpler task and then implement them one by one. That should help you find what’s need to be done to achieve your main goal.
SO - Its been a couple months and I thought I had it working, which I did kinda with it talking to the other scene for going to sleep and I remember having sprites work, but either I dreamed that or I broke it, either way they do not.
But here is my problem, lets say I plant a seed, and 3 days pass - the sprite has changed once, if I plant another seed, the sprite changes to the others and doesn’t remain the seed sprite. Also once a full growth cycle has happened its just permanently planting full grown seeds.
I feel like its taking the Days = (X) and once the days = the number for the sprite to change in the structure to be the bloomed sprite that’s it. I don’t know any other way to get this to work, I’ve tried for days.
I’ve gotten it to work within the garden, but once it comes to linking that to another scene it doesn’t work. This is the only way I’ve gotten to work between scenes.
Yes, because you’re not taking into account the number of days already elapsed when a new plant is created.
So, say for example you have:
1_sprout = 1 day,
2_seedling = 2 days,
3_bud = 3 days and
4_bloom = 4 days.
Now say the global variable Days is 3. When you create a new plant the first 3 conditions are automatically met by the new plant. So it jumps automatically to bud.
What you should do when you create a new plant is set the plant’s variables to take the global variable Days into account, like: 1_sprout = GlobalVariable(Days) + 1 2_seedling = GlobalVariable(Days) + 2, 3_bud = GlobalVariable(Days) + 3 and 4_bloom = GlobalVariable(Days) + 4
This will factor in whatever day the plant was created.