Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- File: randomize_equipment.sqf
- Author: pettka, modified for a different purpose by "ante"
- Description:
- Randomizes a headgear form _headgear array and puts it to civilian's headgear slot upon startup of mission.
- _rnd1 is used to have some civilians without any headgear
- _rnd2 is used to determine particular headgear from array
- Parameter(s):
- None
- Returns:
- Nothing
- */
- _uniform = ["FDC_Uniform_Blue","FDC_Uni_Cam_Blue"];
- _headgear = ["FDC_Helmet_Blue"];
- _vest = ["FDC_Vest_Blue"];
- _headCount = count _headgear;
- _uniformCount = count _uniform;
- _vestCount = count _vest;
- /*_gogglesCount = count_goggles;*/
- if (isServer) then {
- BIS_randomSeed1 = [];
- BIS_randomSeed2 = [];
- _rnd1 = floor random _uniformCount;
- _this setVariable ["BIS_randomSeed1", _rnd1, TRUE];
- _rnd2 = floor random _headCount;
- _this setVariable ["BIS_randomSeed2", _rnd2, TRUE];
- };
- waitUntil {!(isNil {_this getVariable "BIS_randomSeed1"})};
- waitUntil {!(isNil {_this getVariable "BIS_randomSeed2"})};
- _randomSeed1 = _this getVariable "BIS_randomSeed1";
- _randomSeed2 = _this getVariable "BIS_randomSeed2";
- // Anything magazine based, ammo and such
- _magazines = magazines _this;
- // Medkits, ToolKits etc.
- _items = items _this;
- // NVG's, GPS etc.
- _assitems = assignedItems _this;
- // Make him naked
- Removeuniform _this;
- // Remove helmets and such
- Removeheadgear _this;
- // Remove glasses and such
- RemoveGoggles _this;
- // Add uniform
- _this adduniform (_uniform select _randomSeed1);
- // Add helmet
- _this addheadgear (_headgear select _randomSeed2);
- // Add vest
- _this addvest (_vest select (((_randomSeed1 + _randomSeed2) % (_vestCount - 1)) * (floor random _vestCount) % (_vestCount + 1 )));
- {_this addItem _x} forEach _items;
- {_this addMagazine _x} forEach _magazines;
- {_this addItem _x} forEach _assitems;
- {_this assignItem _x} forEach _assitems;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement