New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about the new killfeed #501

Open
Soloknight opened this Issue Sep 19, 2017 · 18 comments

Comments

Projects
None yet
2 participants
@Soloknight

Soloknight commented Sep 19, 2017

Rev I'm using an EVH to catch the kills (Victim and killer) I have friendlyFire working but I can seem to get "slay" and "Blead-out" to register kills for the script I'm using, here is some of the code

if(KILL_REWARD_ENABLED) then
{
if((isPlayer _instigator) AND {_instigator != _unit}) then
{
if(_friendlyFire) then
{
if(TEAM_KILL_PENALTY_ENABLED) then
{
[(getNumber(getMissionConfig "CfgClient" >> "MasterCfg" >> (rank player) >> "tkPenaltyPlayer")),1] remoteExecCall ["fnc_addOrSubCash",_instigator,false];
if(XP_ENABLED) then
{
[(getNumber(getMissionConfig "CfgClient" >> "MasterCfg" >> (rank player) >> "xpPenaltyPlayer")),1] remoteExecCall ["fnc_addOrSubXP",_instigator,false];
};
};
} else {
[(getNumber(getMissionConfig "CfgClient" >> "MasterCfg" >> (rank player) >> "killedReward")),0] remoteExecCall ["fnc_addOrSubCash",_instigator,false];
if(XP_ENABLED) then
{
[(getNumber(getMissionConfig "CfgClient" >> "MasterCfg" >> (rank player) >> "xpReward")),0] remoteExecCall ["fnc_addOrSubXP",_instigator,false];
};
if(KILL_COUNT_ENABLED AND HUD_ENABLED) then
{
[0] remoteExecCall ["fnc_addOrSubKills",_instigator,false];
};
};
What do I need to add or change to get this working?

Thanks

@AgentRev

This comment has been minimized.

Show comment
Hide comment
@AgentRev

AgentRev Sep 19, 2017

Member

I do not have time to investigate this at the moment, remind me if I haven't replied within a week.

Member

AgentRev commented Sep 19, 2017

I do not have time to investigate this at the moment, remind me if I haven't replied within a week.

@Soloknight

This comment has been minimized.

Show comment
Hide comment
@Soloknight

Soloknight Sep 23, 2017

I know it’s not been a week yet ;-) I’m off on Monday. if you have time to join my discord and maybe show me a few things about this.

Soloknight commented Sep 23, 2017

I know it’s not been a week yet ;-) I’m off on Monday. if you have time to join my discord and maybe show me a few things about this.

@AgentRev

This comment has been minimized.

Show comment
Hide comment
@AgentRev

AgentRev Sep 23, 2017

Member

I started looking it at like 10 mins ago 😛

Member

AgentRev commented Sep 23, 2017

I started looking it at like 10 mins ago 😛

@AgentRev

This comment has been minimized.

Show comment
Hide comment
@AgentRev

AgentRev Sep 23, 2017

Member

You can sandwich your code between these lines:

if (!_killerMatch && isNull _killerGroup) exitWith {}; // we have no idea on which team the killer was when the kill occured, abort!
private ["_scoreColumn", "_scoreValue"];

Replace your _instigator with _killer, and player with _unit

_friendlyFire is directly available, and you can also add:

private _deathCause = [_unit getVariable "A3W_deathCause_local"] param [0,[],[[]]];
Member

AgentRev commented Sep 23, 2017

You can sandwich your code between these lines:

if (!_killerMatch && isNull _killerGroup) exitWith {}; // we have no idea on which team the killer was when the kill occured, abort!
private ["_scoreColumn", "_scoreValue"];

Replace your _instigator with _killer, and player with _unit

_friendlyFire is directly available, and you can also add:

private _deathCause = [_unit getVariable "A3W_deathCause_local"] param [0,[],[[]]];
@Soloknight

This comment has been minimized.

Show comment
Hide comment
@Soloknight

Soloknight Sep 23, 2017

Thanks👍 I’ll try it tonight

Soloknight commented Sep 23, 2017

Thanks👍 I’ll try it tonight

@Soloknight

This comment has been minimized.

Show comment
Hide comment
@Soloknight

Soloknight Sep 25, 2017

Heres the total file now after changes, I not catching any kill even friendFire
`// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2016 A3Wasteland.com *
// ******************************************************************************************
// @file Name: fn_registerKillScore.sqf
// @file Author: AgentRev

if (!isServer) exitWith {};

params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]], ["_presumedKiller",objNull,[objNull]], ["_victimDisconnect",false,[false]]];

diag_log format ["A3W_fnc_registerKillScore: %1, registered: %2, isPlayer: %3, killerDead: %4, killerGroup: %5", _this, _unit getVariable ["A3W_killScoreRegistered", false], isPlayer _unit, !alive _killer && !isPlayer _killer, group _killer];

if !(_killer isKindOf "Man") then { _killer = effectiveCommander _killer };

if !(_unit getVariable ["A3W_killScoreRegistered", false]) then
{
_unit setVariable ["A3W_killScoreRegistered", true];

private _isPlayer = (isPlayer _unit || _victimDisconnect);
private _killerMatch = (_killer == [_unit getVariable "FAR_killerUnit"] param [0,objNull,[objNull]] || _victimDisconnect);
private _killerGroup = grpNull;
private _friendlyFire = false;
private _deathCause = [_unit getVariable "A3W_deathCause_local"] param [0,[],[[]]];

if (_killerMatch) then
{
	_friendlyFire = [_unit getVariable "FAR_killerFriendly"] param [0,false,[false]];

	// killer has died, let's check if he has respawned
	if (!alive _killer && !isPlayer _killer) then
	{
		private _killerUID = [_unit getVariable "FAR_killerUID"] param [0,"",[""]];

		if !(_killerUID in ["","0"]) then
		{
			_killer = (allPlayers select {getPlayerUID _x isEqualTo _killerUID}) param [0, _killer];
		};
	};
}
else
{
	_killerGroup = group _killer;
	_friendlyFire = [_killerGroup, _unit] call A3W_fnc_isFriendly;
};

if (_isPlayer) then
{
	if (isPlayer _unit) then // false if alive on disconnect
	{
		[_unit, "deathCount", 1] call fn_addScore;
	}
	else
	{
		[_unit, true] call A3W_fnc_killBroadcast; // disconnected while injured, broadcast bleedout message, death score added in HandleDisconnect
	};
};

if (isPlayer _killer) then
{
	if (!_killerMatch && isNull _killerGroup) exitWith {}; // we have no idea on which team the killer was when the kill occured, abort!
		
		if(KILL_REWARD_ENABLED) then
		{
			if((isPlayer _killer) AND {_killer != _unit}) then
			{
				if(_deathCause == _friendlyFire) then
				{
					if(TEAM_KILL_PENALTY_ENABLED) then
					{
						[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank player) >> "tkPenaltyPlayer")),1] remoteExecCall ["HG_fnc_addOrSubCash",_killer,false];
						if(XP_ENABLED) then
						{
							[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank player) >> "xpPenaltyPlayer")),1] remoteExecCall ["HG_fnc_addOrSubXP",_killer,false];
						};
					};
				} else {
						[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank player) >> "killedReward")),0] remoteExecCall ["HG_fnc_addOrSubCash",_killer,false];
						if(XP_ENABLED) then
						{
							[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank player) >> "xpReward")),0] remoteExecCall ["HG_fnc_addOrSubXP",_killer,false];
						};
						if(KILL_COUNT_ENABLED AND HG_HUD_ENABLED) then
						{
							[0] remoteExecCall ["HG_fnc_addOrSubKills",_killer,false];
						};
					};
			};
		};
	private ["_scoreColumn", "_scoreValue"];

	if (_isPlayer) then
	{
		_scoreColumn = ["playerKills","teamKills"] select _friendlyFire;
		_scoreValue = 1;
	}
	else
	{
		_scoreColumn = "aiKills";
		_scoreValue = [1,0] select _friendlyFire;
	};

	[_killer, _scoreColumn, _scoreValue] call fn_addScore;

	if (isPlayer _presumedKiller && _presumedKiller != _unit) then // cancel score for presumed killer designated by game engine
	//Pay bounty to killer
	if(!_friendlyFire)then{
		_bountyAmount = _unit getVariable ["bounty", 0];
		if(_bountyAmount > 0)then{
			[_unit, _killer, _bountyAmount] call bountyRedeem;
		};
	};

	if (isPlayer _presumedKiller && _presumedKiller != _unit) then // cancel score for presumed killer designated by game engine
	{
		[_presumedKiller, "playerKills", 0] call fn_addScore; // sync Steam score
	};
};

};

_killer
`

