Jump to content

[Release] Random Speed Zombies (walking and running)


McKeighan

Recommended Posts

Hey great script idea,

 

im getting spams in my client rpt

Error in expression < _yt;
_dir = _dy atan2 _dx;
_dx = _dx - _r * cos _dir;
_dy = _dy - _r * sin _dir>

zombie_generate.sqf

 

  Reveal hidden contents

 

 

zombie_agent.fsm

 

  Reveal hidden contents

 

 

wild_spawnzombie.sqf

 

  Reveal hidden contents

 

 

*EDIT*

 

To fix this spammage of my client rpt, 

 

Inside fsm, where you put

 "_timeN = time;" \n
"" \n
"if (speed _agent < 0.1) then {_countr = _countr + 1} else {_countr = 0};" \n
"_target = _agent call zombie_findTargetAgent;" \n
"_targetPosition = getPosATL _target;" \n
"_agentPosition = getPosATL _agent;" \n
"_targetdistance = _agent distance _target;" \n
 
 
"_r = 0;" \n           //<------ ADD THIS RIGHT BETWEEN LIKE I HAVE
 

"if ( _targetdistance < 2.2 ) then" \n
"{_r = 1;};" \n
"if (_targetdistance > 2.2 AND _targetdistance < 10) then" \n
"{_r = 6;};" \n
"if ( _targetdistance > 10 AND _targetdistance < 25 ) then" \n
"{_r = 8;};" \n
"if ( _targetdistance > 25 ) then" \n
"{_r = 15;};" \n
"_xt = _targetPosition select 0;" \n
"_yt = _targetPosition select 1;" \n
"_xa = _agentPosition select 0;" \n
"_ya = _agentPosition select 1;" \n
"_dx = (_xa - _xt);" \n
"_dy = (_ya - _yt);" \n
"_dir = _dy atan2 _dx;" \n
"_dx = ((_dx - _r) * (cos _dir));" \n
"_dy = ((_dy - _r) * (sin _dir));" \n
"_targetPos = [_xt + _dx, _yt + _dy, 0];" \n
"_agent moveTo _targetPos;" \n
"_isaggro = true;" \n
"if (_isrunner) then {" \n
"_agent forceSpeed 8;" \n
"} else {" \n
"_agent forceSpeed 2;" \n
"};" \n
"if (_losCheck == 2) then {" \n
"_losCheck = 0;" \n
"_cantSee = [_agent,_target] call dayz_losCheck;" \n
"};" \n

 

 

Link to comment
Share on other sites

  • 2 weeks later...

Hey - sorry been working on a diff project for a while now.


se7en = that's mostly right.   The zombies ARE chasing you, they're just doing it at a walking pace.  When you hear them shout, they have targeted something, and are walking toward it stupidly slow.  They do have a tendancy to mill around aimlessly when they don't have agro.

ALKINDA - That's because those variables aren't defined somewhere - but it looks like you figured that out.   My R value starts as _r = 20.   That might help keep them milling around some as well and not so stationary.

 

 

 

 

 


 

Link to comment
Share on other sites

  On 2/24/2015 at 2:38 PM, McKeighan said:

ALKINDA - That's because those variables aren't defined somewhere - but it looks like you figured that out.   My R value starts as _r = 20.   That might help keep them milling around some as well and not so stationary.

 

so should i set it to _r=20 and not _r=0? 

 

I havent seen any issues with the zombies yet, i will try out setting it to 20 though.

Link to comment
Share on other sites

  • 4 weeks later...
  On 11/19/2014 at 2:54 AM, McKeighan said:

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

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.

seem to have much more than 20% fast.. more like 90% fast .. what shout lower to to get say 5 percent ??

 

Link to comment
Share on other sites

  • 4 months later...
  On 8/2/2015 at 10:12 PM, BetterDeadThanZed said:

Altered damage for fast zeds were mentioned earlier in this thread. Did anyone ever get that working? I'd like to have reduced damage for the fast zeds. 

