Jump to content
  • 0

Walking Dead Zombies


MisterSunshine

Question

I will start with, I am a major noob when it comes to coding of any kind. I am trying to get the zombies walking only, no more balls to the wall sprint to close distance. I have done this easily with vanilla DayZ but I'm having a bit of trouble getting it to work with DayZ Epoch. I change forceSpeed to 2 in control_zombieAgent.sqf but they still run at full speed.

 

So then I tried looking around for another zombie chase code in other files. I went into zombie_agent.fsm and changed the forceSpeed in the chase area to 2 as well. This makes the zombies stop running but they don't appear to be "seeing" the player. They will move toward a player if the player makes a noise but I can run in front of them and they continue to loiter. If I move within strike range the zombie will still attack. 

 

I've not messed with the FSM file before and I'm not sure what it is used for but is it a "no-no" to edit it? Does anyone have a suggestion of where to look to try to make the zombies walk and still chase the player on sight? Any suggestions on what I may be doing wrong?

 

Also, I am hosting the server on an HP mini server at my house for a small number of friends to play around on. Not serious at all but we like the "Walking Dead" zombies style. If you think walking zombies would be too difficult to get working with Epoch let me know. I like the traders and economy system of Epoch but I am open to other mods that may work better for us.

 

Thank you for any help you can provide.

Link to comment
Share on other sites

Recommended Posts

  • 0

Any idea what you tweaked?

 

It seems you're struggling at this, the file you want to edit is fn_damagehandler.sqf

 

Here is my file so you can compare and edit to your liking


scriptName "Functions\misc\fn_damageHandler.sqf";
/***********************************************************
	PROCESS DAMAGE TO A UNIT
	- Function
	- [unit, selectionName, damage, source, projectile] call fnc_usec_damageHandler;
************************************************************/
private ["_unit","_humanityHit","_myKills","_hit","_damage","_isPlayer","_unconscious","_wound","_isHit","_isInjured","_type","_hitPain","_isCardiac","_isHeadHit","_isMinor","_scale","_canHitFree","_rndPain","_rndInfection","_hitInfection","_lowBlood","_isPZombie","_source","_ammo","_unitIsPlayer","_isBandit"];
_unit = _this select 0;
_hit = _this select 1;
_damage = _this select 2;
_unconscious = _unit getVariable ["NORRN_unconscious", false];
_isPZombie = player isKindOf "PZombie_VB";
_source = _this select 3;
_ammo = _this select 4;
_type = [_damage,_ammo] call fnc_usec_damageType;

_isMinor = (_hit in USEC_MinorWounds);
_isHeadHit = (_hit == "head_hit");
//_evType = "";
//_recordable = false;
_isPlayer = (isPlayer _source);
_humanityHit = 0;
_myKills = 0;
_unitIsPlayer = _unit == player;

if (_unitIsPlayer) then {
	if (_hit == "") then {
		if ((_source != player) && _isPlayer) then {
		//Enable aggressor Actions
			if (_source isKindOf "CAManBase") then {
				_source setVariable["startcombattimer",1];
			};
			_canHitFree = 	player getVariable ["freeTarget",false];
			_isBandit = (player getVariable["humanity",0]) <= -5000;
			_isPZombie = player isKindOf "PZombie_VB";

			if (!_canHitFree && !_isBandit && !_isPZombie) then {
				//Process Morality Hit
				_myKills = 0 max (1 - (player getVariable ["humanKills",0]) / 5);
				_humanityHit = -100 * _myKills * _damage;

				/* PVS/PVC - Skaronator */
				if (_humanityHit != 0) then {
					[_source,_humanityHit] spawn {
						private ["_source","_humanityHit"];
						_source = _this select 0;
						_humanityHit = _this select 1;
						PVDZE_send = [_source,"Humanity",[_source,_humanityHit,30]];
						publicVariableServer "PVDZE_send";
					};
				};
			};
		};
	};
};

//PVP Damage
_scale = 700;
if (_damage > 0.4) then {
	if (_ammo != "zombie") then {
		_scale = _scale * 5;
	};
	if (_isHeadHit) then {
		_scale = _scale * 5;
	};
	if ((isPlayer _source) and !(player == _source)) then {
		_scale = _scale + 500;
		if (_isHeadHit) then {
			_scale = _scale + 500;
		};
	};
	switch (_type) do {
		case 1: {_scale = _scale + 800};
		case 2: {_scale = _scale + 800};
	};
	if (_unitIsPlayer) then {
		//Cause blood loss
		//Log Damage
		/*
		if (DZE_Debug_Damage) then {
			diag_log ("DAMAGE: player hit by " + typeOf _source + " in " + _hit + " with " + _ammo + " for " + str(_damage) + " scaled " + str(_damage * _scale));
		};
		*/
		r_player_blood = r_player_blood - (_damage * _scale);
	};
};

