Jump to content
no_pants_on

Disable friendly fire when using ACE

Recommended Posts

Hi,

 

I'm trying to get my brother into playing ARMA and am building a mission for him to play. With an AI squad he will fight to secure an oil depot (on Malden 2035). The mission takes place in tight quarters in heavy fog. I'm happy with the mission so far, but when play-testing it the AI soldiers CONSTANTLY keep killing each other and the player. I know this would be a big turn-off for my brother.

 

So, I've tried turning off friendly fire damage within the squad and it works well as long as I don't use ACE. With ACE's wound mechanics the script I use doesn't work, and I have no idea how to make them play nice with each other (I know nothing of how ACE works and my scripting skills are less than non-existent). Could anybody help me with this? This is what I have in my init.sqf (script courtesy of dakaodo in this thread).

waitUntil {!isNull player};

{
    _x addEventHandler
    [
        "HandleDamage",
        {
            _returnDamage = (_this select 2);
            if ((side (_this select 0)) isEqualTo (side (_this select 3))) then
            {
                _returnDamage = 0;
            };
            _returnDamage;
        }
    ];
} forEach units group player;

Any help would be appreciated.

Share this post


Link to post
Share on other sites

@Persian MO
I pulled this from a mission template I created a year or two ago.

I have not tested it since, and testing was not extensive... Use at your own risk.

 

{
	/*
		Remove all HandleDamage Event Handlers.

		This should disable ACE Medical on the players group - INCLUDING the player.

		It is possible to have player use ACE Medical.
	*/

	_x removeAllEventHandlers "HandleDamage";


	_x addEventHandler
	[
		"HandleDamage",
		{
			params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];

			_isFriendlyFire = side group _instigator isEqualTo side group _unit;

			if (_isFriendlyFire) then { _damage = 0; };

			//	IGNORE BELOW LINE!
			//if (_isFriendlyFire) then { _damage = 0; } else { _damage = _damage * 2; };

			_damage

		}
	];
} forEach units group player;

 

A friend recently created something similar.

I'm not 100% sure of his method but I'll ask him if he can respond here also.

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, ZaellixA said:

Maybe you should ask at the ACE github for more information, or even the ACE 3 public chat (this is on Slack).

I did that. Not respond yet!

 

2 hours ago, Maff said:

@Persian MO
I pulled this from a mission template I created a year or two ago.

I have not tested it since, and testing was not extensive... Use at your own risk.

 


{
	/*
		Remove all HandleDamage Event Handlers.

		This should disable ACE Medical on the players group - INCLUDING the player.

		It is possible to have player use ACE Medical.
	*/

	_x removeAllEventHandlers "HandleDamage";


	_x addEventHandler
	[
		"HandleDamage",
		{
			params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];

			_isFriendlyFire = side group _instigator isEqualTo side group _unit;

			if (_isFriendlyFire) then { _damage = 0; };

			//	IGNORE BELOW LINE!
			//if (_isFriendlyFire) then { _damage = 0; } else { _damage = _damage * 2; };

			_damage

		}
	];
} forEach units group player;

 

A friend recently created something similar.

I'm not 100% sure of his method but I'll ask him if he can respond here also.

Thanks. I'll try it and I'm also waiting for your friend if there is more than one solution.

  • Like 1

Share this post


Link to post
Share on other sites
On 12/11/2020 at 3:42 PM, Maff said:

@Persian MO
I pulled this from a mission template I created a year or two ago.

I have not tested it since, and testing was not extensive... Use at your own risk.

 


{
	/*
		Remove all HandleDamage Event Handlers.

		This should disable ACE Medical on the players group - INCLUDING the player.

		It is possible to have player use ACE Medical.
	*/

	_x removeAllEventHandlers "HandleDamage";


	_x addEventHandler
	[
		"HandleDamage",
		{
			params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];

			_isFriendlyFire = side group _instigator isEqualTo side group _unit;

			if (_isFriendlyFire) then { _damage = 0; };

			//	IGNORE BELOW LINE!
			//if (_isFriendlyFire) then { _damage = 0; } else { _damage = _damage * 2; };

			_damage

		}
	];
} forEach units group player;

 

A friend recently created something similar.

I'm not 100% sure of his method but I'll ask him if he can respond here also.

This isn't working, unfortunately.

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

×