I've managed to get this script installed and working.  The only issue i has is when a "fast" zombie would spawn, it killed the server FPS.  Once you killed that zombie, FPS came back.  Oddly enough.  So i havnt had the time to really test it as i pulled it out once i found that out. But i know there are a couple threads out there that explain how to change the amount of damage they do. I would need to find them.

Link to comment
Share on other sites

  • 5 months later...

Hi

Where do i add this in my zombie_agent? Can't get that part to work get some errors in the file

_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;
};

Link to comment
Share on other sites

I'm having trouble installing this.

I added these lines to my custom compiles:

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

 

I placed the sqf files in my custom folder:

zombie_loiter.sqf

zombie_generate.sqf

wild_spawnZombies.sqf

player_zombieAttack.sqf (from McKeighan's )

 

I used the FSM editor to change code in zombie_agent.fsm

 

I've seen 1 zombie that moved slow and the rest all run as usual.

I used the authors player_zombieAttack.sqf  and I do get pulled out of cars but the zombies don't seem to hit harder than usual.

 

Here are my files:

 

player_zombieAttack.sqf

  Reveal hidden contents

 

wild_spawnZombies.sqf

  Reveal hidden contents

 

zombie_generate.sqf

  Reveal hidden contents

 

zombie_loiter.sqf

  Reveal hidden contents

 

https://www.dropbox.com/home?preview=zombie_agent.fsm

 

If someone would be so kind as to take a look at this.

 

Thank you.

Link to comment
Share on other sites

  On 1/10/2016 at 11:50 AM, meanbeandk said:

Hi

Where do i add this in my zombie_agent? Can't get that part to work get some errors in the file

_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;
};

Expand  

For that part it says to click on the Chase box & replace the code that,s in there.

Did you use the FSM tool?

Link to comment
Share on other sites

  On 1/12/2016 at 4:28 AM, Hux said:

I'm having trouble installing this.

I added these lines to my custom compiles:

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

...

Expand  

I had major FPS issues with the random speed zombies.  I had to go to only walking zombies.

As for the the zombie hitting harder, i think you need the damagehandlerZ.sqf also

here are my files, use them as needed or compare them to yours.

My zombies, take many more bullets to the body, headshots kill them easily.  They walk and they hit harder.

As for changing the speeds of the zombies, its in the FSM.  Look for 

  Reveal hidden contents

_agent forceSpeed

and change the number.

(this method ^^ using NP++)

Or FSM editor, click on the white "chase" box and you will see "_agent forceSpeed"

From what i've found researching, zombies can only go fast or slow, theres no in between.  2 is slow, 8 is fast.

https://www.dropbox.com/s/1ocw6z9w3o8owr8/SlowZeds.rar?dl=0

GL

Link to comment
Share on other sites

  On 1/12/2016 at 3:21 PM, theduke said:

I had major FPS issues with the random speed zombies.  I had to go to only walking zombies.

As for the the zombie hitting harder, i think you need the damagehandlerZ.sqf also

here are my files, use them as needed or compare them to yours.

My zombies, take many more bullets to the body, headshots kill them easily.  They walk and they hit harder.

As for changing the speeds of the zombies, its in the FSM.  Look for 

 

Hidden Content

 

and change the number.

(this method ^^ using NP++)

Or FSM editor, click on the white "chase" box and you will see "_agent forceSpeed"

From what i've found researching, zombies can only go fast or slow, theres no in between.  2 is slow, 8 is fast.

https://www.dropbox.com/s/1ocw6z9w3o8owr8/SlowZeds.rar?dl=0

GL

Expand  

Thank you for the info.

I wanted at least half the zeds to run (maybe 3/4).

Right now after testing several times I've only seen 1 zed move slow. The rest are behaving as usual.

The only difference I've seen so far is being pulled out of vehicle by the zeds.

So I'm wondering if I set the path right and am calling the sqf files properly.

I'm using all default settings right now and the zombie attack sqf provided by the author.

Do the lines in the custom compiles look right to you? (I have all sqf files in my custom folder)

Does the code look right in the sqf files?

I've looked at it several times and it looks fine to me but I could be misunderstanding the instructions...

Thanks for the help.

Link to comment
Share on other sites

  On 1/12/2016 at 7:02 PM, Hux said:

Thank you for the info.

I wanted at least half the zeds to run (maybe 3/4).

Right now after testing several times I've only seen 1 zed move slow. The rest are behaving as usual.

The only difference I've seen so far is being pulled out of vehicle by the zeds.

So I'm wondering if I set the path right and am calling the sqf files properly.

I'm using all default settings right now and the zombie attack sqf provided by the author.

Do the lines in the custom compiles look right to you? (I have all sqf files in my custom folder)

Does the code look right in the sqf files?

I've looked at it several times and it looks fine to me but I could be misunderstanding the instructions...

Thanks for the help.

Expand  

unfortunately i dont understand the code, language if you want...i only understand the file structure and able to modify the code a bit...

The compiles look fine, if you have all your files in that folder like you mentioned.  Just make sure you done have 2 compiles, or 2 lines calling the same file in y our mission pbo.

but as for the half running half slow. i hope you can figure it out...I never was able to lol the secnd a fast zombie would spawn, the FPS would drop...kill that running zombie, FPS came back up to normal.  I even tried to go 20% fast, 80% slow, or vice versa, and it was the same issue... and i dont have the files anymore to be able to compare them :(   Quite possible i did something wrong, or didnt have the correct files to begin with.  So instead i went the "hit harder and harder to kill" way lol

GL let me know if you figure it out

Link to comment
Share on other sites

  On 1/12/2016 at 8:44 PM, theduke said:

unfortunately i dont understand the code, language if you want...i only understand the file structure and able to modify the code a bit...

The compiles look fine, if you have all your files in that folder like you mentioned.  Just make sure you done have 2 compiles, or 2 lines calling the same file in y our mission pbo.

but as for the half running half slow. i hope you can figure it out...I never was able to lol the secnd a fast zombie would spawn, the FPS would drop...kill that running zombie, FPS came back up to normal.  I even tried to go 20% fast, 80% slow, or vice versa, and it was the same issue... and i dont have the files anymore to be able to compare them :(   Quite possible i did something wrong, or didnt have the correct files to begin with.  So instead i went the "hit harder and harder to kill" way lol

GL let me know if you figure it out

Expand  

Thanks.

Your files are helpful. I'm trying a few different things and I'll let you know how it goes.

Link to comment
Share on other sites

  On 1/13/2016 at 4:49 AM, Hux said:

I was wondering if there is a way to increase the chance of being infected by a zed?

Expand  

Anyone?

In my search I've only found "chance of infection" for bloodbag use but not for being hit by zed and I can't find anything in the files I'm using.

BTW, theduke I'm using your fn_damageHandlerZ.sqf   and it works great. I love how zeds knock players out.

Thank you.

Link to comment
Share on other sites

  On 1/14/2016 at 1:51 AM, Hux said:

Anyone?

In my search I've only found "chance of infection" for bloodbag use but not for being hit by zed and I can't find anything in the files I'm using.

BTW, theduke I'm using your fn_damageHandlerZ.sqf   and it works great. I love how zeds knock players out.

Thank you.

Expand  

Glad it worked for you.  I looked at the chance of infection increased on zombie hit, but i cant find it either. but i cam accross this... it might help you

 

 

Link to comment
Share on other sites

  On 1/14/2016 at 1:51 AM, Hux said:

Anyone?

In my search I've only found "chance of infection" for bloodbag use but not for being hit by zed and I can't find anything in the files I'm using.

BTW, theduke I'm using your fn_damageHandlerZ.sqf   and it works great. I love how zeds knock players out.

Thank you.

Expand  

Yes, took me 10 minutes to search throught files ;)

Anyways, you need to change your fn_damageHandler.sqf

The lines you're looking for is line 129

Here is the code, with my comment (line 3) :

In this exemple, on each hit, you have 1 chance on 500 to be infected

if (_unitIsPlayer) then {
		_rndPain = 		(random 10);
		_rndInfection = (random 500); // HERE, lower the number to increase chance of infection on hit
		_hitPain = 		(_rndPain < _damage);
		if ((_isHeadHit) || (_damage > 1.2 && _hitPain)) then {
			_hitPain = true;
		};
		_hitInfection = (_rndInfection < 1);
		//player sidechat format["HitPain: %1, HitInfection %2 (Damage: %3)",_rndPain,_rndInfection,_damage]; //r_player_infected
		if (_isHit) then {
			//Make hit worse
			if (_unitIsPlayer) then {
				r_player_blood = r_player_blood - 50;
			};
		};
		if (_hitInfection) then {
			//Set Infection if not already
			if (_unitIsPlayer && !_isPZombie) then {
				r_player_infected = true;
				player setVariable["USEC_infected",true,true];
			};

		};
		if (_hitPain) then {
			//Set Pain if not already
			if (_unitIsPlayer) then {
				r_player_inpain = true;
				player setVariable["USEC_inPain",true,true];
			};
		};
		if ((_damage > 1.5) && _isHeadHit) then {
			[_source,"shothead"] spawn player_death;
		};
	};

To call you custom eventHandler, you need to have custom compiles.sqf

Then, you need to find the line starting with fnc_usec_damageHandler

and change it to where you put your custom fn_damageHandler.sqf

Example :

fnc_usec_damageHandler = compile preprocessFileLineNumbers "custom\fn_damageHandler.sqf"; //Event handler run on damage

 

Link to comment
Share on other sites

  On 1/14/2016 at 9:01 AM, Oshydaka said:

Yes, took me 10 minutes to search throught files ;)