Soloknight commented Sep 25, 2017

Heres the total file now after changes, I not catching any kill even friendFire
`// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2016 A3Wasteland.com *
// ******************************************************************************************
// @file Name: fn_registerKillScore.sqf
// @file Author: AgentRev

if (!isServer) exitWith {};

params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]], ["_presumedKiller",objNull,[objNull]], ["_victimDisconnect",false,[false]]];

diag_log format ["A3W_fnc_registerKillScore: %1, registered: %2, isPlayer: %3, killerDead: %4, killerGroup: %5", _this, _unit getVariable ["A3W_killScoreRegistered", false], isPlayer _unit, !alive _killer && !isPlayer _killer, group _killer];

if !(_killer isKindOf "Man") then { _killer = effectiveCommander _killer };

if !(_unit getVariable ["A3W_killScoreRegistered", false]) then
{
_unit setVariable ["A3W_killScoreRegistered", true];

private _isPlayer = (isPlayer _unit || _victimDisconnect);
private _killerMatch = (_killer == [_unit getVariable "FAR_killerUnit"] param [0,objNull,[objNull]] || _victimDisconnect);
private _killerGroup = grpNull;
private _friendlyFire = false;
private _deathCause = [_unit getVariable "A3W_deathCause_local"] param [0,[],[[]]];

if (_killerMatch) then
{
	_friendlyFire = [_unit getVariable "FAR_killerFriendly"] param [0,false,[false]];

	// killer has died, let's check if he has respawned
	if (!alive _killer && !isPlayer _killer) then
	{
		private _killerUID = [_unit getVariable "FAR_killerUID"] param [0,"",[""]];

		if !(_killerUID in ["","0"]) then
		{
			_killer = (allPlayers select {getPlayerUID _x isEqualTo _killerUID}) param [0, _killer];
		};
	};
}
else
{
	_killerGroup = group _killer;
	_friendlyFire = [_killerGroup, _unit] call A3W_fnc_isFriendly;
};

if (_isPlayer) then
{
	if (isPlayer _unit) then // false if alive on disconnect
	{
		[_unit, "deathCount", 1] call fn_addScore;
	}
	else
	{
		[_unit, true] call A3W_fnc_killBroadcast; // disconnected while injured, broadcast bleedout message, death score added in HandleDisconnect
	};
};

if (isPlayer _killer) then
{
	if (!_killerMatch && isNull _killerGroup) exitWith {}; // we have no idea on which team the killer was when the kill occured, abort!
		
		if(KILL_REWARD_ENABLED) then
		{
			if((isPlayer _killer) AND {_killer != _unit}) then
			{
				if(_deathCause == _friendlyFire) then
				{
					if(TEAM_KILL_PENALTY_ENABLED) then
					{
						[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank player) >> "tkPenaltyPlayer")),1] remoteExecCall ["HG_fnc_addOrSubCash",_killer,false];
						if(XP_ENABLED) then
						{
							[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank player) >> "xpPenaltyPlayer")),1] remoteExecCall ["HG_fnc_addOrSubXP",_killer,false];
						};
					};
				} else {
						[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank player) >> "killedReward")),0] remoteExecCall ["HG_fnc_addOrSubCash",_killer,false];
						if(XP_ENABLED) then
						{
							[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank player) >> "xpReward")),0] remoteExecCall ["HG_fnc_addOrSubXP",_killer,false];
						};
						if(KILL_COUNT_ENABLED AND HG_HUD_ENABLED) then
						{
							[0] remoteExecCall ["HG_fnc_addOrSubKills",_killer,false];
						};
					};
			};
		};
	private ["_scoreColumn", "_scoreValue"];

	if (_isPlayer) then
	{
		_scoreColumn = ["playerKills","teamKills"] select _friendlyFire;
		_scoreValue = 1;
	}
	else
	{
		_scoreColumn = "aiKills";
		_scoreValue = [1,0] select _friendlyFire;
	};

	[_killer, _scoreColumn, _scoreValue] call fn_addScore;

	if (isPlayer _presumedKiller && _presumedKiller != _unit) then // cancel score for presumed killer designated by game engine
	//Pay bounty to killer
	if(!_friendlyFire)then{
		_bountyAmount = _unit getVariable ["bounty", 0];
		if(_bountyAmount > 0)then{
			[_unit, _killer, _bountyAmount] call bountyRedeem;
		};
	};

	if (isPlayer _presumedKiller && _presumedKiller != _unit) then // cancel score for presumed killer designated by game engine
	{
		[_presumedKiller, "playerKills", 0] call fn_addScore; // sync Steam score
	};
};

};

_killer
`

