A_AlertMonsters

From ZDoom Wiki
Jump to: navigation, search

A_AlertMonsters [(float maxrange)]
A_AlertMonsters [(float maxrange [, int flags)]] (development version 8e8f6cf only)

Usage

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.

Parameters

  • 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: (development version 8e8f6cf only)
    • 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 targetted, 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.

Examples

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

Death:
  ZAP1 A 3 A_AlertMonsters
  ZAP1 BCDEFE 3
  ZAP1 DCB 2
  ZAP1 A 1
  Stop