Jump to content

[Help]Ravage ambient AI script using Ryan's zombies

Recommended Posts

I tried using ALiVE mod for it but the AI becomes a bit more clunky just standing in place most of the time and they only spawn in groups and using civilian pop to spawn them individually keeps all the zeds inside the buildings. Ravage zeds don't attack vehicles which is a huge problem. 


Also making heads burst is fun :D


tl:dr Is there a script similar to what Ravage mod uses to spawn ambient AI that I can use for Ryans Zombies?

Share this post

Link to post
Share on other sites

try this. I changed it to use independent zombies instead of opfor

// https://forums.bistudio.com/forums/topic/182412-zombies-demons-50/?page=50#comment-3119928  //
// 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 initPlayerLocal.sqf                                                              //

// _spawner = execVM "spawn.sqf"
// _spawner = execVM "spawn.sqf"
0 = [] spawn {
  sleep 5;

  private ["_maxZeds","_minDist","_maxDist","_addMed","_ZedsSlow","_ZedsFast","_sZedsNum","_mZedsNum","_fastSlow","_ZedType","_plusX","_plusY"];
  _minDist = 150;
  _maxDist = 50;
  _addMed = 1;

  _ZedsSlow = ["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"];
  _ZedsFast = ["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"];
  _sZedsNum = count _ZedsSlow;
  _mZedsNum = count _ZedsFast;
  zAmbientGroup = createGroup resistance;

  // 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 = 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 = 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 {
        //selecting position
        sleep 1;
        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) || !(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;


It may take you some time to get it to work and sometimes it doesnt work straight away. 


I also found this if you want the ryan zombies to drop some loot when they die


//NOTE How to use
So this script will check for all Rifles (Includes all LMG's, Sniper rifles etc.), Items (Clothing, Medikits etc.),
pistols, launchers and finally magazines for that stuff ... Including from any mod you might have installed like CUP,
no need to adjust from your side.

These will be written in 5 corresponding Arrays


The tricky part is executing it in multiplayer.. In Singleplayer you can just add it into the init.sqf and done..
The Array's will be accessible from your client/server.. but If you want to play in in multiplayer and use Eden for
your zombie spawns and settings you have to add the script into the init of the loot module "RyanZM_ModuleLootSettings"
 (call the script not type it in there plz).

 nul = [] execVM "randomLootArrays.sqf"

Then you just have to delete the standard fields for example Items (Civilians): [] and replace the [] with the
corresponding array you want to be spawned.. like itemArray.

This script is not perfect and needs some work as it will have some errors with spawning a few
items when you kills Zombies and then will show and error message whilest picking from the array.
The basic function works fine though and performance isn't in any case worse with it..
Zombies drop completly randomized items - works like a charm!

if someone is willing to help me I would be very glad! Enjoy your random spawning :)


pistolArray = [];
rifleArray = [];
magazineArray = [];
itemArray = [];
launcherArray = [];

// Check for Rifles, Items, Pistols, Launchers
_cfgWeapons = "true" configClasses (configFile >> "cfgWeapons");

    _weaponString = configName (_x);
    _parents = [_x,true] call BIS_fnc_returnParents;

    if ("Rifle" in _parents) then {
        rifleArray append [_weaponString];

    if ("ItemCore" in _parents) then {
        itemArray append [_weaponString];

    if ("Pistol" in _parents) then {
        pistolArray append [_weaponString];

    if ("Launcher" in _parents) then {
        launcherArray append [_weaponString];
} forEach _cfgWeapons;

//Check for Magazines

_cfgWeapons = "true" configClasses (configFile >> "cfgMagazines");

    _weaponString = configName (_x);
    _parents = [_x,true] call BIS_fnc_returnParents;

    if (("CA_Magazine" in _parents) && !("VehicleMagazine" in _parents)) then {
        magazineArray append [_weaponString];

} forEach _cfgWeapons;

// Automation process end

//hint format ["%1", rifleArray];


Just put 1 or 2 items/weapons for them to drop or it gets a bit weird.


I use ravage modules with the ryan zombies but i dont use ravage zombies. You can even get the zombience to spawn from a trigger or even add blacksites so they dont spawn inside if you can figure it out

Share this post

Link to post
Share on other sites

You can also use enigmas script to spawn in ambient Ai. 

Just change the people and faction/side to which ever one you want to use. I have one for each faction. Then you can use the ravage random loot command to give them a random load out.   ["ON_UNIT_SPAWNED_CALLBACK", {call rvg_fnc_equip}]


"Call rvg_fnc_equip" this, without quotes, can also be used for the player or any npc added to the game. Just depends where you put it. Place it in "initPlayerLocal.sqf" to give player random loot on spawn or put it in "onPlayerRespawn.sqf" to give you random loot when you die and respawn.


Hope i could help and Sorry i didnt see your thread earlier

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now