diff options
| author | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:57:23 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:57:23 +0300 |
| commit | 3533c3aa9393fc6350178b196c813dc636ec9cf6 (patch) | |
| tree | 2f96a879c3935dea18e73410926b03c7eef1a751 /Server/Functions/Server_CreateTeam.sqf | |
| download | a2wf_isladuala-3533c3aa9393fc6350178b196c813dc636ec9cf6.tar.gz a2wf_isladuala-3533c3aa9393fc6350178b196c813dc636ec9cf6.tar.bz2 a2wf_isladuala-3533c3aa9393fc6350178b196c813dc636ec9cf6.zip | |
init
Diffstat (limited to 'Server/Functions/Server_CreateTeam.sqf')
| -rw-r--r-- | Server/Functions/Server_CreateTeam.sqf | 47 |
1 files changed, 47 insertions, 0 deletions
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 |
