Hi,
I’m really struggling trying to get my head around how to work with multiple events inside a single event graph.
I am trying to implement functionality such that when the player can see an enemy they don’t move, but when the player can’t see them they move towards the player.
I have managed to get this set up so far, that my player blueprint fires a custom “ISeeYou” event, which each enemy blueprint binds to. That is all working great and each enemy is correctly firing the event when the player sees them. However, as I have implemented my custom event using PawnSensing on the player, an event is only triggered when the player sees the enemies, but NOT when the enemies are no longer visible.
I have created a variable “IsSeenByPlayer” (within the enemy blueprint) that is set to true when the custom “ISeeYou” event is fired, and there is a conditional in between the Tick event and move towards player logic that only allows execution when IsSeenByPlayer is false.
My problem is I cannot for the life of me think of anyway to reset this “IsSeenByPlayer” variable back to false when the “ISeeYou” event is no longer firing. Obviously resetting it back to false after every Tick event is no good as it would overwrite any value already set from the ISeeYou event.
Some kind of timeout is my only valid option so far but I really hate the sound of that and the potential race conditions that could ensue.
Hopefully someone out there can help me!
Thanks