A_AlertMonsters
From ZDoom Wiki
A_AlertMonsters [(float maxrange)]
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.
If a non-zero maxrange parameter is given, monsters will only be alerted if they are within said distance from the calling actor. (Note that this is a simple distance check to the alerter. The "sound" still travels the normal distance.)
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