A_Wander
From ZDoom Wiki
A_Wander
(no parameters)
Makes the actor wander around aimlessly, as used by Strife's peasants. An actor will not play active sounds, attack players, or attack any other target when calling this function, unlike A_Chase. A_Wander does nothing when the actor calling it has the STANDSTILL flag set.
Examples
Here is an example of an Imp that wanders around randomly looking for players.
actor ImpScout : DoomImp
{
States {
Spawn:
TROO AA 3 A_Wander
TROO A 0 A_Look
TROO BB 3 A_Wander
TROO B 0 A_Look
TROO CC 3 A_Wander
TROO C 0 A_Look
TROO DD 3 A_Wander
TROO D 0 A_Look
loop
}
}
A_Look has to repeatedly be called to check for players while it is wandering around. It is also interesting that A_Wander can be in a different way be used. This Cacodemon for example is able to teleport, but its not a real teleport. It just gets invisible and walks around for 0 tics and gets visible again:
actor TeleCaco : Cacodemon
{
States {
See:
HEAD A 0 A_Jump(16,"Tele")
HEAD A 4 A_Chase
loop
Tele:
HEAD A 1 A_SetTranslucent(0.8)
HEAD A 1 A_SetTranslucent(0.6)
HEAD A 1 A_SetTranslucent(0.4)
HEAD A 1 A_SetTranslucent(0.2)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Wander
HEAD A 1 A_SetTranslucent(0.2)
HEAD A 1 A_SetTranslucent(0.4)
HEAD A 1 A_SetTranslucent(0.6)
HEAD A 1 A_SetTranslucent(0.8)
HEAD A 1 A_SetTranslucent(1.0)
Goto See
}
}