//Record Damage to Minor parts (legs, arms)
if (_hit in USEC_MinorWounds) then {
	if (_ammo == "zombie") then {
		if (_hit == "legs") then {
			[_unit,_hit,(_damage / 6)] call object_processHit;
		} else {
			[_unit,_hit,(_damage / 4)] call object_processHit;
		};
	} else {
		[_unit,_hit,(_damage / 2)] call object_processHit;
	};
	if (_ammo == "") then {
		[_unit,_hit,_damage] call object_processHit;
	};
};


if (_unitIsPlayer) then {
//incombat
	_unit setVariable["startcombattimer", 1];
};

if (_damage > 0.1) then {
	if (_unitIsPlayer) then {
		//shake the cam, frighten them!
		//player sidechat format["Processed bullet hit for %1 (should only be for me!)",_unit];
		1 call fnc_usec_bulletHit;
	};
	if (local _unit) then {
		_unit setVariable["medForceUpdate",true,true];
	};
};
if (_damage > 0.4) then {	//0.25
	/*
		BLEEDING
	*/
	_wound = _hit call fnc_usec_damageGetWound;
	_isHit = _unit getVariable[_wound,false];
	if (_unitIsPlayer) then {
		_rndPain = 		(random 10);
		_rndInfection = (random 500);
		_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;
		};
	};
	if(!_isHit) then {

		if(!_isPZombie) then {
			//Create Wound
			_unit setVariable[_wound,true,true];

			[_unit,_wound,_hit] spawn fnc_usec_damageBleed;
			/* PVS/PVC - Skaronator */
			_pos = getPosATL _unit;
			_inRange = _pos nearEntities ["CAManBase",1000];
			{
				// only send to other players
				if(isPlayer _x && _x != player) then {
					PVDZE_send = [_x,"Bleed",[_unit,_wound,_hit]];
					publicVariableServer "PVDZE_send";
				};
			} count _inRange;

			//Set Injured if not already
			_isInjured = _unit getVariable["USEC_injured",false];
			if (!_isInjured) then {
				_unit setVariable["USEC_injured",true,true];
			if ((_unitIsPlayer) && (_ammo != "zombie")) then {
					dayz_sourceBleeding = _source;
				};
			};
			//Set ability to give blood
			_lowBlood = _unit getVariable["USEC_lowBlood",false];
			if (!_lowBlood) then {
				_unit setVariable["USEC_lowBlood",true,true];
			};
			if (_unitIsPlayer) then {
				r_player_injured = true;
			};
		};
	};
};
if (_type == 1) then {
	/*
		BALISTIC DAMAGE
	*/
	if ((_damage > 0.01) && (_unitIsPlayer)) then {
		//affect the player
		[20,45] call fnc_usec_pitchWhine; //Visual , Sound
	};
	if (_damage > 4) then {
		//serious ballistic damage
		if (_unitIsPlayer) then {
			[_source,"explosion"] spawn player_death;
		};
	} else {
		if (_damage > 2) then {
			_isCardiac = _unit getVariable["USEC_isCardiac",false];
			if (!_isCardiac) then {
				_unit setVariable["USEC_isCardiac",true,true];
				r_player_cardiac = true;
			};
		};
	};
};
if (_type == 2) then {
	/*
		HIGH CALIBRE
	*/
	if (_damage > 4) then {
		//serious ballistic damage
		if (_unitIsPlayer) then {
			[_source,"shotheavy"] spawn player_death;
		};
	} else {
		if (_damage > 2) then {
			_isCardiac = _unit getVariable["USEC_isCardiac",false];
			if (!_isCardiac) then {
				_unit setVariable["USEC_isCardiac",true,true];
				r_player_cardiac = true;
			};
		};
	};
};

if (!_unconscious && !_isMinor && ((_damage > 2) || ((_damage > 0.5) && _isHeadHit))) then {
	//set unconsious
	[_unit,_damage] call fnc_usec_damageUnconscious;
};

 

Link to comment
Share on other sites

  • 0

I've followed this topic from first to last post, gone backwards and forwards and got confused and lost along the way.

 

At the end of it all, i now have the walking zeds on my test server that are lethal...and that's just fantastic! thanks so much all you guys!

 

However, one thing that i just don't get and it's bugging me to hell is the zombie_agent.fsm! I don't know where it's supposed to be? Everytime i log onto my server, within a few seconds i get a popup 'Script fixes\zombie_agent.fsm not found' and that's with it being in my custom folder or if i remove it completely, but the zeds still seem to work, except maybe some standing around looking dumb occasionally :S

 

Could someone be kind enough to do a short, concise recap of every stage that needs to be done/changed/moved that's been shown to work with Epoch 1.0.5.1 please, for me and all future searchers? This would be greeeeeatly appreciated :D

Link to comment
Share on other sites

  • 0

To find those files you extract them from the dayz_code pbo. Then you make a new folder in your mission file called "custom." You edit the previously mentioned files and then save them in the custom folder which you just made. After that, you just edit your custom compiles.sqf to point to your new files instead of your old files and you're done.

Link to comment
Share on other sites

  • 0

And here I am trying to make sense of it all just so that at first I can speed them up, lol not slow them down.I have checked my server pbo file and the files mentioned inside compile arnt there so that's me screwed, my problem is zombies arnt scary so first project is to speed them up, and iff possible make the faster and harder at night only so daytime faster, nightime faster and harder.........any help as always is greatly appreciated. running overpoch on chernarus

Link to comment
Share on other sites

  • 0

@BetterDeadThanZed: I think what you are looking for (and I myself was now searching for a longer time cause I also wanted a way to make them more dangerous.) is dayz_code\player_zombieAttack.sqf

 

So in there is this part:

if (((_unit distance player) <= dayz_areaAffect) && ((animationState _unit) in _attackanimations)) then {
        //check LOS
        _inAngle = [_zPos,(getdir _unit),350,_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 (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;
            };
        };
    };

 

 

The angle decides (I guess) if the Zed is able to hit you or not...so if you you are a bit to far to the right or left, their hit is not in the angle and does no damage:

_inAngle = [_zPos,(getdir _unit),50,_tPos] call fnc_inAngleSector;

 

If you change this to:

_inAngle = [_zPos,(getdir _unit),350,_tPos] call fnc_inAngleSector;

 

they nearly hit you all the time, independently where you are standing relatively to them. So just play with the value (here 350 degrees) until it fits for you.

 

I just tested this once now for a short time as it is late already but for me it seems to be the right file/location also to adjust other attack behaviour things of Zeds vs. players.

 

Regards,

jahan.

Link to comment
Share on other sites

  • 0

@BetterDeadThanZed: I think what you are looking for (and I myself was now searching for a longer time cause I also wanted a way to make them more dangerous.) is dayz_code\player_zombieAttack.sqf

 

The angle decides (I guess) if the Zed is able to hit you or not...so if you you are a bit to far to the right or left, their hit is not in the angle and does no damage:

_inAngle = [_zPos,(getdir _unit),50,_tPos] call fnc_inAngleSector;

 

If you change this to:

_inAngle = [_zPos,(getdir _unit),350,_tPos] call fnc_inAngleSector;

 

they nearly hit you all the time, independently where you are standing relatively to them. So just play with the value (here 350 degrees) until it fits for you.

 

Thanks for that! It works perfectly now!

Link to comment
Share on other sites

  • 0

BetterDead - ok so you wanna know more about increasing zed damage?

it seems zed damage is mostly controlled from the player_zombieattacks.sqf file, as well as the angle of attack. 

on our server, i've modified the angle to being 180 degrees   (350 is just silly talk jahangir13).

the damage is a few lines below it, and reads.

 

_damage = 0.1 + random (1.2); 



we switched ours to being

_damage = 0.1 + random (6); // was random 1.2



If you adjust the random damage modifier, rather then making the damage start @ a fixed number, you get a better spread of damage.  MAYBE the zombie will just graze you like normal dayz on the first swing, maybe the 2nd swing will knock you out.   Maybe that 1st swing is enough to KO you and you'll bleed out.    The total randomness of our zombies damage makes them dangerous...


But they are slow. 

I'm working on 2 different ideas, and will post up here someday when i get them running.

first is speed of zombie is "variable".
second is speed of zombie is determined by time of game (ingame clock).

Link to comment
Share on other sites

  • 0

BetterDead - K dude. Forgot to look at the post date.

 

 

On the other front. I've had moderate success getting a low population of zombies to be fast, and the rest to be slow.   Once I confirm that this method is working exactly how I'm intending it to, I'll put up a coded how-to do this on your own servers.

Link to comment
Share on other sites

  • 0

Greetings, I am trying to set up my server and I am not so good at any coding, but I can understand what I have to do. Anyway, when I set the server up, and make sure its running I tried to mod it.

Well, is it possible, that I miss something files? There are no " control_zombieAgent.sqf " in my "dayz_code.pbo". It is vanilla @DayZ Epoch files.

Here is screen.

 

dayz_code.PNG

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
×
×
  • Create New...