saints row iv · ai

Saints Row IV AI Explained

How enemies and allies decide what to do: 20 goals checked in priority order, 112 actions tried until one succeeds.

AI137 rows

NPC brain: a priority list of goals, each with an ordered list of actions. The NPC keeps trying until one action succeeds. Names are Volition's own (from tables inside the exe).

#NameMeaning / categoryCode
How it decides (runs for every AI character, every update)
1If a mission script has forced an action (e.g. 'shoot at X'), do that and stop.human+0x500 flags, command at human+0x560
2Otherwise go through the 20 goals below from top to bottom. A goal only counts if this NPC's behaviour profile allows it AND the goal's check function says it applies right now.profile = *(human+0x328), from ai_behavior.xtbl
3For the first goal that applies, try its actions in order (the order comes from ai_goals.xtbl). Skip actions this NPC can't do, that are disabled for it, or that are cooling down.
4The first action whose function returns 'success' is what the NPC does. If nothing works, fall through to the next goal.current goal = human+0x4F8, action = human+0x4F9
5If no goal produces an action, run the vehicle-passenger fallback.ai_action_vehicle_passenger 00564a00
The 20 goals, highest priority first
Goal 0change modeSwitch the NPC's AI mode when its situation changes.check: 00530090
Goal 1assault botSpecial logic for assault robots.check: 005300a0
Goal 2dodge attackGet out of the way of an incoming attack.check: 00531220
Goal 3avoid bruteStay away from a Brute.check: 00533210
Goal 4kill near playerAttack enemies close to the player (followers).check: 00531b90
Goal 5surviveStay alive when badly hurt.check: 005311c0
Goal 6retreatFall back.check: 00531c90
Goal 7groupRegroup with allies.check: 005312d0
Goal 8suppressPin the target down with fire.check: 00531330
Goal 9coverUse cover.check: 00531380
Goal 10taking_damageReact to being hit.check: 00531da0
Goal 11advancePush forward on the target.check: 005333f0
Goal 12reloadReload the weapon.check: 00530100
Goal 13mercyStop attacking a downed or surrendering target.check: 005300b0
Goal 14kill enemyAttack the current target.check: 005315c0
Goal 15flush outForce a hiding target out.check: 00531e40
Goal 16frustratedChange tactics after failing for a while.check: 00531530
Goal 17acquire targetFind something to fight.check: 00531f70
Goal 18investigateCheck out a noise or disturbance.check: 00531630
Goal 19idleNothing to do - stand, wander, ambient behaviour.check: 00532100
The 112 actions an NPC can perform
Action 0fireshooting00591040
Action 1fire sweepshooting005916e0
Action 2fire suppressshooting00591370
Action 3fire chaosshooting00590c20
Action 4fire leftshooting00590c90
Action 5throw grenadegrenade0059dec0
Action 6throw weaponthrow005a49a0
Action 7meleemelee005a2cc0
Action 8melee vehiclemelee005a3760
Action 9cover take defcover0058fcd0
Action 10cover take offcover0058fed0
Action 11cover advancecover0058ff40
Action 12cover stay downcover00590520
Action 13cover firecover0058da70
Action 14cover popoutcover0058dc80
Action 15hold positionmovement005806e0
Action 16melee stand backmovement00588620
Action 17move retreatmovement00588a40
Action 18move regroupmovement00581470
Action 19move advancemovement00583cd0
Action 20move advance lofmovement00583bf0
Action 21move chasemovement00584020
Action 22avatar chasemovement005846e0
Action 23move surroundmovement00587df0
Action 24move surround lofmovement00587cd0
Action 25move rushmovement005832d0
Action 26move rush to meleemovement005892e0
Action 27move scriptedmovementscript-only
Action 28move to navmeshmovement00580ae0
Action 29move sidestepmovement0058a3e0
Action 30move dodgemovement00585b50
Action 31move lungemovement00586090
Action 32move to post combatmovement00584970
Action 33move to post idlemovement00584a30
Action 34move close inmovement0058b1f0
Action 35move to battlefrontmovement00581d20
Action 36follow make wayfollowing00595240
Action 37follow avoid LOFfollowing00593cb0
Action 38follow formationfollowing00596b70
Action 39follow acquirefollowing00596cb0
Action 40follow playerfollowing00597290
Action 41follow teleportfollowing00597360
Action 42follow lemmingfollowing005974d0
Action 43follow to carfollowing00597d00
Action 44follow other carfollowing005984a0
Action 45follow carjackvehicle00598720
Action 46follow browsefollowing00594160
Action 47investigate moveinvestigate005a0ff0
Action 48investigate lookinvestigate005a1330
Action 49investigate peekinvestigate005a1ae0
Action 50reloadreload005a38f0
Action 51pickup weaponpickup00507d50
Action 52human shield grabhuman shield00553e70
Action 53taunttaunt005a44a0
Action 54vehicle passengervehicle00564a00
Action 55vehicle enter scptvehiclescript-only
Action 56vehicle extractvehicle00564170
Action 57brute throw propbrute / boss0056d590
Action 58brute car flipbrute / boss0056e160
Action 59brute bull rushbrute / boss0056f5c0
Action 60brute qte playerbrute / boss0056dcc0
Action 61brute attack brutebrute / boss0056ce00
Action 62brute gun finisherbrute / boss00571fc0
Action 63avatar shockwavebrute / boss0056cf90
Action 64avatar stompbrute / boss0056c1f0
Action 65avatar taunttaunt0056c190
Action 66avatar fireballsbrute / boss0056d070
Action 67avatar teleport stompbrute / boss0056d150
Action 68avatar bullrushbrute / boss0056c1c0
Action 69quick killspecial melee00575050
Action 70sprint attackspecial melee005744a0
Action 71zombie eatzombie0057ffc0
Action 72zombie explodezombie0057fa50
Action 73killbane chasemovement00582120
Action 74killbane strafemovement005821d0
Action 75super jump attacksuper powers00520340
Action 76super jump on carsuper powers00520440
Action 77super jump advancesuper powers00522530
Action 78super jump surroundsuper powers00522740
Action 79super jump followsuper powers00522170
Action 80super scripted movesuper powersscript-only
Action 81super tele throwsuper powers0051c720
Action 82super tele catchsuper powers0051c2b0
Action 83super energy blastsuper powers00522e50
Action 84super ground poundsuper powers00518ff0
Action 85super teleportsuper powers00519540
Action 86super attacksuper powers00516c80
Action 87super combosuper powers00516cd0
Action 88super conversionsuper powers005189b0
Action 89roller blader changespecial00577240
Action 90idleidle00554f10
Action 91giant laser eyesboss laser0050db80
Action 92assault bot attackassault bot0050a380
Action 93assault bot crawlassault bot0050a3a0
Action 94assault bot transassault bot0050a3c0
Action 95maraudermarauder00526ce0
Action 96ambush modeambushscript-only
Action 97revive beamrevive0050d6f0
Action 98golden cid fleeflee005112e0
Action 99cid loiterloiter00511240
Action 100civilian fleeflee004e3240
Action 101hover move to firehover craft004eba90
Action 102hover shield allyhover craft004ecc40
Action 103hover move to allyhover craft004ecc40
Action 104hover fleehover craft004ebe40
Action 105hover firehover craft004eb790
Action 106hover bludgerhover craft004ebd80
Action 107hover move scriptedhover craftscript-only
Action 108hover stop scriptedhover craftscript-only
Action 109hover orbithover craftscript-only
Action 110hover suicidhover craftscript-only
Action 111hover formationhover craftscript-only

Built from SR4_Game_Explained.xlsx (650 KB), if you'd rather filter it in Excel. SaintsRowIV.exe v1.0.6.1 (Steam). Names are ours unless they're Volition's own Lua or C++ class names.