A_SentinelRefire
Jump to navigation
Jump to search
This page describes a function made for one of the natively supported games. These functions are made with very specific purpose and provide no flexibility, so using them in custom projects is not recommended. Authors are encouraged to use one of the more generalized functions in custom projects. For example: A_MonsterRefire.
void A_SentinelRefire()
Usage
Used by Sentinel, Beggar, Macil1, Macil2 and CeilingTurret. Calls A_FaceTarget and then lets the monster refire. If the target is dead, or out of sight, or the monster has no "Missile" state sequence and the target is outside of its melee range, has a chance to abort the attack and go back to its "See" state sequence with a 10 out of 255 chance. Also aborts if the monster hit its ally.
Examples
From Sentinel's code:
Missile:
SEWR B 4 A_FaceTarget;
SEWR C 8 Bright A_SentinelAttack;
SEWR C 4 Bright A_SentinelRefire;
Goto Missile+1;
ZScript definition
Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub. |
void A_SentinelRefire()
{
A_FaceTarget ();
if (HitFriend())
{
SetState(SeeState);
return;
}
if (random[SentinelRefire]() >= 30)
{
if (target == NULL ||
target.health <= 0 ||
!CheckSight (target, SF_SEEPASTBLOCKEVERYTHING|SF_SEEPASTSHOOTABLELINES) ||
(MissileState == NULL && !CheckMeleeRange()) ||
random[SentinelRefire]() < 40)
{
SetState (SeeState);
}
}
}