Page 1 of 1
How to use A_JumpIfTargetinLOS?
Posted: Sun Apr 13, 2025 10:04 am
by HungryGzoong
Code: Select all
Missile:
POSS F 0 A_PlaySound("insertsoundeffect");
POSS E 6 A_FaceTarget;
POSS E 6 A_FaceTarget;
POSS E 6 A_FaceTarget;
goto Missile1;
Missile1:
POSS F 0 A_PlaySound("insertsoundeffect"); //looping sound effect
POSS E 6 A_JumpIfTargetInLOS(1,1,JLOSF_NOAUTOAIM);
goto Missile2;
POSS E 1 A_MonsterRefire(0,"Missile1");
goto Missile1+1;
Missile2:
POSS F 8 Bright A_SpawnProjectile("Arachnoplasma");
POSS E 6 A_FaceTarget;
goto See;
Hello, I can't get an enemy to "hold" its attack while its target is out of sight.
Re: How to use A_JumpIfTargetinLOS?
Posted: Wed Apr 16, 2025 10:45 am
by Heisanevilgenius
It seems like you have it backwards.
Your code looks like if the target is in line of sight, it jumps to the refire code, and if they're not in sight, it jumps to the attack.
Try:
Code: Select all
Missile:
POSS F 0 A_PlaySound("insertsoundeffect");
POSS E 6 A_FaceTarget;
POSS E 6 A_FaceTarget;
POSS E 6 A_FaceTarget;
goto Missile1;
Missile1:
POSS F 0 A_PlaySound("insertsoundeffect"); //looping sound effect
POSS E 6 A_JumpIfTargetInLOS("Missile2",1,JLOSF_NOAUTOAIM);
POSS E 1 A_MonsterRefire(0,"Missile1");
goto Missile1+1;
Missile2:
POSS F 8 Bright A_SpawnProjectile("Arachnoplasma");
POSS E 6 A_FaceTarget;
goto See;