Arma 3
Zombies and Demons
Zombience.sqf




// hint "0";
_i = [] spawn {


_maxZombies = 5;
_distance = 50;
_addMed =1;

_ZombiesSlow= ["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"];
_ZombiesFast = ["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 _ZombiesSlow;
_mZedsNum = count _ZombiesFast;
_startTime = time;
_initialBurst = 4;
_spawnTroops = true;

// hint "1";
AttackGroup = createGroup east;
while { _spawnTroops } do
{
// hint "2";
if( count units AttackGroup < _maxZombies) then
{
// hint "3";

_fastSlow = random 3;


_ZedType = _ZombiesSlow select (floor ( random _sZedsNum ));

if ( _fastSlow > 2 and _addMed == 1) then
{
_ZedType =_ZombiesFast 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;
};

_posY = 50 + random _distance;
_posX = 50 + random _distance;

_posY = _posY * _plusY;
_posX = _posX * _plusX;


spawnPos = getPos Player;
spawnPos = [(spawnPos select 0) + _posX, (spawnPos select 1) + _posY, 0];
objPos = getPos Player;

// hint "4";
unit1 = AttackGroup createUnit [_ZedType, spawnPos, [], 1, "FORM"];
// hint "5";


wp = AttackGroup addWaypoint [objPos,0];
wp setWaypointSpeed "Full";
wp setWaypointType "MOVE";
wp setWaypointBehaviour "COMBAT";


};
if( !Alive player) then
{
_spawnTroops = false;
};
sleep 30;
};
};

Last edited by CaptainMittens; 3 Nov, 2015 @ 8:31am
< >
Showing 16-30 of 30 comments
Coul 24 Nov, 2015 @ 7:31pm 
zombies will spawn around the player
CaptainMittens 26 Nov, 2015 @ 7:36pm 
Paste this into initPlayerLocal.sqf
Bl2ck Dog 12 Dec, 2016 @ 11:47pm 
/*///////////////////////////////////////////////////////// // // // Ambient Zombies Script for Ryan's Zombies and Demons // // by -CML-CaptainMittens, edit by Bl2ck Dog [3Para] // // v0.85 // // // // Place in initPlayerLocal.sqf // // // /////////////////////////////////////////////////////////*/ 0 = [] spawn { sleep 10; private ["_maxZeds","_minDist","_maxDist","_addMed","_ZedsSlow","_ZedsFast","_sZedsNum","_mZedsNum","_fastSlow","_ZedType","_plusX","_plusY"]; _minDist = 50; _maxDist = 50; _addMed = 1; _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 { // 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 = 9 - (count allPlayers)} else {_maxZeds = 4}; // 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 = (_minDist + random _maxDist) * _plusX; _posY = (_minDist + random _maxDist) * _plusY; while {true} do { //selecting position sleep 1; spawnPos = getPos player; spawnPos = [(spawnPos select 0) + _posX, (spawnPos select 1) + _posY,0]; objPos = getPos Player; // Spawning zombie if ({_x distance2D spawnPos < (_minDist*0.75)} count allPlayers == 0) exitWith { 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) || !(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 10; }; };
Last edited by Bl2ck Dog; 15 Dec, 2016 @ 4:09pm
CaptainMittens 13 Dec, 2016 @ 10:52am 
Good stuff dude! Thanks for posting your improvements.
thevault88 13 Dec, 2016 @ 11:11am 
Nice script!.
Bl2ck Dog 14 Dec, 2016 @ 7:41am 
UPD Now before spawning zombie script checks if there is any other players near spawn position, if there is - new position selected, until clean spot found. This to prevent group of players spawning zombies next to each other.

UPD2 Added zombies to player ratio check: more players = less zombies per player, to keep net load balanced.

UPD3 Added check if group still present, to keep zombies spawning after all were dead at same time.
Last edited by Bl2ck Dog; 15 Dec, 2016 @ 4:03pm
ChewyBullets 15 Jan, 2017 @ 9:01am 
wp = zAmbientGroup addWaypoint [objPos,0];
wp setWaypointSpeed "Full";
wp setWaypointType "MOVE";
wp setWaypointBehaviour "COMBAT";
sleep 10;
};
};

I edited the last "sleep 10;" and changed it to "sleep 600". Made 2 other copies of the .sqf and renamed them. The scripts fire off in triggers at the start of the mission and will spawn 3 zombies every 9 mins around player.


@-CML-CaptainMittens or @Bl2ck dog

How can i get this script to spawn CSAT and fire at player. They will spawn but wont fire at player. I have tried changing behaviour etc but it wont fire at player.

Last edited by ChewyBullets; 15 Jan, 2017 @ 9:04am
CaptainMittens 15 Jan, 2017 @ 8:05pm 
Idk, if you replace the zombie unit types with CSAT units it should work, are they spawning with weapons? And is the player hostile to them?
Bl2ck Dog 16 Jan, 2017 @ 7:39am 
Also check this thread https://forums.bistudio.com/topic/182412-zombies-demons-46/?page=50#comment-3138998 Johnny Drama made some fixes to the script (zombies were spawning in the corners of the square).
CaptainMittens 16 Jan, 2017 @ 3:13pm 
Awesome stuff, when I originally wrote this script it was a one off deal for a mission I was making, but it's cool to see that it's benefitting people!
Goro 15 Apr, 2017 @ 3:45am 
Hi, Captain!
I've added you, as I do have several questions regaarding the zombie ambience you've written. Hopefully we'll be able to sort this out fairly quickly!
Diara 23 Apr, 2017 @ 11:38pm 
Thank you so much -CML-CaptainMittens for your work and sharing it here, this is an very neat script!

also this is the part for independent zombies:

_ZombiesSlow= ["RyanZombieC_man_1Slow","RyanZombieC_man_polo_1_FSlow","RyanZombieC_man_pilot_FSlow","RyanZombieC_journalist_FSlow","RyanZombieC_OrestesSlow","RyanZombieC_NikosSlow","RyanZombieC_man_polo_2_FSlow","RyanZombieC_man_polo_4_FSlow","RyanZombieC_man_polo_5_FSlow","RyanZombieC_man_polo_6_FSlow","RyanZombieC_man_p_fugitive_FSlow","RyanZombieC_man_w_worker_FSlow","RyanZombieC_scientist_FSlow","RyanZombieC_man_hunter_1_FSlow"];
_ZombiesFast = ["RyanZombieC_man_1Medium","RyanZombieC_man_polo_1_FMedium","RyanZombieC_man_pilot_FMedium","RyanZombieC_journalist_FMedium","RyanZombieC_OrestesMedium","RyanZombieC_NikosMedium","RyanZombieC_man_polo_2_FMedium","RyanZombieC_man_polo_4_FMedium","RyanZombieC_man_polo_5_FMedium","RyanZombieC_man_polo_6_FMedium","RyanZombieC_man_p_fugitive_FMedium","RyanZombieC_man_w_worker_FMedium","RyanZombieC_scientist_FMedium","RyanZombieC_man_hunter_1_FMedium"];


basically you just have to delete opfor..

Last edited by Diara; 23 Apr, 2017 @ 11:39pm
Rex35game 2 Aug, 2017 @ 5:41am 
It makes zombies dynamically spawn ?
CaptainMittens 2 Aug, 2017 @ 6:53pm 
Yeah, So, when the script is launched, zombies spawn around the player who ran the script. So you can put it in "init.sqf" or initplayerLocal.sqf
Or you can have a trigger that calls it once players enter an infected area or whatever.
Rex35game 3 Aug, 2017 @ 2:56am 
okay thanks)
< >
Showing 16-30 of 30 comments
Per page: 1530 50