McKeighan Posted November 19, 2014 Report Share Posted November 19, 2014 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 CartoonrBOY, BetterDeadThanZed, GaspArt and 2 others 5 Link to comment Share on other sites More sharing options...
SmokeyBR Posted November 19, 2014 Report Share Posted November 19, 2014 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. Link to comment Share on other sites More sharing options...
CartoonrBOY Posted November 19, 2014 Report Share Posted November 19, 2014 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; }; McKeighan 1 Link to comment Share on other sites More sharing options...
f3cuk Posted November 19, 2014 Report Share Posted November 19, 2014 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 */ }; CartoonrBOY 1 Link to comment Share on other sites More sharing options...
thevisad Posted November 19, 2014 Report Share Posted November 19, 2014 _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); }; Link to comment Share on other sites More sharing options...
BetterDeadThanZed Posted November 19, 2014 Report Share Posted November 19, 2014 I'll be watching this thread to see how it develops. I start my work week tomorrow (I work 3 days a week, 12 hour shifts) so by Sunday or Monday I'll see how any bug fixes are implemented and how the ideas come along and then I'll test it myself. Link to comment Share on other sites More sharing options...
McKeighan Posted November 19, 2014 Author Report Share Posted November 19, 2014 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. Link to comment Share on other sites More sharing options...
McKeighan Posted November 19, 2014 Author Report Share Posted November 19, 2014 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; }; }; }; }; Link to comment Share on other sites More sharing options...
emwilsh Posted November 20, 2014 Report Share Posted November 20, 2014 this is what ime talking about!!! How about crawlers?:) nice one guys Link to comment Share on other sites More sharing options...
thevisad Posted November 20, 2014 Report Share Posted November 20, 2014 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); }; Link to comment Share on other sites More sharing options...
McKeighan Posted November 20, 2014 Author Report Share Posted November 20, 2014 Ah gotcha. Got a fix in mind.... oh duh. if (count _this > 3) then { _secondHand = true; right? thevisad 1 Link to comment Share on other sites More sharing options...
thevisad Posted November 20, 2014 Report Share Posted November 20, 2014 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; Link to comment Share on other sites More sharing options...
McKeighan Posted November 20, 2014 Author Report Share Posted November 20, 2014 oh that would also be coool... so once they switch from loiter to aggro, and go back to loiter, the 2nd loiter is more like the zombie is searching for you. Link to comment Share on other sites More sharing options...
thevisad Posted November 20, 2014 Report Share Posted November 20, 2014 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; }; McKeighan 1 Link to comment Share on other sites More sharing options...
McKeighan Posted November 20, 2014 Author Report Share Posted November 20, 2014 testing - will update original post if the results work out the way we like. Link to comment Share on other sites More sharing options...
calamity Posted November 20, 2014 Report Share Posted November 20, 2014 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"; }; Link to comment Share on other sites More sharing options...
McKeighan Posted November 20, 2014 Author Report Share Posted November 20, 2014 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. Link to comment Share on other sites More sharing options...
McKeighan Posted November 20, 2014 Author Report Share Posted November 20, 2014 Updated the code in the original post to include some zombie logic provided by Thevisad. Link to comment Share on other sites More sharing options...
SmokeyBR Posted November 21, 2014 Report Share Posted November 21, 2014 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. Link to comment Share on other sites More sharing options...
calamity Posted November 21, 2014 Report Share Posted November 21, 2014 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"; }; Link to comment Share on other sites More sharing options...
McKeighan Posted November 21, 2014 Author Report Share Posted November 21, 2014 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"; }; }; Link to comment Share on other sites More sharing options...
SmokeyBR Posted November 22, 2014 Report Share Posted November 22, 2014 ...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 ? Link to comment Share on other sites More sharing options...
McKeighan Posted November 22, 2014 Author Report Share Posted November 22, 2014 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. Link to comment Share on other sites More sharing options...
SmokeyBR Posted November 22, 2014 Report Share Posted November 22, 2014 ohh got ya ok ill do that then, was opening with notepad++ Link to comment Share on other sites More sharing options...
drax18 Posted December 5, 2014 Report Share Posted December 5, 2014 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.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.sqfif (_isrunner) then { _agent forceSpeed 8; } else { _agent forceSpeed 2; };if (_losCheck == 2) then { _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 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now