Research:NPC AI Behaviour
Jump to navigation
Jump to search
Combat Behaviour
NPC Awareness Check
Actions affected | NPC AI |
Description | |
Implementation status | |
Analysis status | Verified |
This check runs every 5 seconds for each NPC. It occurs whether you are sneaking or not, but isn't the same as the combat distance check.
Player side
if sneaking:
sneakTerm = fSneakSkillMult * sneak + 0.2 * agility + 0.1 * luck + bootWeight * fSneakBootMult
else:
sneakTerm = 0
fatigueTerm = fFatigueBase - fFatigueMult*(1 - normalisedFatigue)
where normalisedFatigue is a function of fatigue. empty fatigue bar -> 0.0, full fatigue bar -> 1.0
distTerm = fSneakDistanceBase + fSneakDistanceMultiplier*dist
x = sneakTerm * distTerm * fatigueTerm + chameleon (+ 100 if invisible)
NPC side
npcTerm = npcSneak + 0.2 * npcAgility + 0.1 * npcLuck - npcBlind
npcFatigueTerm = fFatigueBase - fFatigueMult * (1 - normalisedFatigue)
using NPC normalisedFatigue
if PC is behind NPC (180 degrees):
y = npcTerm * npcFatigueTerm * fSneakNoViewMult
else:
y = npcTerm * npcFatigueTerm * fSneakViewMult
Final check
target = x - y
roll 100, win if roll < target
Comments
Appears straightforward and bug-free. NPCs can take up to five seconds to notice you even if you are not sneaking. This function precedes the combat distance check. I have not identified if there is a line of sight check occuring before or after.
AI Tendencies
Fight
Affected by calm and frenzy spells.
Flee
Affected by rally and demoralize spells.