@AgentRev

This comment has been minimized.

Show comment
Hide comment
@AgentRev

AgentRev Sep 25, 2017

Member

well duh, your #defines are missing...

Member

AgentRev commented Sep 25, 2017

well duh, your #defines are missing...

@Soloknight

This comment has been minimized.

Show comment
Hide comment
@Soloknight

Soloknight Sep 25, 2017

Can you give me example of one of these defines lines, please

Soloknight commented Sep 25, 2017

Can you give me example of one of these defines lines, please

@AgentRev

This comment has been minimized.

Show comment
Hide comment
@AgentRev

AgentRev Sep 25, 2017

Member

Did you not write the original script? I don't know where it comes from, nor what it does and what it needs to work.

Member

AgentRev commented Sep 25, 2017

Did you not write the original script? I don't know where it comes from, nor what it does and what it needs to work.

@Soloknight

This comment has been minimized.

Show comment
Hide comment
@Soloknight

Soloknight Sep 25, 2017

This is a script from Hoverguy that is stand alone, I've been using parts of it and he has helped a little with getting it working with wasteland. It was fully working until this last update.

I have it working with player XP and your shops for discounts etc. I haven't work with define that much so far in the conversion

Soloknight commented Sep 25, 2017

This is a script from Hoverguy that is stand alone, I've been using parts of it and he has helped a little with getting it working with wasteland. It was fully working until this last update.

I have it working with player XP and your shops for discounts etc. I haven't work with define that much so far in the conversion

@AgentRev

This comment has been minimized.

Show comment
Hide comment
@AgentRev

AgentRev Sep 25, 2017

Member

I don't know what are these:

KILL_REWARD_ENABLED
TEAM_KILL_PENALTY_ENABLED
XP_ENABLED
KILL_COUNT_ENABLED
HUD_ENABLED

They look like #defines, in which case they need to be included atop the file. Ideally you shouldn't put all the code in fn_registerKillScore.sqf, you should place it in a separate file and compile it as a function, which would be called using only one line in fn_registerKillScore.sqf. If you don't, you might run into conflicts again if I update the file.

Member

AgentRev commented Sep 25, 2017

I don't know what are these:

KILL_REWARD_ENABLED
TEAM_KILL_PENALTY_ENABLED
XP_ENABLED
KILL_COUNT_ENABLED
HUD_ENABLED

They look like #defines, in which case they need to be included atop the file. Ideally you shouldn't put all the code in fn_registerKillScore.sqf, you should place it in a separate file and compile it as a function, which would be called using only one line in fn_registerKillScore.sqf. If you don't, you might run into conflicts again if I update the file.

@Soloknight

This comment has been minimized.

Show comment
Hide comment
@Soloknight

Soloknight Sep 25, 2017

Hi, Rev, thanks for taking the time, I know you're busy, I have made a private repository so you can see more of what I'm working on. it's some pretty cool stuff. I test my knowledge and learned every day from you, hover and others. My wasteland is unique and also unusable to most because of the changes I've made. My Discord is https://discord.gg/0tOkw29tagp6HkDq

Soloknight commented Sep 25, 2017

Hi, Rev, thanks for taking the time, I know you're busy, I have made a private repository so you can see more of what I'm working on. it's some pretty cool stuff. I test my knowledge and learned every day from you, hover and others. My wasteland is unique and also unusable to most because of the changes I've made. My Discord is https://discord.gg/0tOkw29tagp6HkDq

@AgentRev

This comment has been minimized.

Show comment
Hide comment
@AgentRev

AgentRev Sep 25, 2017

Member

Yeah those things are not defined anywhere in the mission, take another look at wherever you got the script

Member

AgentRev commented Sep 25, 2017

Yeah those things are not defined anywhere in the mission, take another look at wherever you got the script

@Soloknight

This comment has been minimized.

Show comment
Hide comment
@Soloknight

Soloknight Sep 25, 2017

KILL_REWARD_ENABLED
TEAM_KILL_PENALTY_ENABLED
XP_ENABLED
KILL_COUNT_ENABLED
HG_HUD_ENABLED
Actually
HG_KILL_REWARD_ENABLED
HG_TEAM_KILL_PENALTY_ENABLED
HG_XP_ENABLED
HG_KILL_COUNT_ENABLED
HG_HUD_ENABLED

Soloknight commented Sep 25, 2017

KILL_REWARD_ENABLED
TEAM_KILL_PENALTY_ENABLED
XP_ENABLED
KILL_COUNT_ENABLED
HG_HUD_ENABLED
Actually
HG_KILL_REWARD_ENABLED
HG_TEAM_KILL_PENALTY_ENABLED
HG_XP_ENABLED
HG_KILL_COUNT_ENABLED
HG_HUD_ENABLED

@AgentRev

This comment has been minimized.

Show comment
Hide comment
@AgentRev

AgentRev Sep 25, 2017

Member

Well, fix the names then.

Member

AgentRev commented Sep 25, 2017

Well, fix the names then.

@Soloknight

This comment has been minimized.

Show comment
Hide comment
@Soloknight

Soloknight Sep 25, 2017

I did, testing a few things

Soloknight commented Sep 25, 2017

I did, testing a few things

@Soloknight

This comment has been minimized.

Show comment
Hide comment
@Soloknight

Soloknight Sep 25, 2017

You were right I figure out the #define issue, now with the if statement https://github.com/Soloknight/A3WwithHG/blob/ba55d2397d670d510b0cd3ee62d67c2d18076a9d/ArmA3_Wasteland.Stratis/server/functions/fn_registerKillScore.sqf#L74 whats the best way to get in register team kills on indy side I will add it to a external file after 100% working

Soloknight commented Sep 25, 2017

You were right I figure out the #define issue, now with the if statement https://github.com/Soloknight/A3WwithHG/blob/ba55d2397d670d510b0cd3ee62d67c2d18076a9d/ArmA3_Wasteland.Stratis/server/functions/fn_registerKillScore.sqf#L74 whats the best way to get in register team kills on indy side I will add it to a external file after 100% working

@Soloknight

This comment has been minimized.

Show comment
Hide comment
@Soloknight

Soloknight Jan 16, 2018

Hi Rev, I recently can back to ARMA 3 after a 3-month break. I love this mod so I created a new server. I would like to thank you for helping above and pointing me in the right direction. When testing it most recently everything works other then blufor. When Blufor starts a mission, every kill(AI) they do it considers it a teamkill. I know that playerSide defaults to WEST. Here is my latest code

``// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2016 A3Wasteland.com *
// ******************************************************************************************
// @file Name: fn_registerKillScore.sqf
// @file Author: AgentRev

private _friendlyFire = [_killerGroup, _unit] call A3W_fnc_isFriendly;
if (!isServer) exitWith {};

params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]], ["_presumedKiller",objNull,[objNull]], ["_victimDisconnect",false,[false]]];

diag_log format ["A3W_fnc_registerKillScore: %1, registered: %2, isPlayer: %3, killerDead: %4, killerGroup: %5", _this, _unit getVariable ["A3W_killScoreRegistered", false], isPlayer _unit, !alive _killer && !isPlayer _killer, group _killer];

if !(_killer isKindOf "Man") then { _killer = effectiveCommander _killer };

