A_MonsterRefire

From ZDoom Wiki
Jump to navigation Jump to search


Actor

native State A_MonsterRefire (int chance, statelabel label)

Usage

Calls A_FaceTarget and then checks whether the monster should abort its attack sequence and go to a different state. If the target is out of sight or dead, has a chance/255 chance to not jump to the label state sequence. Also aborts the attack if it hit the monster's ally.

Monster-specific functions such as A_CPosRefire, A_CrusaderRefire, A_SpidRefire and A_SentinelRefire, are variations of this function with predetermined chances (they also all jump to the "See" state sequence if the attack is to be aborted).

Parameters

  • int chance
Chance in the 0-255 range that the actor will continue attacking even if its target is dead or out of sight.
  • StateLabel label
Name of the state sequence to go to if the actor aborts its attack, for example "See".

Example

Class SuperZombie : ZombieMan
{
	States
	{
	Missile:
		POSS E 10 A_FaceTarget;
	MissileLoop: // Intentional fall-through
		POSS FE 2 Bright A_PosAttack;
		POSS F 1 A_MonsterRefire(128, "See"); // 50% chance to jump to "See" if target is out of sight.
		loop; // If the jump doesn't happen, loops back to the start of MissileLoop
	}
}