From 578477eae6c20a6caf29f44f6c63358fb6096fbe Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 20 Jun 2016 15:12:23 -0500 Subject: [PATCH] Fix issue with dogtag respawn/setVariable Store object instead of bool to indicate when dogtags have been taken When object respawns, the the old object reference won't apply (defacto reset) --- addons/dogtags/functions/fnc_canCheckDogtag.sqf | 2 +- addons/dogtags/functions/fnc_canTakeDogtag.sqf | 2 +- addons/dogtags/functions/fnc_checkDogtag.sqf | 2 +- addons/dogtags/functions/fnc_getDogtagItem.sqf | 2 +- addons/dogtags/functions/fnc_takeDogtag.sqf | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/dogtags/functions/fnc_canCheckDogtag.sqf b/addons/dogtags/functions/fnc_canCheckDogtag.sqf index 2c46fe30e6..a05629c72f 100644 --- a/addons/dogtags/functions/fnc_canCheckDogtag.sqf +++ b/addons/dogtags/functions/fnc_canCheckDogtag.sqf @@ -17,4 +17,4 @@ params ["_player", "_target"]; if (isNull _target) exitWith {false}; -!alive _target || _target getVariable ["ACE_isUnconscious", false] +(!alive _target) || {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/dogtags/functions/fnc_canTakeDogtag.sqf b/addons/dogtags/functions/fnc_canTakeDogtag.sqf index 8414e35c31..b8279144bb 100644 --- a/addons/dogtags/functions/fnc_canTakeDogtag.sqf +++ b/addons/dogtags/functions/fnc_canTakeDogtag.sqf @@ -17,4 +17,4 @@ params ["_player", "_target"]; if (isNull _target) exitWith {false}; -!alive _target || _target getVariable ["ACE_isUnconscious", false] +(!alive _target) || {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/dogtags/functions/fnc_checkDogtag.sqf b/addons/dogtags/functions/fnc_checkDogtag.sqf index a247d24312..6345871f02 100644 --- a/addons/dogtags/functions/fnc_checkDogtag.sqf +++ b/addons/dogtags/functions/fnc_checkDogtag.sqf @@ -15,7 +15,7 @@ params ["_player", "_target"]; -private _doubleTags = !(_target getVariable [QGVAR(dogtagTaken), false]); +private _doubleTags = (_target getVariable [QGVAR(dogtagTaken), objNull]) != _target; private _dogTagData = [_target] call FUNC(getDogTagData); [QGVAR(showDogtag), [_dogTagData, _doubleTags]] call CBA_fnc_localEvent; diff --git a/addons/dogtags/functions/fnc_getDogtagItem.sqf b/addons/dogtags/functions/fnc_getDogtagItem.sqf index cdcb8eab6f..aee57b31e3 100644 --- a/addons/dogtags/functions/fnc_getDogtagItem.sqf +++ b/addons/dogtags/functions/fnc_getDogtagItem.sqf @@ -23,7 +23,7 @@ private _allDogtagDatas = missionNamespace getVariable [QGVAR(allDogtagDatas), [ private _nextID = count _allDogtags + 1; -if (_nextID > 999) exitWith {}; +if (_nextID > 999) exitWith {ACE_LOGERROR("Ran out of IDs");}; private _dogTagData = [_target] call FUNC(getDogTagData); private _item = format ["ACE_dogtag_%1", _nextID]; diff --git a/addons/dogtags/functions/fnc_takeDogtag.sqf b/addons/dogtags/functions/fnc_takeDogtag.sqf index 585f89b697..e8c93a985d 100644 --- a/addons/dogtags/functions/fnc_takeDogtag.sqf +++ b/addons/dogtags/functions/fnc_takeDogtag.sqf @@ -16,9 +16,9 @@ params ["_player", "_target"]; -if (_target getVariable [QGVAR(dogtagTaken), false]) then { +if ((_target getVariable [QGVAR(dogtagTaken), objNull]) == _target) then { [localize LSTRING(dogtagAlreadyTaken)] call EFUNC(common,displayText); } else { - _target setVariable [QGVAR(dogtagTaken), true, true]; + _target setVariable [QGVAR(dogtagTaken), _target, true]; [QGVAR(getDogtagItem), [_player, _target]] call CBA_fnc_serverEvent; };