Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*/////////////////////////////////////////////////////////
- // //
- // Zombience.sqf //
- // Ambient Zombies Script for Ryan's Zombies and Demons //
- // by -CML-CaptainMittens, edit by Bl2ck Dog [3Para] //
- // v0.86 (Johnny Drama Edition) //
- // //
- // Start from onPlayerRespawn.sqf //
- // //
- /////////////////////////////////////////////////////////*/
- // _spawner = execVM "spawn.sqf"
- // hintC "SPAWNER STARTED";
- 0 = [] spawn {
- sleep 15;
- private ["_maxZeds","_minDist","_maxDist","_addMed","_isWater","_ZedsSlow","_ZedsFast","_sZedsNum","_mZedsNum","_fastSlow","_ZedType","_plusX","_plusY"];
- _minDist = 150;
- _maxDist = 50;
- _addMed = 1;
- _isWater = 0;
- _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"];
- _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"];
- _sZedsNum = count _ZedsSlow;
- _mZedsNum = count _ZedsFast;
- zAmbientGroup = createGroup east;
- // Checking if player alive
- while {alive player} do {
- if (!(vehicle player isKindOf "Helicopter")) then { //Jets check
- // Checking if group is present
- if (isNull zAmbientGroup) then {zAmbientGroup = createGroup east};
- // Selecting number of zeds, more players - less zombies, too keep net load balanced.
- if ((count allPlayers) < 5) then {_maxZeds = 6 - (count allPlayers)} else {_maxZeds = 3};
- // Checking if limit reached
- if (count units zAmbientGroup < _maxZeds) then {
- // Selecting type and position
- _fastSlow = (floor(random 3))+1;
- _ZedType = _ZedsSlow select (floor(random _sZedsNum ));
- if ( _fastSlow > 2 and _addMed == 1) then {
- _ZedType =_ZedsFast select (floor(random _mZedsNum ));
- };
- _plusX = random 2;
- if (_plusX > 1) then {_plusX = 1};
- if (_plusX < 1) then {_plusX = -1};
- _plusY = random 2;
- if (_plusY > 1) then {_plusY = 1};
- if (_plusY < 1) then {_plusY = -1};
- _posX = 0;
- _posY = 0;
- _random = [1,2,3] call BIS_fnc_selectRandom;
- if (_random == 1) then {
- _posX = (_minDist + random _maxDist) * _plusX; //150-200 * +-1
- _posY = (random (_minDist + _maxDist)) * _plusY; //0-200 * +-1
- };
- if (_random == 2) then {
- _posX = (random (_minDist + _maxDist)) * _plusX; //0-200 * +-1
- _posY = (_minDist + random _maxDist) * _plusY; //150-200 * +-1
- };
- if (_random == 3) then {
- _posX = (_minDist + random _maxDist) * _plusX; //150-200 * +-1
- _posY = (_minDist + random _maxDist) * _plusY; //150-200 * +-1
- };
- objPos = getPos Player;
- while {!(player inArea "protection_zone")} do {
- // while {!(player inArea "protection_zone")} do {
- // selecting position
- sleep 5;
- spawnPos = getPos player;
- spawnPos = [(spawnPos select 0) + _posX, (spawnPos select 1) + _posY,0];
- // Spawning zombie
- if ({_x distance2D spawnPos < (_minDist*0.75)} count allPlayers == 0) exitWith { //0.75*150 =112,5 real minimum distance
- zUnit = zAmbientGroup createUnit [_ZedType,spawnPos,[],1,"NONE"];
- };
- };
- };
- //Checking if zombie is dead or player moved too far
- {if (((player distance2D _x) > (_minDist+_maxDist)*1.5)) then {deleteVehicle _x}} forEach units zAmbientGroup; //check for other players aswell!! ; removed: || !(alive _x)
- //{if (((player distance2D _x) > (_minDist+_maxDist)*1.5) || !(alive _x)) then {deleteVehicle _x}} forEach units zAmbientGroup;
- // Removing oldest waypoint
- while {(count (waypoints zAmbientGroup)) > 1} do {deleteWaypoint ((waypoints zAmbientGroup) select 0)};
- // Adding waypoint
- wp = zAmbientGroup addWaypoint [objPos,0];
- wp setWaypointSpeed "Full";
- wp setWaypointType "MOVE";
- wp setWaypointBehaviour "COMBAT";
- sleep 1;
- };
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement