Skip to content

Threat assessment

inkoalawetrust edited this page Aug 30, 2023 · 4 revisions

NPCs based on the KAI library have access to a threat level assessment system. Which allows them to determine how dangerous another actor is, so that they can inform their behavior around it. Actors can give themselves preset threat levels, but if they don't. Then the NPC checking them will try to figure out on its' own how dangerous the other actor is based on factors like how much health it has, if it can fly, if it moves fast, can reflect projectiles, etcetera.

A list of all available threat levels can be found here.

How it works

The threat level system is handled by the AssessThreatLevel() virtual function, which returns a threat level ranging from THREAT_NONE to THREAT_UNSTOPPABLE.

Moreover, KAI NPCs have a ThreatLevel property which can assign them a preset threat level. Actors not based on KAI_Actor can also have threat levels pre-assigned to them by using the KAI_DataToken item, and setting its' ThreatLevel variable to the threat level you want the non-KAI NPC to have. Threat levels can also be dynamically changed by the actor, such as when it does certain attacks.

In addition, KAI NPCs have a ThreatLevelThreshold property, which can be used to specify a particular threshold, above which the NPCs does a certain action, such as changing up its' attacks, or beginning to run away.

See also

Clone this wiki locally