Ok i need some more help how would i do this: Change camera if a character is in a specific animation in 10 secs but if the character is not in animation don’t do the countdown. I can explain again If my character is in a specific animation set a countdown for 10 seconds if his animation doesn’t change and the countdown fully ticks down change camera but if the character animation changes cancel the countdown. So i was trying to figure this out yeah everything goes as planned now apart from one major issue. Screenshot - b7db2a018ec4333e2c3c939533a8e6b7 - Gyazo This is my blueprint and as i said everything goes good apart from that if i enable my IsStand Variable it will do this: It doesn’t detect if the character is sitting or not for example: if i make my character sit again after standing the delay is still ticking and then changes camera when character is in sitting form. But if i disable it he won’t attack me at all. STAND: Attacking form SIT: Peaceful form.
You have to either put another bool check after the retriggerable delay to stop it from executing when it’s done counting, or use timers instead of delays – you can Clear and Invalidate (stop) timers, so that they wouldn’t tick.
I have already tried using timers and that didn’t work very well for me so i just chose to do delays. But two questions 1: Where do i put the new bool? 2: Do i put the bool as true or false?
Could you explain a bit more? Screenshot - 981e2249e5b283e6831e6574c25566c9 - Gyazo
Another explanation: I have a sit and a stand anim and after 20 - 40 second it switches anim if character is in stand anim start a 10 second countdown if it ticks down switch camera. But if the animation switches again start everything from the beginning again / just do the same thing again. And if i make him switch animation from stand to sit again i want the countdown to get cancelled and then do the sit to stand transition again and then play of the countdown. But i don’t want the countdown to play if the character is in sit anim the second the character gets into his sit anim stop the countdown.
Put branches after the delays. Everything else you have to decide yourself based on your setup. Like if you have started a delay that is about to trigger one action, but then you start doing something else and you don’t want that delayed action to be performed, you have to disable everything after the delay somehow. Like setting a bool at some point and checking it after the delay. True or false – that depends on how you want to do it. It’s all just basic logic, and it’s something you create, so it’s all up to you.
Your branch must check some bool variable. Otherwise it’s useless, it will always give you the same result.
I’ll give you an example, but you have to interpolate it to your case.
- You lie down. You want to go to sleep if you lie down for 10 seconds. You set a 10-second delay.
- After 5 seconds of lying, you stand up. Obviously you won’t go to sleep anymore. But the delay is still counting, it doesn’t care for anything, it will execute when the countdown is over no matter what.
- So you add another bool variable, let’s say its name is “Is Lying Down”. When you lie down, you set this bool to True, but when you stand up, you set it to False. When the delay is over, it checks this bool, and if it’s True, you can go to sleep. If it’s False, you cannot go to sleep.
Screenshot - db1cb774b2bd28074ad765423c3b9115 - Gyazo So like this?
You CANNOT stop a delay. Once it’s set, it will inevitably count to the end and execute. If you use a Retriggerable Delay, you can reset it, but still, it WILL execute once done counting. That’s exactly why you need the Branch after the delay – to stop everything else after the Delay from being executed.
If you really want to literally stop the countdown, you have to use timers. Just find tutorials on Youtube, there are tons of them. Like this one WTF Is? Set Timer in Unreal Engine 4 ( UE4 ) - YouTube