A_TurretLook

From ZDoom Wiki
Jump to navigation Jump to search

A_TurretLook

(no parameters)


Note: This function has been superseded by A_LookEx, which duplicates and extends its functionality. Use of the newer function is advised in order to maintain maximum flexibility in your code.


Looks for players or other attackable actors in the game. This function is similar to A_Look but it only reacts to sound. Just seeing the player will not wake up a monster using this. This function must be used in the idle states of a monster.

The major difference between A_Look2 and A_TurretLook is that A_TurretLook does not do any random state jumps.

Examples

This is a blind imp, you can walk right in front of it and it will not see you, though shooting will awaken it, since its spawn state uses A_TurretLook, making it react to sound. Since it is blind, it never directly aims at you unless you trigger its melee state.

ACTOR BlindImp : DoomImp
{ 
  States
  {
  Spawn:
    TROO AB 10 A_TurretLook
    Loop
  See:
    TROO AABB 3 A_Chase
    TROO CCDD 3 A_Wander
    Loop
  Melee:
    TROO EF 8 A_FaceTarget
    TROO G 6 A_CustomComboAttack("DoomImpBall", 32, 3 * random(1, 8), "imp/melee")
    Goto See
  Missile:
    TROO EF 8
    TROO G 6 A_CustomMissile("DoomImpBall", 20, 0, 0, 2)
    Goto See
  }
}