Anyways, you need to change your fn_damageHandler.sqf

The lines you're looking for is line 129

Here is the code, with my comment (line 3) :

In this exemple, on each hit, you have 1 chance on 500 to be infected

if (_unitIsPlayer) then {
		_rndPain = 		(random 10);
		_rndInfection = (random 500); // HERE, lower the number to increase chance of infection on hit
		_hitPain = 		(_rndPain < _damage);
		if ((_isHeadHit) || (_damage > 1.2 && _hitPain)) then {
			_hitPain = true;
		};
		_hitInfection = (_rndInfection < 1);
		//player sidechat format["HitPain: %1, HitInfection %2 (Damage: %3)",_rndPain,_rndInfection,_damage]; //r_player_infected
		if (_isHit) then {
			//Make hit worse
			if (_unitIsPlayer) then {
				r_player_blood = r_player_blood - 50;
			};
		};
		if (_hitInfection) then {
			//Set Infection if not already
			if (_unitIsPlayer && !_isPZombie) then {
				r_player_infected = true;
				player setVariable["USEC_infected",true,true];
			};

		};
		if (_hitPain) then {
			//Set Pain if not already
			if (_unitIsPlayer) then {
				r_player_inpain = true;
				player setVariable["USEC_inPain",true,true];
			};
		};
		if ((_damage > 1.5) && _isHeadHit) then {
			[_source,"shothead"] spawn player_death;
		};
	};

To call you custom eventHandler, you need to have custom compiles.sqf

Then, you need to find the line starting with fnc_usec_damageHandler

and change it to where you put your custom fn_damageHandler.sqf

Example :

fnc_usec_damageHandler = compile preprocessFileLineNumbers "custom\fn_damageHandler.sqf"; //Event handler run on damage

 

Expand  

Ahh, I was looking in the wrong file.

I was looking in the fn_damageHandlerZ.sqf  that theduke so kindly provided.

So I found the fn_damageHandler.sqf in my client files and I'll put that in my mission folder as you described.

I really appreciate the detailed explanation.

Thank you.

Link to comment
Share on other sites

  On 1/16/2016 at 5:20 PM, Hux said:

How did you get the zeds to knock out players?

Is it a % of a chance setting?

I'd like to lower that chance if possible.

Expand  

check post #7

http://opendayz.net/threads/increasing-zombie-damage-in-epoch.17695/

EDIT: I do remember changing it when i first got the code, but i cant remember for the life of me what i changed. sry dude

Link to comment
Share on other sites

  • 10 months later...

Hi, sorry. I'm still learning and a bit confused by this part.

the "chase" box in the agent.fsm?

I'm not sure where to put this

 

  Reveal hidden contents

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
×
×
  • Create New...