Jump to content
chazbotic

ACE3 "War Crime Indicator"

Recommended Posts

i didn't see an actual drop-in solution for the issue where the EntityKilled eventHandler when using ace_medical has _killer and _killed as the same. this is because of the eventHandler ace_medical uses in order to intercept damage, implement the ACE3 medical system, then apply damage to the unit. the unit effectively shows as killing themselves most of the time when the damage isn't instantaneous (and preventInstaDeath is disabled).

 

so i wrote a modifiable snippet that you can copy/paste into init.sqf to handle the issue. you can modify the string reported as needed, however currently it reports on unarmed/armed civilian deaths, surrendered or captive prisoner deaths, and teamkills. because the ace_medical_lastDamageSource variable is set locally and not meant to be broadcast, i found it much easier to have two ifthens: one that is handled where the unit is local to the server (owner _killed == clientOwner) and one where the unit is local to some other player, ie zeus (hasInterface && (!isServer) && (local _killed)). this avoids the need to transmit the variable at all, and simply asks where these cases are true to remoteExec broadcase the string where appropriate. i use str text format for systemChat because hint and parsetext seemed inappropriate for a ticker notice. ideally i would like to use switchdo and cases to cat the strings together more cleanly but my initial attempt was a little messy and i'll revisit it some other time.

 

you can place this copy/paste into init.sqf. while it adds the event handler to the server and all clients, it will only print messages for hosted missions or for a zeus player. this is working for player hosted missions, dedicated server, as well as persistent missions. it should also work for headless clients, but i haven't tried that.

Spoiler



if (true) then {
	addMissionEventHandler ["EntityKilled", {
		params ["_killed", "_killer", "_instigator"];
		_ownerKilled = owner _killed;
		_armedKilled = {_x != ""} count [currentWeapon _killed, secondaryWeapon _killed];
		if (_killer == _killed) then {
			_killer = _killed getVariable ["ace_medical_lastDamageSource", _killer];} else {_killer};
		if (isNull _instigator) then {_instigator = UAVControl vehicle _killer select 0};
		if (isNull _instigator) then {_instigator = _killer};
		if (_ownerKilled == clientOwner) then {
			if ((_killed isKindOf "CAManBase") && {side group _killed isEqualTo civilian} && {_armedKilled == 0} && {_killer in allPlayers}) then {
				_str_1 = str text format ["%2 has killed %1, an unarmed civilian.", (name _killed), (name _killer)];
				[_str_1] remoteExec ["systemChat", 0, false];
			};
			if ((_killed isKindOf "CAManBase") && {side group _killed isEqualTo civilian} && {_armedKilled != 0} && {_killer in allPlayers}) then {
				_str_2 = str text format ["%2 has killed %1, a civilian combatant.", (name _killed), (name _killer)];
				[_str_2] remoteExec ["systemChat", 0, false];
			};
			if (((animationState _killed) == "ACE_AmovPercMstpSsurWnonDnon") && {_killer in allPlayers}) then {
				_str_3 = str text format ["%2 has killed %1, a surrendered prisoner.", (name _killed), (name _killer)];
				[_str_3] remoteExec ["systemChat", 0, false];
			};
			if (((animationState _killed) == "ACE_AmovPercMstpScapWnonDnon") && {_killer in allPlayers}) then {
				_str_4 = str text format ["%2 has killed %1, a captured prisoner.", (name _killed), (name _killer)];
				[_str_4] remoteExec ["systemChat", 0, false];
			};
			if (((side group _killed) isEqualTo (side group _killer)) && {_killed != _killer} && {_killer in allPlayers}) then {
				_str_5 = str text format ["%2 has teamkilled %1.", (name _killed), (name _killer)];
				[_str_5] remoteExec ["systemChat", 0, false];
			};
		};
		if (hasInterface && (!isServer) && (local _killed)) then {
			if ((_killed isKindOf "CAManBase") && {side group _killed isEqualTo civilian} && {_armedKilled == 0} && {_killer in allPlayers}) then {
				_str_1 = str text format ["%2 has killed %1, an unarmed civilian.", (name _killed), (name _killer)];
				[_str_1] remoteExec ["systemChat", 0, false];
			};
			if ((_killed isKindOf "CAManBase") && {side group _killed isEqualTo civilian} && {_armedKilled != 0} && {_killer in allPlayers}) then {
				_str_2 = str text format ["%2 has killed %1, a civilian combatant.", (name _killed), (name _killer)];
				[_str_2] remoteExec ["systemChat", 0, false];
			};
			if (((animationState _killed) == "ACE_AmovPercMstpSsurWnonDnon") && {_killer in allPlayers}) then {
				_str_3 = str text format ["%2 has killed %1, a surrendered prisoner.", (name _killed), (name _killer)];
				[_str_3] remoteExec ["systemChat", 0, false];
			};
			if (((animationState _killed) == "ACE_AmovPercMstpScapWnonDnon") && {_killer in allPlayers}) then {
				_str_4 = str text format ["%2 has killed %1, a captured prisoner.", (name _killed), (name _killer)];
				[_str_4] remoteExec ["systemChat", 0, false];
			};
			if (((side group _killed) isEqualTo (side group _killer)) && {_killed != _killer} && {_killer in allPlayers}) then {
				_str_5 = str text format ["%2 has teamkilled %1.", (name _killed), (name _killer)];
				[_str_5] remoteExec ["systemChat", 0, false];
			};
		};
	}];
};


 

 

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

×