mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
add function to report a blood type which is fixed to the units name
This commit is contained in:
parent
6df82aad55
commit
c88313221f
@ -1,5 +1,6 @@
|
||||
PREP(addDogtagActions);
|
||||
PREP(addDogtagItem);
|
||||
PREP(bloodType);
|
||||
PREP(canCheckDogtag);
|
||||
PREP(canTakeDogtag);
|
||||
PREP(checkDogtag);
|
||||
|
24
addons/dogtags/functions/fnc_bloodType.sqf
Normal file
24
addons/dogtags/functions/fnc_bloodType.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Reports a blood type depending on the units name.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Name of a unit <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* A random blood type <STRING>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define BLOOD_TYPES ["O POS", "O NEG", "A POS", "A NEG", "B POS", "B NEG", "AB POS", "AB NEG"]
|
||||
|
||||
params ["_name"];
|
||||
|
||||
private _num = 0;
|
||||
private _count = {_num = _num + _x} count toArray _name;
|
||||
|
||||
_num = _num + _count;
|
||||
|
||||
BLOOD_TYPES select (_num % count BLOOD_TYPES)
|
@ -19,13 +19,14 @@ 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 _targetName = [_target, false, true] call EFUNC(common,getName);
|
||||
|
||||
private _dogTagData = [
|
||||
[_target, false, true] call EFUNC(common,getName),
|
||||
_targetName,
|
||||
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"]
|
||||
_targetName call FUNC(bloodType)
|
||||
];
|
||||
// Store it
|
||||
_target setVariable [QGVAR(dogtagData), _dogTagData, true];
|
||||
|
Loading…
Reference in New Issue
Block a user