Posted by: BehemothProgrammer
« on: November 10, 2017, 04:52:09 PM »The agitation value(range 0..299) of an enemy tells you if they are going after the target or not. There's no way to get the value directly but certain AIFlags can indicate it's current value. So you could try to simulate the agitation.
- If the ai sees the target then the agitation value will remain at max value 299. The AIF_SEETARGET = (1 << 9) AIFlag doesn't seem to turn off after the enemy loses sight of the target. Maybe the use of the actors CanSee function would be better instead?
- agitation > 150 means the ai is running after you
- if the AIFlag AIF_RUNNING is on then it's value is somewhere between 150 and 299
- agitation is max if AIF_HEARDLOUDNOISE = (1 << 3) or AIF_HEARDQUIETNOISE = (1 << 16) AIFlags is on
- if AIF_DAMAGEPANIC = (1 << 23) was off but is now on then agitation is 299
- takes about 12 seconds for agitation to go from 299 to 0. And about 6 seconds from 299 to 150. (goes down by intervals of 7)
Can the ai see me? (max agitation value)
- ai target is me
- can see me
Is the ai looking for me?
- target is me
- can't see me
- simulatedAgitation > 0
Is the ai wandering around?
- target is null or can't see target
- simulatedAgitation == 0
- If the ai sees the target then the agitation value will remain at max value 299. The AIF_SEETARGET = (1 << 9) AIFlag doesn't seem to turn off after the enemy loses sight of the target. Maybe the use of the actors CanSee function would be better instead?
- agitation > 150 means the ai is running after you
- if the AIFlag AIF_RUNNING is on then it's value is somewhere between 150 and 299
- agitation is max if AIF_HEARDLOUDNOISE = (1 << 3) or AIF_HEARDQUIETNOISE = (1 << 16) AIFlags is on
- if AIF_DAMAGEPANIC = (1 << 23) was off but is now on then agitation is 299
- takes about 12 seconds for agitation to go from 299 to 0. And about 6 seconds from 299 to 150. (goes down by intervals of 7)
Can the ai see me? (max agitation value)
- ai target is me
- can see me
Is the ai looking for me?
- target is me
- can't see me
- simulatedAgitation > 0
Is the ai wandering around?
- target is null or can't see target
- simulatedAgitation == 0