Jump to content
avibird 1

Is there a Code to stop friendly fire damage for one side ?

Recommended Posts

I am working on a expansion of the predator unit mod. I have modified a standard predator unit which uses a crisis nanosuit armor, terminator plasma rifle weapon and human mask form the predator mod. The unit works well as a standard unit but the issues is if they are grouped with other OPFOR units the original  predator units they will kill AI teammates or any other unit on its side. How can I stop  friendly fire damage for OPFOR and or IND units that are on the same side.  I am using liability insurance mod to prevent hit damage for vechicles works great so i know there is a way to code this. I can't find any working codes for this. This is my last attempted with no luck.

 

{ if (side _x isEqualTo East) then { _x addEventHandler [ "HnadleDamage", { _returnDamage = (_this select 2); 
if ((side (_this select 0)) isEqualTo (side (_this select 3))) then {   _returnDamage = 0; }; _returnDamage; } ]; }; } forEach allUnits;

 

Share this post


Link to post
Share on other sites
On 4/5/2024 at 4:19 PM, avibird 1 said:

 if they are grouped with other OPFOR units the original  predator units they will kill AI teammates or any other unit on its side.

 

Probably because your predators are enemySide (renegade) and not OPFOR...  Could you elaborate which side or in which context these units are killing teammates?

 

On 4/5/2024 at 4:19 PM, avibird 1 said:

 How can I stop  friendly fire damage for OPFOR and or IND units that are on the same side.

 

If you want to prevent unwanted collateral damage for OPFOR only, the EH handleDamage is a good way. Are you sure you apply it on units you want? Are you spawning them?

 

For edited ones:

{
  _x addEventHandler ["HandleDamage",{
    params ["_unit", "", "_damage","_source"];
    if (side _source isEqualTo EAST) then {_damage = 0};
    _damage
  }];
} forEach units OPFOR;

If you spawn them, you need to apply the EH on them also.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×