A_SpidRefire
Jump to navigation
Jump to search
void A_SpidRefire()
Usage
Used by SpiderMastermind. Calls A_FaceTarget and then lets the monster refire. If the target is dead or out of sight, will 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 SpiderMastermind's code:
Missile:
SPID A 20 BRIGHT A_FaceTarget;
SPID G 4 BRIGHT A_SPosAttackUseAtkSound;
SPID H 4 BRIGHT A_SposAttackUseAtkSound;
SPID H 1 BRIGHT A_SpidRefire;
Goto Missile+1;
ZScript definition
| Note: The ZScript definition below is for reference and may be different in the current version of UZDoom. The most up-to-date version of this code can be found on UZDoom GitHub. |
void A_SpidRefire()
{
if (HitFriend())
{
SetState(SeeState);
return;
}
// keep firing unless target got out of sight
A_FaceTarget();
if (Random[CPosRefire](0, 255) >= 10)
{
if (!target
|| target.health <= 0
|| !CheckSight(target, SF_SEEPASTBLOCKEVERYTHING|SF_SEEPASTSHOOTABLELINES))
{
SetState(SeeState);
}
}
}