GetCurrentAIPackage

From the CreationKit Wiki
Jump to navigation Jump to search

Identifies an actor's current AI package, and returns a number representing that package's type.

Syntax:

[ActorID.]GetCurrentAIPackage

The actor's run-once package is checked first. These are the temporary packages the engine gives an actor to react to something, such as watching a fight or fleeing. If there is none, the actor's current package is used.

The number returned is not the package type number. The engine converts the type with a fixed table, shown below. The values were read from SkyrimSE.exe and checked in game. There is some overlap between package types and procedure types, given that procedures have only recently been made configurable; some package types exist just to execute a basic procedure.

Return values
Number Type Package type number
-1 Find2, Package, Package Template, and any type above 31 17, 18, 19, 32+
0 Find. Also returned for a reference that is not an actor, or an actor with no AI process or no package. 0
1 Follow 1
2 Escort 2
3 Eat 3
4 Sleep 4
6 In-Game Dialogue 28
7 Activate 20
8 Alarm 21
9 Spectator 24
10 Flee 22
11 Trespass 23
12 React to Dead 25
13 Wander 5
14 Travel 6
15 Accompany 7
16 Use Item At 8
17 Ambush 9
18 Flee (not combat) 10
19 UseMagic 11
21 Get Up From Chair 26
24 Do Nothing 27
28 Surface 29
29 Search for Attacker 30
32 Avoid Player 31
33 UseWeapon 16
34 Dialogue 15
35 Guard 14
36 Sandbox 12
37 Patrol 13

Notes[edit | edit source]

  • Packages made in the Creation Kit are all Package (18) or Package Template (19) types, so on most NPCs this function returns -1.
  • 0 does not always mean Find. It is also returned for a reference that is not an actor, an actor with no AI process, and an actor with no package.
  • To check for package types 37 and 38, use GetVampireFeed and GetCannibal, respectively.
  • Checked against SkyrimSE.exe 1.7.104.0 (Anniversary Edition) by disassembly and in game. Other versions, including Legendary Edition, have not been checked.
  • See also GetCurrentAIProcedure.