How can I pause the execution of my code until the player does a specific action

So I’m making a turn-based RPG that uses a system like this to calculate who goes next.

When determining who goes next, each creature’s (player or enemy) speed is continuously added to another stat. Let’s call it “activeTurn.” Whichever creature’s activeTurn reaches 100 first gets to act first, with ties being broken by array order.

After the creature’s turn ends, their activeTurn resets to 0 and the cycle repeats.

Now I don’t wanna go into too much detail but once that activeTurn reaches 100 I want the game to stop calculating the other activeTurn Variables until the player either Attacks, uses a Skill, Defends etc… (which will be done through clicking buttons.)

Any help as to how to setup this would be greatly appreciated!

Well, first, you don’t want to stop ALL your game’s code, you just want to stop your actiontime script.

So, keep a float/int variable for each timer, and put them into an array. Create a second boolean variable called waiting. Each tick(while your AT script is active) use a loop with break to check the boolean, update each timer variable, then check if it is at 100. If so, break out of the loop. You might also put a check just before entering the loop that prevents it from entering if the wait variable is true. In then, create a function/action that takes your players input. On input confirmed, toggle waiting to false, which should allow your timer to resume.

Thanks, still need to wrap my head around your whole answer and how I’ll tweak it to the way I designed my stuff, but it’ll definitely work if I do it this way.

Cheers!

I found a slightly simpler way to do it for what I was doing. I was trying to make it so when i have an item equipped it would start the grappling code, so I just made a variable that is set to true after the pick up code, and then attached the mouse input and the get variable to a branch before the code runs, so that the variable condition has to be set to true before it actually starts grappling. Nice job though, your code works in many other situations!