Jump to content

zombie spawner


Recommended Posts

hi guy's found some code that spawns zombies i tok some code out put some in not my work who every made credits go to you, 

 nice let admins spawn there own zombies.

step 1. make a file called admin_start.sqf  can run the script from your pc if you got infistar

step 2. put the file in yr arma oa folder the put this code in to it and save it

step 3. log in your server press alt+f11 at the same time one zombie spawned 

you can eddit the code with out restating your server or game

 

note this is not my work i just made it so zombies spawns when you want them to

 

private ["_position","_doLoiter","_unitTypes","_loot","_array","_agent","_type","_radius","_method","_myDest","_newDest","_lootType","_isAlive","_rnd","_id"];
_unitTypes = ["z_worker3", "z_worker2", "z_worker1", "z_villager1", "z_villager2", "z_villager3", "z_worker3", "z_worker2", "z_worker1", "z_villager1", "z_villager2", "z_villager3", "z_worker3", "z_worker2", "z_worker1", "z_villager1", "z_villager2", "z_villager3"];
_doLoiter =     true;

_loot =     "";
_array =     [];
_agent =     objNull;

_type = _unitTypes call BIS_fnc_selectRandom;

// __radius = 30; how far want them to spawn

_radius = 30;
_method = "NONE";

_position = position player;

_agent = createAgent [_type, _position, [], _radius, _method];

if (_doLoiter) then {
    _agent setDir round(random 180);
};

dayz_spawnZombies = dayz_spawnZombies + 1;

if (random 1 > 0.7) then {
    _agent setUnitPos "Middle";
};

if (isNull _agent) exitWith {
    dayz_spawnZombies = dayz_spawnZombies - 1;
};

_isAlive = alive _agent;

_myDest = getPosATL _agent;
_newDest = getPosATL _agent;
_agent setVariable ["myDest",_myDest];
_agent setVariable ["newDest",_newDest];

//Add some loot
_rnd = random 1;
if (_rnd > 0.3) then {
    _lootType =         configFile >> "CfgVehicles" >> _type >> "zombieLoot";
    if (isText _lootType) then {
        _array = []+ getArray (configFile >> "cfgLoot" >> getText(_lootType));
        if (count _array > 0) then {
            _loot = _array call BIS_fnc_selectRandomWeighted;
            if(!isNil "_array") then {
                _agent addMagazine _loot;
            };
        };
    };
};

_id = [_position,_agent] execFSM "\z\AddOns\dayz_code\system\zombie_agent.fsm";

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...