if !(_unit getVariable ["A3W_killScoreRegistered", false]) then
{
_unit setVariable ["A3W_killScoreRegistered", true];

private _isPlayer = (isPlayer _unit || _victimDisconnect);
private _killerMatch = (_killer == [_unit getVariable "FAR_killerUnit"] param [0,objNull,[objNull]] || _victimDisconnect);
private _killerGroup = grpNull;
private _friendlyFire = false;
private _deathCause = [_unit getVariable "A3W_deathCause_local"] param [0,[],[[]]];


if (_killerMatch) then
{
	_friendlyFire = [_unit getVariable "FAR_killerFriendly"] param [0,false,[false]];

	// killer has died, let's check if he has respawned
	if (!alive _killer && !isPlayer _killer) then
	{
		private _killerUID = [_unit getVariable "FAR_killerUID"] param [0,"",[""]];

		if !(_killerUID in ["","0"]) then
		{
			_killer = (allPlayers select {getPlayerUID _x isEqualTo _killerUID}) param [0, _killer];
		};
	};
}
else
{
	_killerGroup = group _killer;
	_friendlyFire = [_killerGroup, _unit] call A3W_fnc_isFriendly;
};

if (_isPlayer) then
{
	if (isPlayer _unit) then // false if alive on disconnect
	{
		[_unit, "deathCount", 1] call fn_addScore;
	}
	else
	{
		[_unit, true] call A3W_fnc_killBroadcast; // disconnected while injured, broadcast bleedout message, death score added in HandleDisconnect
	};
};

if (isPlayer _killer) then
{
	if (!_killerMatch && isNull _killerGroup) exitWith {}; // we have no idea on which team the killer was when the kill occured, abort!

	if((getNumber(getMissionConfig "CfgClient" >> "enableKillReward")) isEqualTo 1) then
	{
		//if((isPlayer _killer) AND {_killer != _unit}) then
		if((!isPlayer _killer) OR {_killer isEqualTo _unit}) exitWith {};
		
			if((side _killer) isEqualTo playerSide || (_friendlyFire)) then
			{
				if((getNumber(getMissionConfig "CfgClient" >> "enableTeamKillPenalty")) isEqualTo 1) then
				{
					[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank _unit) >> "tkPenaltyPlayer")),1] remoteExecCall ["HG_fnc_addOrSubCash",_killer,false];
					if((getNumber(getMissionConfig "CfgClient" >> "enableXP")) isEqualTo 1) then
					{
						[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank _unit) >> "xpPenaltyPlayer")),1] remoteExecCall ["HG_fnc_addOrSubXP",_killer,false];
					};
				};
			} else {
				[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank _unit) >> "killedReward")),0] remoteExecCall ["HG_fnc_addOrSubCash",_killer,false];
				if((getNumber(getMissionConfig "CfgClient" >> "enableXP")) isEqualTo 1) then
				{
					[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank _unit) >> "xpReward")),0] remoteExecCall ["HG_fnc_addOrSubXP",_killer,false];
				};
				if(((getNumber(getMissionConfig "CfgClient" >> "enableKillCount")) isEqualTo 1) AND ((getNumber(getMissionConfig "CfgClient" >> "enableHUD")) isEqualTo 1)) then
				{
					[0] remoteExecCall ["HG_fnc_addOrSubKills",_killer,false];
				};
			};
		
	};
	
	private ["_scoreColumn", "_scoreValue"];

	if (_isPlayer) then
	{
		_scoreColumn = ["playerKills","teamKills"] select _friendlyFire;
		_scoreValue = 1;
	}
	else
	{
		_scoreColumn = "aiKills";
		_scoreValue = [1,0] select _friendlyFire;
	};

	[_killer, _scoreColumn, _scoreValue] call fn_addScore;

	if (isPlayer _presumedKiller && _presumedKiller != _unit) then // cancel score for presumed killer designated by game engine
	{
		[_presumedKiller, "playerKills", 0] call fn_addScore; // sync Steam score
	};
};

};

_killer``

I'm kinda at a lost, what would be the best fix?

Soloknight commented Jan 16, 2018

Hi Rev, I recently can back to ARMA 3 after a 3-month break. I love this mod so I created a new server. I would like to thank you for helping above and pointing me in the right direction. When testing it most recently everything works other then blufor. When Blufor starts a mission, every kill(AI) they do it considers it a teamkill. I know that playerSide defaults to WEST. Here is my latest code

``// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2016 A3Wasteland.com *
// ******************************************************************************************
// @file Name: fn_registerKillScore.sqf
// @file Author: AgentRev

private _friendlyFire = [_killerGroup, _unit] call A3W_fnc_isFriendly;
if (!isServer) exitWith {};

params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]], ["_presumedKiller",objNull,[objNull]], ["_victimDisconnect",false,[false]]];

diag_log format ["A3W_fnc_registerKillScore: %1, registered: %2, isPlayer: %3, killerDead: %4, killerGroup: %5", _this, _unit getVariable ["A3W_killScoreRegistered", false], isPlayer _unit, !alive _killer && !isPlayer _killer, group _killer];

