Is there a way to calculate time passed since event was last trigggered? EnemyAI

I am creating an enemy BP and i have made the two states, one where he is roaming and one where he has seen the player and is chasing them.

my issue is finding the best way to switch the isSeeingPlayer boolean value to false after the enemies PawnSensing hasnt been triggered for 1 second so that the enemy returns back to roaming state.

is there a way to measure the time since the OnSeePawn Event was triggered and reset it each time it is triggered so the time could be used as a condition on the branch before setting the IsSeeingPlayer vlaue?

…or am i going the wrong way about this?

Thanks in advance peeps!

Hi just use GetTimeSeconds node…
So when OnSeePawn event get triggered, call the node and store it in variable. Now when it is retriggered, you can now find the time difference by substracting again, GetTimeSeconds against the variable…

1 Like

Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.