Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Kill Tracker - Support custom AI names #211

Merged
merged 3 commits into from
Feb 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions addons/killtracker/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* Author: PabstMirror
* Tracks deaths/kills and logs to the end mission disaplay
* Attemps to log kills from ace_medical by using ace_medical_lastDamageSource
* Attemps to log kills from ace_medical by using "ace_killed" event
*
* Note: Requires config setup in a mission's description.ext
* Has no effect if mission is not setup correctly
Expand All @@ -15,7 +15,6 @@
*
* Public: No
*/
// #define DEBUG_MODE_FULL

// place the following in a misison's description.ext:
/*
Expand All @@ -26,6 +25,7 @@
};
};
*/

if ((getText (missionconfigfile >> "CfgDebriefingSections" >> QUOTE(ADDON) >> "variable")) != QGVAR(outputText)) exitWith {
TRACE_1("no mission debriefing config",_this);
};
Expand Down Expand Up @@ -115,7 +115,10 @@ GVAR(killCount) = 0;
if (_killerIsPlayer) then {
_killerName = [_killer, true, false] call ACEFUNC(common,getName);
} else {
_killerName = format ["*AI* - %1", getText (configfile >> "CfgVehicles" >> (typeOf _killer) >> "displayName")];
_killerName = _unit getVariable [QGVAR(aiName), ""]; // allow setting a custom AI name (e.g. VIP Target)
if (_killerName == "") then {
_killerName = format ["*AI* - %1", getText (configfile >> "CfgVehicles" >> (typeOf _killer) >> "displayName")];
};
};
};
TRACE_3("send death event",_unit,_killerName,_killInfo);
Expand All @@ -124,10 +127,14 @@ GVAR(killCount) = 0;

// If killer was player then send event to killer
if (_killerIsPlayer) then {
private _unitName = if (_unitIsPlayer) then {
[_unit, true, false] call ACEFUNC(common,getName); // should be same as profileName
private _unitName = "";
if (_unitIsPlayer) then {
_unitName = [_unit, true, false] call ACEFUNC(common,getName); // should be same as profileName
} else {
format ["*AI* - %1", getText (configfile >> "CfgVehicles" >> (typeOf _unit) >> "displayName")];
_unitName = _unit getVariable [QGVAR(aiName), ""]; // allow setting a custom AI name (e.g. VIP Target)
if (_unitName == "") then {
_unitName = format ["*AI* - %1", getText (configfile >> "CfgVehicles" >> (typeOf _killer) >> "displayName")];
};
};
TRACE_3("send kill event",_killer,_unitName,_killInfo);
[QGVAR(kill), [_unitName, _killInfo], _killer] call CBA_fnc_targetEvent;
Expand Down