if !(_killer isKindOf "Man") then { _killer = effectiveCommander _killer };

if !(_unit getVariable ["A3W_killScoreRegistered", false]) then
{
_unit setVariable ["A3W_killScoreRegistered", true];

private _isPlayer = (isPlayer _unit || _victimDisconnect);
private _killerMatch = (_killer == [_unit getVariable "FAR_killerUnit"] param [0,objNull,[objNull]] || _victimDisconnect);
private _killerGroup = grpNull;
private _friendlyFire = false;
private _deathCause = [_unit getVariable "A3W_deathCause_local"] param [0,[],[[]]];


if (_killerMatch) then
{
	_friendlyFire = [_unit getVariable "FAR_killerFriendly"] param [0,false,[false]];

	// killer has died, let's check if he has respawned
	if (!alive _killer && !isPlayer _killer) then
	{
		private _killerUID = [_unit getVariable "FAR_killerUID"] param [0,"",[""]];

		if !(_killerUID in ["","0"]) then
		{
			_killer = (allPlayers select {getPlayerUID _x isEqualTo _killerUID}) param [0, _killer];
		};
	};
}
else
{
	_killerGroup = group _killer;
	_friendlyFire = [_killerGroup, _unit] call A3W_fnc_isFriendly;
};

if (_isPlayer) then
{
	if (isPlayer _unit) then // false if alive on disconnect
	{
		[_unit, "deathCount", 1] call fn_addScore;
	}
	else
	{
		[_unit, true] call A3W_fnc_killBroadcast; // disconnected while injured, broadcast bleedout message, death score added in HandleDisconnect
	};
};

if (isPlayer _killer) then
{
	if (!_killerMatch && isNull _killerGroup) exitWith {}; // we have no idea on which team the killer was when the kill occured, abort!

	if((getNumber(getMissionConfig "CfgClient" >> "enableKillReward")) isEqualTo 1) then
	{
		//if((isPlayer _killer) AND {_killer != _unit}) then
		if((!isPlayer _killer) OR {_killer isEqualTo _unit}) exitWith {};
		
			if((side _killer) isEqualTo playerSide || (_friendlyFire)) then
			{
				if((getNumber(getMissionConfig "CfgClient" >> "enableTeamKillPenalty")) isEqualTo 1) then
				{
					[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank _unit) >> "tkPenaltyPlayer")),1] remoteExecCall ["HG_fnc_addOrSubCash",_killer,false];
					if((getNumber(getMissionConfig "CfgClient" >> "enableXP")) isEqualTo 1) then
					{
						[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank _unit) >> "xpPenaltyPlayer")),1] remoteExecCall ["HG_fnc_addOrSubXP",_killer,false];
					};
				};
			} else {
				[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank _unit) >> "killedReward")),0] remoteExecCall ["HG_fnc_addOrSubCash",_killer,false];
				if((getNumber(getMissionConfig "CfgClient" >> "enableXP")) isEqualTo 1) then
				{
					[(getNumber(getMissionConfig "CfgClient" >> "HG_MasterCfg" >> (rank _unit) >> "xpReward")),0] remoteExecCall ["HG_fnc_addOrSubXP",_killer,false];
				};
				if(((getNumber(getMissionConfig "CfgClient" >> "enableKillCount")) isEqualTo 1) AND ((getNumber(getMissionConfig "CfgClient" >> "enableHUD")) isEqualTo 1)) then
				{
					[0] remoteExecCall ["HG_fnc_addOrSubKills",_killer,false];
				};
			};
		
	};
	
	private ["_scoreColumn", "_scoreValue"];

	if (_isPlayer) then
	{
		_scoreColumn = ["playerKills","teamKills"] select _friendlyFire;
		_scoreValue = 1;
	}
	else
	{
		_scoreColumn = "aiKills";
		_scoreValue = [1,0] select _friendlyFire;
	};

	[_killer, _scoreColumn, _scoreValue] call fn_addScore;

	if (isPlayer _presumedKiller && _presumedKiller != _unit) then // cancel score for presumed killer designated by game engine
	{
		[_presumedKiller, "playerKills", 0] call fn_addScore; // sync Steam score
	};
};

};

_killer``

I'm kinda at a lost, what would be the best fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment