From ZDoom Wiki
Jump to navigation Jump to search

Bool CheckMissileRange ()


This function determines if the actor calling it can attack their target, it is used by several built-in functions such as A_Chase.

The function has the following fail conditions:

  • The caller is inside a sector with the SECF_NOATTACK flag on.
  • The callers' target is not visible.
  • The caller was just hit, and his target is dead.
  • The callers' reaction time has not reached zero yet.
  • The caller is a friendly monster, and his target is also another friendly monster. In deathmatch games, this is only a fail condition if the other monster works for the same player or team as the caller.
  • The caller is a friendly monster, and another friendly monster is in the line of fire, this uses the same logic as the above condition for deathmatch games.
  • The target is beyond the callers' MaxTargetRange.
  • The caller has a melee state, and the target is closer than his MeleeThreshold.

If none of the above conditions are true, then the function will decide if the caller could do a ranged attack based on whether or not they have a melee attack state, if the MISSILEMORE and/or MISSILEEVENMORE flags are on, the value of their MinMissileChance property, the aggressiveness value of the current skill level, and at last, the distance between the caller and their target.

Return value

The function returns true if none of the above fail conditions are met. Otherwise it returns false.


Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.