[SOLVED]Force FRIENDLY to ignore another one on its LoF?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

[SOLVED]Force FRIENDLY to ignore another one on its LoF?

Post by Void Weaver »

For a some reason FRIENDLY monster doesn't perform jump into its attack states if allied player stand on its line of fire, between monster himself and its target.

I know that it can be hacked via using A_Chase("Missile","Missile") AND using MeleeRange property for performing "Missile" state from Melee jump-pointer. But it very ugly solution since it requires to rework code for any actual Melee-state of similar monster.

So I'd wish to know:
a) why and where (in which exact part of action sequence) placed this "safety" restriction; and
b) how it can be avoided by less hacky way?
Last edited by Void Weaver on Wed Aug 21, 2019 5:39 am, edited 2 times in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49226
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Force FRIENDLY to ignore player when he stand on its LoF

Post by Graf Zahl »

That safety restriction is part of the monster AI, it should be obvious why this was necessary for friendly monsters - they'd act far too stupidly without it.
The function is called P_HitFriend, but at the moment it cannot be overridden.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: [E]Force FRIENDLY to ignore player when he stand on its

Post by Void Weaver »

Got it, thanks for explanations. I hope that it will be open for overriding on further releases.

P_HitFriend source pls?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49226
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [E]Force FRIENDLY to ignore player when he stand on its

Post by Graf Zahl »

p_enemy.cpp, of course.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: [SOLVED]Force FRIENDLY to ignore another one on its LoF?

Post by Void Weaver »

Graf Zahl, thank you.
Source for P_HitFriend restriction.

Well, current behaviour can be avoided via A_CheckLOF("<ranged-attack_state>",CLOFF_JUMPFRIEND), BUT with restrictions for correct work of a some default functions which can do a some LoF check, like as A_CPosRefire. The last one will always interrupt attack and force return into See state since it will consider FRIENDLY on its caller LoF as obstacle.
Post Reply

Return to “Scripting”