Jump to content
BEAKSBY

How to allow "friendly fire"?

Recommended Posts

Hi All,

How do allow friendly fire from a player that accidently kills/destroys his own units without changing sides in MP?

What command / script do I use and where do I place it?

Thanks!

Share this post


Link to post
Share on other sites

If you wanted to prevent units from taking damage from friendly bullets, use an EventHandler, specifically the one for Handle Damage. Be sure to check out Celery's more than helpful post for more info on how it works. All you would need to do is check if the side of the shooter is the same as the side of the unit being hit. If so, damage is 0. If not, damage is normal.

If you're looking to prevent rating change, my only thought is to used a Killed event handler, and if the side of the killer is the side of the unit that was killed, then give him some addRating to offset the TK. This will work because it takes more than 1 TK to become an enemy, I believe.

Share this post


Link to post
Share on other sites
What command / script do I use and where do I place it?

AFAIK, there is no script or command for this. Unless you can find one on the Interweb, you must write your own.

You need to consider locality of the commands you want to run. addRating only makes "global" changes if units are local, so you need to make sure you execute your code on the PC you want the affected rating to be applied to (ie: yours).

You could add "killed" EH to all friendly units and then use PV/BIS_FNC_MP to send the values to the killers (YOUR) PC. Do some addRating stuff if it turns out that it's you.

Good luck. :)

Share this post


Link to post
Share on other sites

One way to remove scoring completely and therefor also ignore friendly fire is to use a fired eventhandler that delete the original projectiles and replace them with identical, spawned ones. That way, the projectiles do not carry any information about the shooter.

Share this post


Link to post
Share on other sites

If you wanted to prevent units from taking damage from friendly bullets, use an EventHandler, specifically the one for Handle Damage. Be sure to check out Celery's more than helpful post for more info on how it works. All you would need to do is check if the side of the shooter is the same as the side of the unit being hit. If so, damage is 0. If not, damage is normal.

 

Hi, Grimes or anyone else reading this!

 

Please bear in mind that I have no SQF or otherwise scripting experience prior to my past two months of ArmA 3 mission-building. I'm still learning by bashing other people's snippets, and my knowledge of syntax has some massive gaps. I crudely attempted to implement Grimes' solution two ways, with either a unit init or an entry in the init.sqf. Anyone who understands SQF will see immediately they don't work. Would someone kindly show me the way to do this?

Unit init, doesn't work:

 

this addEventHandler["Hit", if (side (this "HandleDamage" select 0) == side (this "HandleDamage" select 3)) then {this allowDamage false}];

init.sqf, doesn't work:

 

{
    if(side _x == west) then
    {
        _x addEventHandler
        ["HandleDamage",
        {

            if (side (_this select 3) == side (_this select 0)) then
            {
                _x setDamage 0;
            };
        }];
    };
} foreach (allUnits);

Share this post


Link to post
Share on other sites

Try something more like this:

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

Share this post


Link to post
Share on other sites

BIS needs to remove FF altogether or allow players to set the option.

A few times now, we've had entire games ruined because accidental FF.

We could be an hour or two into a great mission, then a mis-timed 40mm

launched wrong, results in our side now turning on us. Stupid! Why? Grrr.

What's the point of FF? A projectile is a piece of metal. A grenade is a grenade.

How would your side know where it came from? It's the fog of war. It happens.

It happens in real life and in the game.

Pisses me off when your own side turns on you because your grenade bounced

off a tree or you had the wrong zero on your 203 Launcher. Ruins the whole mission!

BIS, please remove (or option) the Friendly Fire non-sense. My 2¢.

Share this post


Link to post
Share on other sites

Thanks, jshock! I put your script snippet in the init.sqf and it worked like a charm for direct weapons fire (which was my main concern)!

 

(secondary explosive damage still killed my AI units, but I remember reading about two handleDamage eventHandlers per damage instance, so I assume secondary damage is a whole different problem.)

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

×