how to make the wait event work without freezing the game

hello...


im making a farming game like harvest moon [if you ever played it before you probably get the idea]


ok so i made this event where the player grows a seed called carrot seeds


[or seed]  i added a wait event so the seed would grow after that limit


but once the seed started growing which started the wait the game froze i couldnt move...


is there a way to make a timer where the game can still run where the player  can leave


there is an event called control timer


but i don't know how to use it
The Wait command isn't really used for that sort of stuff - it specifically stops all player processing for the specified time.  And Control Timer only lets you have one timer, and the countdown displays on the screen.


I used to have an Extended Game Timers script that let you set timers on many events for similar purposes, but the thread it was in lost its first page a couple of years ago, and I didn't have it anywhere else (just checked Wayback Machine and it only has the cut off version as well).  I think there were a few other scripts that did similar things - check the master script list.
You can have a parallel process counting down on variables and waiting a bit between each subtraction.


For a harvest moon type game that does sound really tedious, so I would recommend going with a scripting solution instead.
the wait command alone can never freeze your game - this can only happen if you use the wait with the wrong logic structure, for example inside a loop or inside an autorun.


So if the advice above is not enough to get you sorted out, please post a screenshot of the event where you used the wait and we can help you repair its logic.
I don't think it's a case of the game actually freezing (despite what was said).  I think it's more along the lines of expecting the Wait command to let the player do other stuff while the waiting is happening, which isn't going to happen.
the wait command alone can never freeze your game - this can only happen if you use the wait with the wrong logic structure, for example inside a loop or inside an autorun.


So if the advice above is not enough to get you sorted out, please post a screenshot of the event where you used the wait and we can help you repair its logic.

no i didn't mean completely freeze like the whole game, i mean the player can't move,


and yeah i did have it on auto run but i took it off
You can have a parallel process counting down on variables and waiting a bit between each subtraction.


For a harvest moon type game that does sound really tedious, so I would recommend going with a scripting solution instead.

thats kind of impossible for me on a count of i have no rpgvxAce scripting knowledge and theres no way to learn it
thats kind of impossible for me on a count of i have no rpgvxAce scripting knowledge and theres no way to learn it



Not to be rude but in this forum there are plenty of tutorials, script calls, completed scripts and many other things to learn how to use Ruby and RGSS3 (VX Ace uses that).


However "scripting solution" doesn't mean YOU have to write it. If I am not wron there are scripts that do what you want to achieve, I don't remember their names but I am quite sure about their existence.


Now, one of the main reason why people don't want to use other people scripts is because they want to learn how to do it on their own (which from your previous post seems quite unrelated to your case), then there is the "money problem". There are scripts that are not free to use and so people don't want to use them because either they don't want to pay or they don't hav enough money...but there are also free scripts, and very good ones. Another option is that they don't know HOW to use a script. In that case there are tutorials for that (look in Andar's sinature and you'll find one).


So I honestly think that the assumption of being unable to use a script and unable to learn it sounds a bit false. As I said, I don't want to be rude, I am just telling that this forum offers you the tools you need for both create your games AND improving your game making abilities.


That said you can still achieve what you need on your own by eventing but, as Zeriab said it would be quite tedious if your game is ENTIRELY based on that. You can do it if you have a limited number of planting spot. This way you can check them using a parallel process, variables and switches. Here is a way to do it.


A LITTLE TUTORIAL ON HOW TO DO THAT


Set up your event

Spoiler
Let's say you have 5 (for example) different spots where you can plant something. I will assign 2 different variables and a switch to each spot as follows:

  1. variable 1 and 2, switch 1
  2. variable 3 and 4, switch 2
  3. variable 5 and 6, switch 3
  4. variable 7 and 8, switch 4
  5. variable 9 and 10, switch 5

Now that we assigned these variables and switches to our planting spot it's time to decide how we're going to use them.


First of all I want to store the seed type I plant in one of those variables (in my example I will store it in the odd variable). The other variable will be used as a counter. The switch will tell us if there is a seed in that spot or not.


Now let's create your planting spot event. It needs at least 2 pages. The first page will be the one before your plant grows, the second one is for your full grown plant. While the first one has no condition, the second one needs a condition. Set it to be the variable you used as a counter for that spot and set it to be more than the number of seconds you want to wait before the plant grows.


So far you event window should look like this (it is only the 2nd page since the 1st one is still blank):



Spoiler



finestra.png



Now it's time to put something in your event. Let's start with the first page. Since we don't want the player to continue planting seeds in the same spot until he wastes every single seed in his inventory let's say we will turn the assigned switch on when he plants the first seed. This way, if we only ask to plant the seed when the switch is off it will only ask it once.


First of all insert a conditional branch and check if the switch assigned to that planting spot is OFF. If it is then ask the player which seed he wants to plant and store it in the even variable assigned to that spot (in my example I will use the 1st spot so my variables will be 1 and 2, 2 for the seed type and 1 for the counter). Now, turning the switch on after asking that is incorrect. The player might have cancelled his choice so let's add a check for the seed variable, if it is greater than 0 it means the player selected a seed. After checking it add a control switch command to turn your switch (in my example switch 1) ON.


If you did it correctly your window should look like this: 

Spoiler
finestra_1.png



Time to set up your second event page.


Since the second event page triggers when the pland is full grown we want an event to harvest that plant and to reset everything related to this planting spot. Let's start with this. Insert two different Control Variable commands, one to set the even variable, one for the odd varilable, and set them to 0 then use a Control Switch command to turn the related switch OFF.


After that add the item to player's inventory (or just more seeds, that depends on what you want to do with your plant). In my example I decided to add a message too. Now, when you harvest your plant, the event should go back to its previous appearence (page 1).


If you did it well your second page should look like this:

Spoiler
finestra_2.png


IMPORTANT NOTE: in my event I only used one kind of plant. If you have more than one you should add a conditional branch to check the even variable related to that planting spot and add a plant (or seeds) depending on the previously planted seed.



And here is the message I used:

Spoiler
test_message.png






Set up your Parallel Process

Spoiler
Your event is now completed. What's let is to create a parallel process to handle it. What this event has to do is to check which switch is ON and increase the related counter variable. To do it quick I will use a script call. If you don't want to use a script call you can go and create it using events, since the number of planting spots is limited you can do it but I have to warn you: it will be VERY annoying.



The script call I am going to use in my parallel process event is this one:



Spoiler








for i in 1..5
if $game_switches
$game_variables[(2 * i - 1)] += 1
end
end


IMPORTANT NOTE: in my 1st line i used 1..5 because i decided to use only 5 planting spots in my example! If you have more you have to change that 5 into the maximum number of planting spots you have.





However this event updates my counter variable every frame and I don't want it to act like that, I want it to update my variable every second. So, to slow it, let's add a Wait command and tell our event to wait 60 frames.


If your parallel process looks like this then you did fine:

Spoiler
parallel_process.png









Now if you followed my steps everything should work.


One more thing

Spoiler
The only annoying thing is that parallel pocess in your common events. A parallel process always running is not very nice. However, using a script call is possible to check frame count (or played time). With this option is possible to store the played time when you planted the seed in the related variable and subtract that variable from played time in your parallel process. If the result is greater than the time your plant needs to grow you either turn a self switch on to switch to your event second page or use another switch (in which case you will end up having 2 switches and 2 variables assigned to each planting spot). This way you can have your parallel process run ONLY in the maps with at least one planting spot.


This will improve your game performances but is a little more complex.





I hope this was helpful. 🙂
@Heirukichi don't bother - the OP just got banned


Closing this

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-the-wait-event-work-without-freezing-the-game.71350/