Attempt on making blood type and service number unique for players

This commit is contained in:
esteldunedain 2016-06-20 16:45:34 -03:00
parent 6df82aad55
commit 88cf6aad98

View File

@ -19,13 +19,24 @@ private _dogTagData = _target getVariable QGVAR(dogtagData);
if (!isNil "_dogTagData") exitWith {_dogTagData};
// Create dog tag data once for the unit: nickname, code (eg. 135-13-900) and blood type
private ["_bloodTypeIndex", "_code"];
//hint getplayeruid _target;
if ((typename getplayeruid _target) == "SCALAR") then {
_bloodTypeIndex = (getplayeruid _target) mod 8;
_code = (str getplayeruid _target) select [0, 3] + "-" +
(str getplayeruid _target) select [3, 2] + "-" +
(str getplayeruid _target) select [5, 3];
} else {
_bloodTypeIndex = floor random 8;
_code = str(floor random 9) + str(floor random 9) + str(floor random 9) + "-" +
str(floor random 9) + str(floor random 9) + "-" +
str(floor random 9) + str(floor random 9) + str(floor random 9);
};
private _dogTagData = [
[_target, false, true] call EFUNC(common,getName),
str(floor random 9) + str(floor random 9) + str(floor random 9) + "-" +
str(floor random 9) + str(floor random 9) + "-" +
str(floor random 9) + str(floor random 9) + str(floor random 9),
selectRandom ["O POS", "O NEG", "A POS", "A NEG", "B POS", "B NEG",
"AB POS", "AB NEG"]
_code,
["O POS", "O NEG", "A POS", "A NEG", "B POS", "B NEG",
"AB POS", "AB NEG"] select _bloodTypeIndex
];
// Store it
_target setVariable [QGVAR(dogtagData), _dogTagData, true];