Need some help with ZedAi....
Reworked some scripts so now I have missions with spawning zombie which a loitering while have no target... I made them loitering in some radius with changing destination point, but then changed a lot and thay all are following some point which. Help please to fix it.
part of some mition that calls zombie spawning:
spawn_zeds function:
zombie_behaviour:
zeds_loiter function:
zeds_findTarget is just the same as zombie_findTagetAgent from dayz_code
Also I think zombie missions are going to be rather easy cause ussualy players attack from 300+ m distance and this will prevent zeds anger, but making zeds to search for target in 500m radius is also will break the realistic. So I thought of making some kind of re-working their behaviour, so if they hear a shot ora vehicle in 500m radius they should loiter those direction until it is in < 300m distance. Then if zed can see the target then he runs, if not continue loiter until the target is in <100m distance.
The second thing is that most players will try to use a car for killing zeds, zo i wonder is there a way to make a vehicle get damaged when zeds or other units?
Reworked some scripts so now I have missions with spawning zombie which a loitering while have no target... I made them loitering in some radius with changing destination point, but then changed a lot and thay all are following some point which. Help please to fix it.
part of some mition that calls zombie spawning:
Code:
_position = [getMarkerPos "center",0,5500,10,0,2000,0] call BIS_fnc_findSafePos;
[[_position select 0, _position select 1, 0],4,"z_hunter","Random",true] call spawn_zeds;
spawn_zeds function:
Code:
private ["_mission","_skin","_gear","_unitnumber","_position","_agent","_radius","_method","_zedPos"];
_position = _this select 0;
_unitnumber = _this select 1;
_skin = _this select 2;
_gear = _this select 3;
if (count _this > 4) then {
_mission = _this select 4; // 8
} else {
_mission = False;
};
_agent = objNull;
_i = 1;
if (!isServer) exitWith {};
for "_i" from 1 to _unitnumber do
{
_radius = 20;
_method = "NONE";
_zedPos = [_position,((round(random 10)) max 5),((round(random 20)) max 10),((round(random 5)) max 1),0,((round(random 25)) max 5),0] call BIS_fnc_findSafePos;
_agent = createAgent [_skin, _zedPos, [], _radius, _method];
_agent setDir round(random 180);
//dayz_spawnZombies = dayz_spawnZombies + 1;
ai_ground_units = (ai_ground_units + 1);
if (_mission) then {
_agent setVariable ["missionclean", "ground"];
};
[_agent,_zedPos] execVM "\z\addons\dayz_server\ZedAI\compile\zombie_behaviour.sqf";
};
zombie_behaviour:
Code:
private ["_target","_targetPos","_isAlive","_list","_myDest","_agent","_doloiter","_missposition","_movepos"];
_agent = _this select 0;
_missposition = _this select 1;
_isAlive = alive _agent;
while {_isAlive} do {
_agent disableAI "FSM";
//_agent setCombatMode "RED";
_target = objNull;
_targetPos = [];
_myDest = getPosATL _agent;
while {isNull _target and _isAlive} do {
_doloiter = true;
_isAlive = alive _agent;
_target = _agent call zeds_findTarget;
_agent moveTo _movepos;
_agent forceSpeed 2;
sleep 1;
};
[_agent,"attack",0,false] call zeds_speak;
while {!isNull _target and _isAlive} do {
_doloiter = false;
_target = _agent call zeds_findTarget;
_isAlive = alive _agent;
_targetPos = getPosATL _target;
_agent moveTo _targetPos;
_agent forceSpeed 8;
sleep 1;
};
_agent setVariable ["targets",[],true];
_isAlive = alive _agent;
sleep 1;
};
if {_doloiter and _isAlive} then {
[_agent,_missposition] call zeds_loiter;
};
sleep 5;
zeds_loiter function:
Code:
private ["_unit","_originalPos","_movepos"];
_unit = _this select 0;
_originalPos = _this select 1;
_movepos = [_originalPos,((round(random 10)) max 5),((round(random 20)) max 10),((round(random 5)) max 1),0,((round(random 25)) max 5),0] call BIS_fnc_findSafePos;
_unit moveTo _movepos;
_unit forceSpeed 2;
zeds_findTarget is just the same as zombie_findTagetAgent from dayz_code
Also I think zombie missions are going to be rather easy cause ussualy players attack from 300+ m distance and this will prevent zeds anger, but making zeds to search for target in 500m radius is also will break the realistic. So I thought of making some kind of re-working their behaviour, so if they hear a shot ora vehicle in 500m radius they should loiter those direction until it is in < 300m distance. Then if zed can see the target then he runs, if not continue loiter until the target is in <100m distance.
The second thing is that most players will try to use a car for killing zeds, zo i wonder is there a way to make a vehicle get damaged when zeds or other units?
Last edited: