Page 1 of 1

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

Posted: Mon Aug 19, 2019 10:06 am
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?

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

Posted: Mon Aug 19, 2019 12:41 pm
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.

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

Posted: Mon Aug 19, 2019 2:06 pm
by Void Weaver
Got it, thanks for explanations. I hope that it will be open for overriding on further releases.

P_HitFriend source pls?

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

Posted: Mon Aug 19, 2019 2:37 pm
by Graf Zahl
p_enemy.cpp, of course.

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

Posted: Wed Aug 21, 2019 5:47 am
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.