summaryrefslogtreecommitdiffstats
path: root/Server/Functions/Server_PlaceJoiningUnit.sqf
blob: 99deb6343aca3178793263a8fe0b45c03e23ffe7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Private ["_buildings","_hq","_placeAt","_side","_unit"];

_unit = _this select 0;
_side = _this select 1;

waitUntil {!isNil Format["%1StartingLocation",str _side]};

_buildings = (str _side) Call GetSideStructures;
_hq = (str _side) Call GetSideHQ;

_placeAt = objNull;
if (count _buildings > 0) then {
	_placeAt = ([_hq, _buildings] Call SortByDistance) select 0;
} else {
	_placeAt = _hq;
};

_unit setPos ([getPos _placeAt,20,30] Call GetRandomPosition);