AI Hearing firing multiple times + Sight issues


Like in Splinter Cell, I want to be able to entice the AI by making a lure-sound. But when making this sound multiple times in a short time period the AI should be alerted. I guess to achieve this I need to count how many times the player does this sound, but this is not possible, since the AI perception runs multiplie times through the “On target perception updated”-function immediately. So when I press the lure-sound-button only once, this happens:

The right bottom part shows the lure-part.

Not sure if I should open an extra thread for the other issue I’m having. But when the AI is chasing the player it get stuck around the corner toggling the sight-perception billions of times within a second. I coded the AI to look from this eyes to see the player’s head with C++. I really hope that it has nothing to do with that…