Advertisement
Guest User

Untitled

a guest
Jan 10th, 2017
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 4.70 KB | None | 0 0
  1.  
  2.  
  3. /*/////////////////////////////////////////////////////////
  4. //                                                       //
  5. // Zombience.sqf                                         //
  6. // Ambient Zombies Script for Ryan's Zombies and Demons  //
  7. // by -CML-CaptainMittens, edit by Bl2ck Dog [3Para]     //
  8. // v0.86 (Johnny Drama Edition)                          //
  9. //                                                       //
  10. // Start from onPlayerRespawn.sqf                        //
  11. //                                                       //
  12. /////////////////////////////////////////////////////////*/
  13.  
  14. // _spawner = execVM "spawn.sqf"
  15. // hintC "SPAWNER STARTED";
  16. 0 = [] spawn {
  17.   sleep 5;
  18.  
  19.   private ["_maxZeds","_minDist","_maxDist","_addMed","_ZedsSlow","_ZedsFast","_sZedsNum","_mZedsNum","_fastSlow","_ZedType","_plusX","_plusY"];
  20.   _minDist = 150;
  21.   _maxDist = 50;
  22.   _addMed = 1;
  23.  
  24.   _ZedsSlow= ["RyanZombieC_man_1SlowOpfor","RyanZombieC_man_polo_1_FSlowOpfor","RyanZombieC_man_pilot_FSlowOpfor","RyanZombieC_journalist_FSlowOpfor","RyanZombieC_OrestesSlowOpfor","RyanZombieC_NikosSlowOpfor","RyanZombieC_man_polo_2_FSlowOpfor","RyanZombieC_man_polo_4_FSlowOpfor","RyanZombieC_man_polo_5_FSlowOpfor","RyanZombieC_man_polo_6_FSlowOpfor","RyanZombieC_man_p_fugitive_FSlowOpfor","RyanZombieC_man_w_worker_FSlowOpfor","RyanZombieC_scientist_FSlowOpfor","RyanZombieC_man_hunter_1_FSlowOpfor"];
  25.   _ZedsFast = ["RyanZombieC_man_1MediumOpfor","RyanZombieC_man_polo_1_FMediumOpfor","RyanZombieC_man_pilot_FMediumOpfor","RyanZombieC_journalist_FMediumOpfor","RyanZombieC_OrestesMediumOpfor","RyanZombieC_NikosMediumOpfor","RyanZombieC_man_polo_2_FMediumOpfor","RyanZombieC_man_polo_4_FMediumOpfor","RyanZombieC_man_polo_5_FMediumOpfor","RyanZombieC_man_polo_6_FMediumOpfor","RyanZombieC_man_p_fugitive_FMediumOpfor","RyanZombieC_man_w_worker_FMediumOpfor","RyanZombieC_scientist_FMediumOpfor","RyanZombieC_man_hunter_1_FMediumOpfor"];
  26.   _sZedsNum = count _ZedsSlow;
  27.   _mZedsNum = count _ZedsFast;
  28.   zAmbientGroup = createGroup east;
  29.  
  30.   // Checking if player alive
  31.   while {alive player} do {
  32.  
  33.     if (!(vehicle player isKindOf "Helicopter")) then { //Jets check
  34.     // Checking if group is present
  35.     if (isNull zAmbientGroup) then {zAmbientGroup = createGroup east};
  36.  
  37.     // Selecting number of zeds, more players - less zombies, too keep net load balanced.
  38.     if ((count allPlayers) < 5) then {_maxZeds = 9 - (count allPlayers)} else {_maxZeds = 4};
  39.    
  40.     // Checking if limit reached
  41.     if (count units zAmbientGroup < _maxZeds) then {   
  42.      
  43.       // Selecting type and position
  44.       _fastSlow = (floor(random 3))+1;
  45.       _ZedType = _ZedsSlow select (floor(random _sZedsNum ));
  46.  
  47.       if ( _fastSlow > 2 and _addMed == 1) then {
  48.         _ZedType =_ZedsFast select (floor(random _mZedsNum ));
  49.       };
  50.  
  51.       _plusX = random 2;
  52.       if (_plusX > 1) then {_plusX = 1};
  53.       if (_plusX < 1) then {_plusX = -1};
  54.  
  55.       _plusY = random 2;
  56.       if (_plusY > 1) then {_plusY = 1};
  57.       if (_plusY < 1) then {_plusY = -1};
  58.  
  59.       _posX = 0;
  60.       _posY = 0;
  61.      
  62.       _random = [1,2,3] call BIS_fnc_selectRandom;
  63.  
  64.       if (_random == 1) then {        
  65.         _posX = (_minDist + random _maxDist) * _plusX;  //150-200 * +-1
  66.         _posY = (random (_minDist + _maxDist)) * _plusY;  //0-200 * +-1
  67.       };
  68.       if (_random == 2) then {        
  69.         _posX = (random (_minDist + _maxDist)) * _plusX; //0-200 * +-1
  70.         _posY = (_minDist + random _maxDist) * _plusY; //150-200 * +-1
  71.       };
  72.       if (_random == 3) then {        
  73.         _posX = (_minDist + random _maxDist) * _plusX; //150-200 * +-1
  74.         _posY = (_minDist + random _maxDist) * _plusY; //150-200 * +-1
  75.       };
  76.      
  77.         objPos = getPos Player;
  78.       while {!(player inArea "protection_zone")} do {
  79.         //selecting position
  80.         sleep 1;
  81.         spawnPos = getPos player;
  82.         spawnPos = [(spawnPos select 0) + _posX, (spawnPos select 1) + _posY,0];      
  83.        
  84.         // Spawning zombie
  85.         if ({_x distance2D spawnPos < (_minDist*0.75)} count allPlayers == 0) exitWith { //0.75*150 =112,5 real minimum distance
  86.           zUnit = zAmbientGroup createUnit [_ZedType,spawnPos,[],1,"NONE"];
  87.         };
  88.       };
  89.     };
  90.     //Checking if zombie is dead or player moved too far
  91.     {if (((player distance2D _x) > (_minDist+_maxDist)*1.5) || !(alive _x)) then {deleteVehicle _x}} forEach units zAmbientGroup;
  92.     // Removing oldest waypoint
  93.     while {(count (waypoints zAmbientGroup)) > 1} do {deleteWaypoint ((waypoints zAmbientGroup) select 0)};
  94.     // Adding waypoint
  95.     wp = zAmbientGroup addWaypoint [objPos,0];
  96.     wp setWaypointSpeed "Full";
  97.     wp setWaypointType "MOVE";
  98.     wp setWaypointBehaviour "COMBAT";    
  99.     sleep 1;
  100.   };
  101.   };
  102. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement