From 628d33984d9228f1781d13a65fbb80f35facc899 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:55:24 +0300 Subject: init --- Server/Functions/Server_CreateTeam.sqf | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Server/Functions/Server_CreateTeam.sqf (limited to 'Server/Functions/Server_CreateTeam.sqf') diff --git a/Server/Functions/Server_CreateTeam.sqf b/Server/Functions/Server_CreateTeam.sqf new file mode 100644 index 0000000..83f9151 --- /dev/null +++ b/Server/Functions/Server_CreateTeam.sqf @@ -0,0 +1,47 @@ +Private ['_canCreate','_commander','_crews','_ctype','_driver','_firstDone','_gunner','_list','_lockVehicles','_position','_probability','_side','_team','_type','_unit','_units','_vehicle','_vehicles']; + +_list = _this select 0; +_position = _this select 1; +_side = _this select 2; +_lockVehicles = _this select 3; +_team = _this select 4; +_probability = if (count _this > 5) then {_this select 5} else {-1}; +_units = []; +_vehicles = []; +_crews = []; +_firstDone = false; + +//--- Create a group if none are given as a parameter. +if (isNull _team) then {_team = createGroup _side}; + +_ctype = switch (_side) do {case West: {'WEST'}; case East: {'EAST'}; case Resistance: {'GUER'}; case Civilian: {'CIV'}}; + +//--- Create. +{ + _canCreate = true; + if (_probability != -1) then { + if (random 100 > _probability && _firstDone) then {_canCreate = false}; + _firstDone = true; + }; + + if (_canCreate) then { + if (_x isKindOf 'Man') then { + _unit = [_x,_team,_position,_side] Call CreateMan; + _units = _units + [_unit]; + } else { + _vehicle = [_x,_position,_side,_lockVehicles] Call CreateVehi; + _type = if (_vehicle isKindOf 'Man') then {Format ['WFBE_%1SOLDIER',_ctype] Call GetNamespace} else {if (_vehicle isKindOf 'Air') then {Format ['WFBE_%1PILOT',_ctype] Call GetNamespace} else {Format ['WFBE_%1CREW',_ctype] Call GetNamespace}}; + if (_vehicle emptyPositions 'driver' > 0) then {_driver = [_type,_team,_position,_side] Call CreateMan;_driver moveInDriver _vehicle;_crews = _crews + [_driver]}; + if (_vehicle emptyPositions 'gunner' > 0) then {_gunner = [_type,_team,_position,_side] Call CreateMan;_gunner moveInGunner _vehicle;_crews = _crews + [_gunner]}; + if (_vehicle emptyPositions 'commander' > 0) then {_commander = [_type,_team,_position,_side] Call CreateMan;_commander moveInCommander _vehicle;_crews = _crews + [_commander]}; + _vehicles = _vehicles + [_vehicle]; + }; + }; +} forEach _list; + +//--- Add vehicles. +{ + _team addVehicle _x; +} forEach _vehicles; + +[_units,_vehicles,_team,_crews] \ No newline at end of file -- cgit v1.3.1