Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 2.88 KB | None | 0 0
  1. _startWest = [];
  2. _startEast = [];
  3.  
  4. if ( fixedStartPos == 0 ) then
  5. {
  6.     _s = [startLocWest, startLocEast];
  7.     _r = random(1);
  8.  
  9.     _startWest = _s select (_r < 0.5);
  10.     _startEast = _s select (_r >= 0.5);
  11.  
  12. }
  13. else
  14. {
  15.     _startpositions = [];
  16.     _startlocs = [];
  17.  
  18.     if ( fixedStartPos == 1 ) then
  19.     {
  20.         _startlocs = startLocsAirfields;
  21.     }
  22.     else
  23.     {
  24.         _startlocs = startLocsRandom;
  25.     };
  26.  
  27.     _count = count _startlocs;
  28.     _radiusfac = 1.5;
  29.  
  30.     while {count(_startpositions) < 4}do
  31.     {
  32.         for [ {_j=0}, {_j<_count}, {_j=_j+1}] do
  33.         {
  34.             _x = _startlocs select _j;
  35.  
  36.             _nextTownDist = ([getPos _x, [siWest,siEast,siRes], []] call funcGetClosestTown) select 1;
  37.  
  38.             if ( ((getPos _x) distance posCenter) < (townsRadius * _radiusfac) && _nextTownDist < (1500*_radiusFac)) then
  39.             {
  40.                 _startpositions = _startpositions + [_x];
  41.             };
  42.  
  43.         };
  44.         _radiusfac = _radiusfac + 1.0;
  45.     };
  46.  
  47.     if ( CRCTIDEBUG ) then
  48.     {
  49.         {
  50.             _marker = format["StartPos_%1", _forEachIndex];
  51.             createMarker [_marker, getPos _x ];
  52.             _marker setMarkerType "mil_flag";
  53.             _marker setMarkerColor "colorRed";
  54.         }forEach _startpositions;
  55.     };
  56.  
  57.     _startPos = [_startPositions select 0, _startPositions select 0];
  58.     _startPosTuples = [];
  59.  
  60.     {
  61.         _pos1 = _x;
  62.         {
  63.             _pos2 = _x;
  64.             if ( _pos1 != _pos2 ) then
  65.             {
  66.                 _startPosTuples = _startPosTuples + [[_pos1, _pos2, _pos1 distance _pos2]];
  67.             };
  68.         }forEach _startPositions;
  69.     }forEach _startPositions;
  70.  
  71.     _startPosTuples = [2, true, _startPosTuples] call funcSort;
  72.  
  73.     // Completely Random (for Airfields and Random)
  74.     _startIdx = 0;
  75.     _countIdx = floor(random(count(_startPosTuples)));
  76.  
  77.     // Near
  78.     if ( fixedStartPos == 3 ) then
  79.     {
  80.         _startIdx = 0;
  81.         _countIdx = floor(random(count(_startPosTuples) * 0.33));
  82.     };
  83.     // Medium
  84.     if ( fixedStartPos == 4 ) then
  85.     {
  86.         _startIdx = floor(count(_startPosTuples) * 0.33);
  87.         _countIdx = floor(random(count(_startPosTuples) * 0.33));
  88.     };
  89.     // Far
  90.     if ( fixedStartPos == 5 ) then
  91.     {
  92.         _startIdx = floor(count(_startPosTuples) * 0.66);
  93.         _countIdx = floor(random(count(_startPosTuples) * 0.33));
  94.     };
  95.     // Maximum separation
  96.     if ( fixedStartPos == 6 ) then
  97.     {
  98.         _startIdx = count(_startPosTuples) - 1;
  99.         _countIdx = 0;
  100.     };
  101.  
  102.     _startPos = _startPosTuples select (_startIdx + _countIdx);
  103.  
  104.     _r = random(1);
  105.  
  106.     _startWest = _startPos select (_r < 0.5);
  107.     _startEast = _startPos select (_r >= 0.5);
  108.  
  109. };
  110.  
  111. _posWest = getPos _startWest;
  112. _dirWest = getDir _startWest;
  113. [utMHQWest, 0, 0, 0, _posWest, _dirWest, siWest, -1, tempGroupWest, "NONE",false, false] call funcAddUnit;
  114.  
  115. _posEast = getPos _startEast;
  116. _dirEast = getDir _startEast;
  117. [utMHQEast, 0, 0, 0, _posEast, _dirEast, siEast, -1, tempGroupEast, "NONE",false, false] call funcAddUnit;
  118.  
  119. [_posWest, _dirWest, _posEast, _dirEast] execVM "Server\PlaceStartVehicles.sqf";
  120.  
  121. {
  122.     deleteVehicle _x;
  123. }forEach ([startLocWest, startLocEast] + startLocsAirfields + startLocsRandom) - [objNull];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement