Jump to content
McKeighan

[Release] Random Speed Zombies (walking and running)

Recommended Posts

I will start by saying I am assuming everyone reading this knows how to make changes to their mission files and incorporate changes to dayz_code files with the mission files themselves. (using a custom subdirectory). If you need to be walked through this process... perhaps these changes aren't for you  ;)

 

A quick note about speeds...
Your speeds are set with something called "forcespeed" and can be 0,1,2, and anything bigger then 2. 0 is immobile, 1 is super slow movement (looks stupid), 2 is what you're used to seeing out of a loitering zombie, and >2 is running. There IS one number I've found that makes them run faster then players... But it's not scalar. I use 8 for our running zombies, and they run at the normal speed.... Anyway.


Files that need to be altered  (and subsequently moved into your missions folder).
compiles.sqf

The lines you're looking for are similar to the following (around line 76 of the standard Epoch code).

 

	//Zombies
	zombie_findTargetAgent = 	compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_findTargetAgent.sqf";
	zombie_loiter = 			compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_loiter.sqf";			//Server compile, used for loiter behaviour
	zombie_generate = 			compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_generate.sqf";			//Server compile, used for loiter behaviour
	wild_spawnZombies = 		compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\wild_spawnZombies.sqf";			//Server compile, used for loiter behaviour

and should be updated like below (I've always found it easier to mimic the origional epoch code with my directory stucture in my custom area).

        zombie_loiter 			= compile preprocessFileLineNumbers "custom\dayz_code\compile\zombie_loiter.sqf";		
	zombie_generate 		= compile preprocessFileLineNumbers "custom\dayz_code\compile\zombie_generate.sqf";		
	wild_spawnZombies 		= compile preprocessFileLineNumbers "custom\dayz_code\compile\wild_spawnZombies.sqf";		
	

Next... Onto each file in turn.

zombie_loiter.sqf - I've actually left it completely alone, but brought it into my mission file in case I need to tweak anything in the future. 

zombie_generate.sqf - Here's where it gets interesting.

You'll find this near the bottom of the file.

//Disable simulation
		PVDZE_Server_Simulation = [_agent, false];
		publicVariableServer "PVDZE_Server_Simulation";

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

you need to update it to the following.
 

// Set zombie initial walkspeed 
_agent forceSpeed 2; 

// Create random runners 
_rnd = random(1);
if (_rnd > .8) then {
        _isrunner = true;
} else {
	_isrunner = false;
};

//Start behavior
_id = [_position,_agent,_isrunner] execFSM "custom\dayz_code\system\zombie_agent.fsm";
};

you also should update the private variable call at the top of that file to include the _isrunner variable

private ["_position","_unitTypes","_radius","_method","_agent","_isrunner"];

In the wildspawn_zombies.sqf, do simular updates.

 

private ["_unitTypes","_isrunner","_lootType","_lootTypeCfg","_loot_count","_index","_weights","_loot","_array","_player","_doLoiter","_agent","_type","_radius","_method","_position","_isAlive","_myDest","_newDest","_rnd","_id"];

// Slow zombie down.
_agent forceSpeed 2; 
// Create random runners 
_rnd = random(1);
if (_rnd > .8) then {
	_isrunner = true;
} else {
	_isrunner = false;
};

//Start behavior
_id = [_position,_agent,_isrunner] execFSM "custom\dayz_code\system\zombie_agent.fsm";

as you may of surmised, you're not quite done... you also have to edit the zombie_agent.fsm file. 

In the init step (red box at the top of the flowchart), change that coding to the following
 

_position = _this select 0;
_agent = _this select 1;
_secondHand = false;
_isrunner = _this select 2;

if (count _this > 2) then {
	_secondHand = true;
	//diag_log ("Second Hand Zombie Initialized: " + str(_this));
};

in the "chase" box, change the coding to the following.

 

_timeN = time;

if (speed _agent < 0.1) then {_countr = _countr + 1} else {_countr = 0};
_target = _agent call zombie_findTargetAgent;
_targetPosition = getPosATL _target;
_agentPosition = getPosATL _agent;
_targetdistance = _agent distance _target;

//target distance calculation coding provided by the Unleashed Project.

if ( _targetdistance < 2.2 ) then
{_r = 1;};
if (_targetdistance > 2.2 AND _targetdistance < 10) then
{_r = 6;};
if ( _targetdistance > 10 AND _targetdistance < 25 ) then
{_r = 8;};
if ( _targetdistance > 25 ) then
{_r = 15;};

_xt = _targetPosition select 0;
_yt = _targetPosition select 1;
_xa = _agentPosition select 0;
_ya = _agentPosition select 1;
_dx = _xa - _xt;
_dy = _ya - _yt;
_dir = _dy atan2 _dx;
_dx = _dx - _r * cos _dir;
_dy = _dy - _r * sin _dir;
_targetPos = [_xt + _dx, _yt + _dy, 0];

//Move to target
_agent moveTo _targetPos;

//The following code is provided by McKeighan to give random zombies speed.

//flag turns zombie into second hand z once loiter state is re initiated.
_isaggro = true;

//this flag is set in the zombie_generate.sqf / wildzombie_generate.sqf

if (_isrunner) then {
    _agent forceSpeed 8;
} else {
    _agent forceSpeed 2;
};

if (_losCheck == 2) then {
    _losCheck = 0;
    _cantSee = [_agent,_target] call dayz_losCheck;
};


And that's it... You now have Zombies that determine their top speed as soon as they're spawned in, with a 20% chance to be fast.  If you want more to be faster, alter the _rnd check in the wildspawn and zombie generate sqf's.


Clearly, you could do many other things then just do a random chance.

Further development could lead to the following  (all of these are currently in development on my testbed...)

  • Zombie Speed based on skin
  • Zombie Speed based on type of building that spawned them
  • Zombie Speed based on time of day (in game).
  • Zombie Speed based on length of time the zombie has been "alive".

Anyway, hope this makes sense to some of you that have been looking for this solution!
- McK

Share this post


Link to post
Share on other sites

love when modders put a step by step instead of just putting the files edited

recently i added walking zombies but takes out alot of the challenge on the game, becoming pretty boring, tried making zeds hit alot harder like 1 hit 4k hp down but coudnt do it..

gonna try yours later and see how it goes, thx.

Share this post


Link to post
Share on other sites
  • Zombie Speed based on time of day (in game).

This is intriguing. Certainly worth looking at. I'd rather have more walkers during night-time and more runners during the day. I too think this is possible. Thanks muchly for the share...beans.

 

 

Edit to speed assignment (untested).

 

zombie_generate.sqf & wildspawn_zombies.sqf:

// Slow zombie down.
_agent forceSpeed 2;

// Create random runners during daytime only
_rnd = random(1);

if(daytime > 6 || daytime < 18) then {
	if (_rnd > .8) then {
		_isrunner = true;
	} else {
		_isrunner = false;
	};	
} else {
	_isrunner = false;
};

Share this post


Link to post
Share on other sites

 

  •  

This is intriguing. Certainly worth looking at. I'd rather have more walkers during night-time and more runners during the day. I too think this is possible. I will see what I can do...thanks muchly for the share...beans.

 

if (sunOrMoon != 1) then { /* not day */ } else { /* day */ };

Share this post


Link to post
Share on other sites
_position = _this select 0;
_agent = _this select 1;
_secondHand = false;
_isrunner = _this select 2;

if (count _this > 2) then {
	_secondHand = true;
	//diag_log ("Second Hand Zombie Initialized: " + str(_this));
};

You have now made this a secondhand zombie, which means if you did not correct the the movement in Loiter, then all zombies will move towards the player that created them. 

if (_secondHand) then {
	diag_log ("Zombie " + str(_agent) + " Loiter " + " distance: " + str(_newDest distance _myDest));
	_agent doMove (getPosATL player);
	_agent moveTo (getPosATL player);
};

Share this post


Link to post
Share on other sites

The loiter behavior remains the same thevisad (server standard). Within that file, down near the bottom, all loitering zombies are set with a forcespeed of 2. This puts them back into the loiter behavior, and not just wandering around at some silly fast speed.

Because the "fast" zombie is carrying a flag called "_isrunner" - this bumps the speed back up on this zombie each and every time they re-aquire a new target. When they lose targeting, they go back to loiter speed of 2.

I haven't bothered to correct the basic loiter function at all... it works the same as it always had for epoch.   (Where zombies that are created by the player always eventually loiter to them). You could modify loiter speed to being 1, so they move even slower while loitering and take forever to randomly get near the player... but that's up to you guys.


 

Share this post


Link to post
Share on other sites

here's my player_zombieattacks.sqf

It's modified to make ALL zeds hit harder, and with a wider arc of attack. It also pulls the player from the drivers seats of any vehicle that has no windows, or has it's windows down, if they're driving less then 15kph.   I could further change the functioning where a fast zombie might not hit quite as hard as a slow zombie... but could be done.


 

private ["_unit","_move","_damage","_wound","_index","_cnt","_dir","_hpList","_hp","_strH","_dam","_vehicle","_tPos","_zPos","_cantSee","_inAngle","_rnd","_openVehicles","_chance","_attackanimations","_type","_targets"];
_unit = _this select 0;
_type = _this select 1;
_vehicle = (vehicle player);

_targets = _unit getVariable ["targets",[]];

if (!dayz_zedsAttackVehicles && !(_vehicle in _targets)) exitWith { 
	//diag_log ("not attacking vehicle" + str(_vehicle));  
};

if ((speed _vehicle > 15)) exitWith {  // up from 10.
	//diag_log ("too fast abort attack" + str(_vehicle));
};

//Do the attack - ADJUSTING _rnd variable for hit damage? - McK
if (r_player_unconscious && _vehicle == player && _type == "zombie") then {
    _rnd = (round(random 4)) + 1;
	_move = "ZombieFeed" + str(_rnd);
} else {
	if (_type == "zombie") then {
        _rnd = (round(random 9)) + 1;
		_move = "ZombieStandingAttack" + str(_rnd);
	} else {
		_move = "Dog_Attack";
	};
};

_tPos = visiblePositionASL _vehicle;
_zPos = visiblePositionASL _unit;		

_dir = [_zpos,_tPos] call BIS_Fnc_dirTo;
_unit setDir _dir;

// _unit playMove _move;

if (local _unit) then {
	_unit switchMove _move;
} else {
	[objNull,  _unit,  rSwitchMove,  _move] call RE;
};

//Wait
sleep 0.3;

if (_vehicle != player) then {
	_hpList = 	_vehicle call vehicle_getHitpoints;
	_hp = 		_hpList call BIS_fnc_selectRandom;
	_wound = 	getText(configFile >> "cfgVehicles" >> (typeOf _vehicle) >> "HitPoints" >> _hp >> "name");
	_damage = 	random 0.50;  // was 0.08
	_chance =	round(random 12);

	
	if ((_chance % 4) == 0) then {
		_openVehicles = ["TowingTractor","tractorold","CSJ_GyroC","CSJ_GyroP","UH1_Base","BTR40_MG_TK_INS_EP1","LandRover_MG_TK_EP1_DZE","HMMWV_M998A2_SOV_DES_EP1_DZ","UAZ_MG_Base","datsun1_civil_1_open","datsun1_civil_3_open","TT650_Base","HMMWV_M998A2_SOV_DES_EP1_DZE","AH6_Base_EP1","LandRover_Special_CZ_EP1_DZ","LandRover_Special_CZ_EP1_DZE","LandRover_MG_TK_EP1_DZ","ATV_Base_EP1","Motorcycle","Bicycle"];
		{
			if (_vehicle isKindOf _x) exitWith {
				player action ["eject", _vehicle];
			};
		} count _openVehicles;
	};

	diag_log ("TESTING-YANK FROM VEHICLE = Hitpoints " +str(_wound) + "hit points " + str(_hpList));

	if (_wound in DZE_vehicleZwounds) then {
		
		_strH = "hit_" + (_wound);
		_dam = _vehicle getVariable [_strH,0];
		
		//diag_log ("Hitpoints " +str(_wound) +str(_total));
		
		if (_dam >= 1) then {
			if (r_player_blood < (r_player_bloodTotal * 0.8)) then {
				_cnt = count (DAYZ_woundHit select 1);
				_index = floor (random _cnt);
				_index = (DAYZ_woundHit select 1) select _index;
				_wound = (DAYZ_woundHit select 0) select _index; 
			} else {
				_cnt = count (DAYZ_woundHit_ok select 1);
				_index = floor (random _cnt);
				_index = (DAYZ_woundHit_ok select 1) select _index;
				_wound = (DAYZ_woundHit_ok select 0) select _index; 
			};
			_damage = 0.1 + random (8);  // was random (1.2)
			//diag_log ("START DAM: Player Hit on " + _wound + " for " + str(_damage));
			[player, _wound, _damage, _unit,"zombie"] call fnc_usec_damageHandler;
			[_unit,"hit",2,false] call dayz_zombieSpeak;	
		};
	};
} else {
	//diag_log ("Animation state: " +(_currentAnim));
	_attackanimations = ["zombiestandingattack1","zombiestandingattack2","zombiestandingattack3","zombiestandingattack4","zombiestandingattack5","zombiestandingattack6","zombiestandingattack7","zombiestandingattack8","zombiestandingattack9","zombiestandingattack10","zombiefeed1","zombiefeed2","zombiefeed3","zombiefeed4","zombiefeed5"];
	if (((_unit distance player) <= dayz_areaAffect) && ((animationState _unit) in _attackanimations)) then {
		//check LOS
		_inAngle = [_zPos,(getdir _unit),180,_tPos] call fnc_inAngleSector;
		if (_inAngle) then {
			//LOS check
			_cantSee = [_unit,_vehicle] call dayz_losCheck;
			if (!_cantSee) then {
				if (r_player_blood < (r_player_bloodTotal * 0.8)) then {
					_cnt = count (DAYZ_woundHit select 1);
					_index = floor (random _cnt);
					_index = (DAYZ_woundHit select 1) select _index;
					_wound = (DAYZ_woundHit select 0) select _index; 
				} else {
					_cnt = count (DAYZ_woundHit_ok select 1);
					_index = floor (random _cnt);
					_index = (DAYZ_woundHit_ok select 1) select _index;
					_wound = (DAYZ_woundHit_ok select 0) select _index; 
				};
				_damage = 0.1 + random (6); // was random 1.2
				//diag_log ("START DAM: Player Hit on " + _wound + " for " + str(_damage));
				[player, _wound, _damage, _unit,"zombie"] call fnc_usec_damageHandler;
				[_unit,"hit",2,false] call dayz_zombieSpeak;
			};
		};
	};
};

Share this post


Link to post
Share on other sites

You're missing the issue, second hand zombies where used for debugging and are not normally the process in which they are handled. It was toggled by sending the variable debug, causing _this to be more then 2. You have now added a third option to _this, triggering second hand zombies to occur. Now the debug script is running and the zombies all target and move towards the player. Spawn in a city, go into a building and stand, within minutes you will have zombies coming towards your position. Setting them to forcespeed of 2 only slows the transition down. As it shows in the below code example, it is told that if it is a second hand zombie, then move to this location. 

 

The loiter behavior remains the same thevisad (server standard). Within that file, down near the bottom, all loitering zombies are set with a forcespeed of 2. This puts them back into the loiter behavior, and not just wandering around at some silly fast speed.

if (_secondHand) then {
    diag_log ("Zombie " + str(_agent) + " Loiter " + " distance: " + str(_newDest distance _myDest));
    _agent doMove (getPosATL player);
    _agent moveTo (getPosATL player);
};

Share this post


Link to post
Share on other sites

Ah gotcha.   Got a fix in mind....

oh duh.

 

if (count _this > 3) then {
    _secondHand = true;

right?

 

 

That would work,  I made it an actual trigger effect and use it for our "agro" zombies.

_position = 	_this select 0;
_agent = 		_this select 1;
_agro = 		_this select 2;

_secondHand = false;

if (_agro == "agro") then {
	_secondHand = true;

Share this post


Link to post
Share on other sites

If you really want to get fancy, use this block from Unleashed for the zed movement, in conjunction with your mod. I ripped out our agro, speed and targeting controls. 

_timeN = time;

if (speed _agent < 0.1) then {_countr = _countr + 1} else {_countr = 0};
_target = _agent call zombie_findTargetAgent;
_targetPosition = getPosATL _target;
_agentPosition = getPosATL _agent;

_xt = _targetPosition select 0;
_yt = _targetPosition select 1;
_xa = _agentPosition select 0;
_ya = _agentPosition select 1;
_dx = _xa - _xt;
_dy = _ya - _yt;
_dir = _dy atan2 _dx;
_dx = _dx - _r * cos _dir;
_dy = _dy - _r * sin _dir;
_targetPos = [_xt + _dx, _yt + _dy, 0];
_agent moveTo _targetPos;

//Zombie Speed Assignment

if (_isrunner) then {
	_agent forceSpeed 8;
} else {
	_agent forceSpeed 2;
};

if (_losCheck == 2) then {
	_losCheck = 0;
	_cantSee = [_agent,_target] call dayz_losCheck;
};

Share this post


Link to post
Share on other sites
 

im sorry when you say update should I add or replace ??

like here

 

you need to update it to the following.

 

// Set zombie initial walkspeed 
_agent forceSpeed 2; 

// Create random runners 
_rnd = random(1);
if (_rnd > .8) then {
_isrunner = true;
} else {
    _isrunner = false;
};

//Start behavior
_id = [_position,_agent,_isrunner] execFSM "custom\dayz_code\system\zombie_agent.fsm";
};

Share this post


Link to post
Share on other sites

Calamity?   Not sure I understand what you're talking about.

I ment that after I'm done testing some of the ideas that Thevisad had suggested, I will update my original posts code to incorporate those tested elements.

Share this post


Link to post
Share on other sites

i think calamity means on your install steps

 

you say to find this code

//Disable simulation
        PVDZE_Server_Simulation = [_agent, false];
        publicVariableServer "PVDZE_Server_Simulation";

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

and update it to this (does update means replace?)

// Set zombie initial walkspeed 
_agent forceSpeed 2; 

// Create random runners 
_rnd = random(1);
if (_rnd > .8) then {
_isrunner = true;
} else {
    _isrunner = false;
};

//Start behavior
_id = [_position,_agent,_isrunner] execFSM "custom\dayz_code\system\zombie_agent.fsm";
};

for us non-coders is not clear if you mean to replace the entire code that you tell us to find, but i think u meant to just update the zombie_agent.fsm path and add the rest of the code ? i couldn't go through it all and test it, when i came on changes on the file zombie_agent.fsm you lost me with "red box at the top of the flowchart" and "chase" box. i couldn't figure it out.

Share this post


Link to post
Share on other sites

again sorry for stupid question but , I would rather not try it both ways (add and replace)

so in you instructions you state...,

 

in zombie_generate.sqf

 

You'll find this near the bottom of the file.

//Disable simulation
        PVDZE_Server_Simulation = [_agent, false];
        publicVariableServer "PVDZE_Server_Simulation";

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

you need to update it to the following.
 

// Set zombie initial walkspeed 
_agent forceSpeed 2; 

// Create random runners 
_rnd = random(1);
if (_rnd > .8) then {
_isrunner = true;
} else {
    _isrunner = false;
};

//Start behavior
_id = [_position,_agent,_isrunner] execFSM "custom\dayz_code\system\zombie_agent.fsm";
};

soo am I to replace that block or add yours too it ?

 

Im assuming update means add ....

// Set zombie initial walkspeed
_agent forceSpeed 2;

// Create random runners
_rnd = random(1);
if (_rnd > .8) then {
_isrunner = true;
} else {
    _isrunner = false;
};

and replace this line

//Start behavior
_id = [_position,_agent,_isrunner] execFSM "custom\dayz_code\system\zombie_agent.fsm";
};

Share this post


Link to post
Share on other sites

yes you are correct - you want to keep the disable simulation stuff

 

 

insert those new updated lines after the publicVariableServer "PVDZE_Server_Simulation"
 

and then update your //start behavior  with the call to the custom place you're storing your zombie_agent.fsm


(it should look roughly like this when you're done)   Our random Chance is currently @ .925 for slow zombies.  Adjust that up and down.   @.8 - we were getting about 8 fast zombies per pack of 50, which seemed a bit much. (they also hit really hard on my server, so it was getting overwhelming for under-equipped players.)

 

		//Disable simulation
		PVDZE_Server_Simulation = [_agent, false];
		publicVariableServer "PVDZE_Server_Simulation";

		// Make AI Companions fire at zeds
		_agent addRating -1000000;
		// Set zombie initial walkspeed - McK 11/18/14
		_agent forceSpeed 2; 
		// Create random runners - McK 11/18/14
		_rnd = random(1);
		if (_rnd > .925) then {
			_isrunner = true;
		} else {
			_isrunner = false;
		};

		//Start behavior
		_id = [_position,_agent,_isrunner] execFSM "custom\dayz_code\system\zombie_agent.fsm";
	};
};

Share this post


Link to post
Share on other sites

 

...i couldn't go through it all and test it, when i came on changes on the file zombie_agent.fsm you lost me with "red box at the top of the flowchart" and "chase" box. i couldn't figure it out.

 

anyone can help with this ?

Share this post


Link to post
Share on other sites

how are you opening your zombie_agent.fsm file?   While it can be edited with text, what I said would make WAY more sense if you opened it with FSMeditor (version 1.2.1).   You can get  that from bohemia's site.

Share this post


Link to post
Share on other sites

So guys i did this. Correct me if i am wrong please :)

every file is in good place(custom/dayz_code etc ...)

in compiles.sqf i changed these to:
 

zombie_loiter             = compile preprocessFileLineNumbers "custom\dayz_code\compile\zombie_loiter.sqf";        

zombie_generate         = compile preprocessFileLineNumbers "custom\dayz_code\compile\zombie_generate.sqf";        
wild_spawnZombies         = compile preprocessFileLineNumbers "custom\dayz_code\compile\wild_spawnZombies.sqf";

in zombie_generate.sqf:
 

on the top: private ["_position","_unitTypes","_radius","_method","_agent","_isrunner"];


//Disable simulation
        PVDZE_Server_Simulation = [_agent, false];
        publicVariableServer "PVDZE_Server_Simulation";

        // Make AI Companions fire at zeds
        _agent addRating -1000000;
        // Set zombie initial walkspeed - McK 11/18/14
        _agent forceSpeed 2;
        // Create random runners - McK 11/18/14
        _rnd = random(1);
        if (_rnd > .8) then {
            _isrunner = true;
        } else {
            _isrunner = false;
        };

        //Start behavior
        _id = [_position,_agent,_isrunner] execFSM "custom\dayz_code\system\zombie_agent.fsm";
    };

in wildspawn_zombies.sqf:
 

on the top: private ["_unitTypes","_isrunner","_lootType","_lootTypeCfg","_loot_count","_index","_weights","_loot","_array","_player","_doLoiter","_agent","_type","_radius","_method","_position","_isAlive","_myDest","_newDest","_rnd","_id"];

 

// Slow zombie down.
_agent forceSpeed 2; 
// Create random runners 
_rnd = random(1);
if (_rnd > .8) then {
    _isrunner = true;
} else {
    _isrunner = false;
};

//Start behavior
_id = [_position,_agent,_isrunner] execFSM "custom\dayz_code\system\zombie_agent.fsm";

 

i used fsm editor 

init box:
 

_position = _this select 0;

_agent = _this select 1;
_secondHand = false;
_isrunner = _this select 2;

if (count _this > 3) then {
    _secondHand = true;
    //diag_log ("Second Hand Zombie Initialized: " + str(_this));
};

chase box:
 

_timeN = time;

if (speed _agent < 0.1then {_countr = _countr + 1else {_countr = 0};
_target = _agent call zombie_findTargetAgent;
_targetPosition = getPosATL _target;
_agentPosition = getPosATL _agent;
_targetdistance = _agent distance _target;

//target distance calculation coding provided by the Unleashed Project.

if ( _targetdistance < 2.2 ) then
{_r = 1;};
if (_targetdistance > 2.2 AND _targetdistance < 10then
{_r = 6;};
if ( _targetdistance > 10 AND _targetdistance < 25 ) then
{_r = 8;};
if ( _targetdistance > 25 ) then
{_r = 15;};

_xt = _targetPosition select 0;
_yt = _targetPosition select 1;
_xa = _agentPosition select 0;
_ya = _agentPosition select 1;
_dx = _xa - _xt;
_dy = _ya - _yt;
_dir = _dy atan2 _dx;
_dx = _dx - _r * cos _dir;
_dy = _dy - _r * sin _dir;
_targetPos = [_xt + _dx, _yt + _dy, 0];

//Move to target
_agent moveTo _targetPos;

//The following code is provided by McKeighan to give random zombies speed.

//flag turns zombie into second hand z once loiter state is re initiated.
_isaggro = true;

//this flag is set in the zombie_generate.sqf / wildzombie_generate.sqf

if (_isrunner) then {
    _agent forceSpeed 8;
else {
    _agent forceSpeed 2;
};

if (_losCheck == 2then {
    _losCheck = 0;
    _cantSee = [_agent,_target] call dayz_losCheck;
};

 

 

Is it correct ? Because they are looks like an idiot, and just wandering around, + 1-2 zombies are start to chase and thats all

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...