20 hours ago, Alberth said:I would suggest to cleanup the structure, you seem to have too many variables, and you can't say how it works exactly.
Your invisibility has 3 states
- ready for use
- being invisible
- recovering (that is, preparing for next use)
You have one variable that defines in what state it is (ie one of the above 3 values). In the first state, the user can start being invisible, the 2nd and 3rd state have a timer (you can have 1 timer as far as I can see), where the state changes when the timer runs out.
12 hours ago, Zakwayda said:I think the next point of confusion is as follows. Above, you suggest that the 'stop' and 'cooldown' timers run concurrently, but your code suggests they run sequentially. So there seems to be a disconnect there. Maybe a couple questions will help clear things up:
- Once the character becomes visible again (due to the timer expiring), how long do you want to have to wait before the character can become invisible again? One second, or six seconds? (If the timers run concurrently it'd be one second, but if they run sequentially, as they appear to in your code, it'd be six seconds.)
- Assuming your code works so far, how long do you have to wait in practice after the character becomes visible to make it invisible again? Is it relatively short, like one second, or relatively long, like six seconds?
Here is a link to that video, it should be obvious which video it is. I am going to do some more code towards this today hopefully find a solution. I will neaten up the code to so i better understand it myself. I am really unsure how to do this, like if i wanted to become visible from invisible anytime i choose then would that be a "if" statement, or should the code be separate?