Created
February 23, 2017 10:46
-
-
Save Gummibeer/16bf61f698a8ca5c08717c5c6a038f91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_isSafePos = false; | |
_minDist = 250; | |
_building = objNull; | |
_itterations = 0; | |
_maxItterations = 5; | |
while {!_isSafePos && _itterations < _maxItterations} do { | |
_players = allPlayers - entities "HeadlessClient_F"; | |
_alivePlayers = []; | |
_playerPositions = []; | |
{ | |
if (alive _x) then { | |
_alivePlayers = _alivePlayers + [_x]; | |
_playerPositions = _playerPositions + [getPos _x]; | |
}; | |
} forEach _players; | |
_centerPos = selectRandom _playerPositions; | |
_safePos = [_centerPos, _minDist, 5000, 1, 0, 1, 0, _playerPositions, [_centerPos, _centerPos]] call BIS_fnc_findSafePos; | |
_buildings = nearestObjects [_safePos, ["house"], _minDist]; | |
_building = _buildings select 0; | |
_buildingPos = getPos _building; | |
_minDistanceToAllPlayers = true; | |
{ | |
if((_buildingPos distance _x) < _minDist) { | |
_minDistanceToAllPlayers = false; | |
} | |
} forEach _alivePlayers; | |
_isSafePos = _minDistanceToAllPlayers; | |
_itterations = _itterations + 1; | |
}; | |
_building |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment