Morrowind Mod:AIWander

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search


AIWander

                AIWander, Range, Duration, Time, [Idle2], [Idle3], ...[Idle10], [Reset]

        Where   Range           = The range, in game units, that the NPC will wander in from its 
                                  current location.
                Duration        = Time (in hours?) that the NPC will wander (0 indicates infinite)
                Time            = Possibly the start time for the wandering to occur (0 may indicate
                                  no start time).
                [Idle2]...      = Optional parameters, that give the chance of the NPC to perform the
                                  following idle movements:
                                        Idle1:  Not used?
                                        Idle2:  Looking around
                                        Idle3:  Looking behind
                                        Idle4:  Scratching head
                                        Idle5:  Shifting clothing or armor on shoulder
                                        Idle6:  Rubbing hands together and showing wares
                                        Idle7:  Looking at fingers and looking around furtively
                                        Idle8:  Deep thought
                                        Idle9:  Reaching for weapon
                [Reset]         = Optional parameter, unknown, may indicate whether the current 
                                  AI package is interrupted.

        Type:   AI

     Returns:   none

     Example:   AIWander, 0, 0, 0       (forces NPC to stand in one spot)
                "urzul gra-agum"->AIWander, 128, 0, 0, 60, 30, 10, 0, 0, 0, 0, 0, 0

     Scripts:   attack_Slave
                dinScript

Sets the given NPC to wander randomly in the current area using any AI grid points and performing various random idle movements. This function is commonly used to stop NPCs from following or performing a previously assigned action.

The Range appears to be relative to the point where the NPC last entered the AIWander state. If the NPC is set to AIWander, 100, 0, 0 and then moved more than 100 units away with the Position function, he/she will return to the region where the original call was made. Just issuing a new AIWander command after the Position will not stop this behavior: the AIWander package must complete or a separate package be run in order to reset the center of the range.

There are two known bugs with this function. The Idle2 parameter is not output in the compiled script (verified with Tribunal). The Reset parameter also maybe output incorrectly and should not be used.

See Also: GetAIPackageDone, GetCurrentAIPackage

Notes[edit]

As mentioned above the compiled output of the AIWander is strange in that it omits the first idle parameter and the reset parameter is output differently than the other AI functions. Sample SCDT output from the CS is shown in the below table:

Function Call Compiled Output
AIWander, 10, 20, 30 F910 00002041 0000A041 0000F041 0000 00
AIWander, 10, 20, 30, reset F910 00002041 0000A041 0000F041 0000 05
AIWander, 10, 20, 30, 2 F910 00002041 0000A041 0000F041 0000 01
AIWander, 10, 20, 30, 2, reset F910 00002041 0000A041 0000F041 0100 0000 01
AIWander, 10, 20, 30, 2, 3 F910 00002041 0000A041 0000F041 0100 0300 01
AIWander, 10, 20, 30, 2, 3, reset F910 00002041 0000A041 0000F041 0200 0300 0000 01
AIWander, 10, 20, 30, 2, 3, 4, 5, 6, 7, 8, 9 F910 00002041 0000A041 0000F041 0700 0300 0400 0500 0600 0700 0800 0900 01
AIWander, 10, 20, 30, 2, 3, 4, 5, 6, 7, 8, 9, 10 F910 00002041 0000A041 0000F041 0800 0300 0400 0500 0600 0700 0800 0900 0A00 01
AIWander, 10, 20, 30, 2, 3, 4, 5, 6, 7, 8, 9, 10, reset F910 00002041 0000A041 0000F041 0900 0300 0400 0500 0600 0700 0800 0900 0A00 0000 01

The value of the reset parameter varies between 00, 01, and 05 and depends on the previous calls to AIWander in the current script. It seems like the first occurrence of reset in a script has the value of 05. Subsequent uses of reset in the same script adds an extra short value of 0000 to the parameter list along with a reset value of 1. It is currently unsure whether this is the function's intended behavior. I don't believe the reset parameter is used at all with AIWander in any official script.

In a script where reset is not used, all reset output values are 01.