From ZDoom Wiki
Jump to navigation Jump to search

A_AlertMonsters [(float maxrange [, int flags])]


This can be used on weapons, projectiles and monsters:

  • For monsters it alerts all monsters in hearing range of the current monster's target.
  • For projectiles it alerts all monsters in hearing range of the projectile's shooter.
  • For weapons it alerts all monsters in hearing range of the player holding the weapon.

This function does nothing on monsters which already have a target.


  • maxrange: The maximum distance from the calling actor at which monsters can still be alerted. Note that this is a simple distance check to the alerter. The "sound" still travels the normal distance. Default is 0 (unlimited range)
  • flags: The following flags can be combined by using the | character between the constant names:
    • AMF_TARGETEMITTER — Causes alerted monsters to chase the actor which emitted the alert. Note that the alerter must be alive and has the SHOOTABLE flag to be chased (this is standard ZDoom behavior, not a fault of the feature).
    • AMF_TARGETNONPLAYER — Allows a monster to alert others to its own target when that target is not a player. Note that AMF_TARGETEMITTER implies that non-players can be targeted, so there is no need to use both at once.
    • AMF_EMITFROMTARGET — Causes the alert to be emitted from the actor that is being warned about, instead of the calling actor. Note that this is inherently pointless when using AMF_TARGETEMITTER.

Note: The maxrange will be foiled if compat_soundtarget is true, since it makes monsters rely purely on whether sound was heard in the sector in which they are, rather than what the monster itself heard.


The StrifeZap1 actor class uses this function to wake up enemies when the projectile explodes.

  ZAP1 A 3 A_AlertMonsters
  ZAP1 DCB 2
  ZAP1 A 1