Hi all, this has been asked before but after reading a few of the posts
(https://www.construct.net/en/forum/construct-2/how-do-i-18/wait-and-timescale-issues-57207 for example), I still can't get to a solution...
Basically, I have enemies that patrol. They get to the end of their patrol route, then pause, then go back to the start, then pause, etc. etc.
The problem is, I have game menus which stop all moving objects, including enemies. Their timescales get set to 0. But because the enemies are running functions with waits (eg. "Wait 0.5 seconds"), they continue to perform actions in the background, and when I return to the game from a menu, their behaviours are totally wacked. Note; I am not turning the general Time Scale to 0, because a lot of other things need to keep running. This would make things easier, but I would need to rewrite a LOT of code.
Here's the code in question:
So, what I need is a way to wait in the function - whether or not the object's time scale is 0, then continue the function when the game is unpaused or whatnot. I read about using a variable and subtracting based on dt, but the solution didn't seem like it worked. I tried signalling based on whether menus were open, but I couldn't get the function to recognise it. I also tried creating a variable which gets added to while the menus are closed, but not when open, so I could reference that within the function, but I am ... not a super mathy guy, and I'm having trouble with this.
Any help would be muchly appreciated. :)
EDIT: I forgot to highlight the third wait in that image (this wait is based on an enemy instance variable).