👀Vision system
Introduction
The vision system is a core part of NACT. Determining wich enemy the NPC is able to currently focus. The vision system offers two modes.
Auto vision
"Auto Vision" is the default mode of NACT, it is tailored for human-like NPCs that relies on vision to focus an entity. Auto Vision will automatically switch the focused entity depending if it is currently visible or not.

To summarize, this lets you use GetFocused, GetFocusedLocation, TurnToFocused, IsFocusedVisible etc without handling yourself the logic to know if the focused enemy is in sight or not.
This is configured at the NPC level, and enabled by default:
NACT.RegisterNpc(character, "territory", {
autoVison = true
})
However, when loosing a target you still need to call LookForFocused in your behavior. Typically for soldiers, the NACT_Seek or NACT_Detection behavior.
Manual vision
"Manual Vision" is more suited for "flesh" NPCs (animals, zombies). Thoose NPCs might not rely on vision at all, and rather rely on distance or a simpler vision system. For example, the zombies still rely on the NACT_Detection behavior to acquire a target (aka "Waking Up") but will never stop chasing and attempting to melee the enemy. In that case, using the auto vision system past the detection phase is completly useless and is not wanted since we don't wish the NPC to loose our focus.

While in manual vision mode, you are however responsible to call StopTracing or StartTracing if you need the vision system at one point.
Last updated