mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Update zombie alerting
- zombie will be triggered by chemlights only at night now
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
private ["_unit","_distance","_doRun","_pos","_listTalk","_zombie"];
|
private ["_unit","_distance","_doRun","_pos","_listTalk","_zombie","_50","_localtargets","_remotetargets","_targets","_dis"];
|
||||||
|
|
||||||
_unit = _this select 0;
|
_unit = _this select 0;
|
||||||
_distance = _this select 1;
|
_distance = _this select 1;
|
||||||
@@ -6,43 +6,32 @@ _doRun = _this select 2;
|
|||||||
_pos = _this select 3;
|
_pos = _this select 3;
|
||||||
|
|
||||||
_listTalk = _pos nearEntities ["zZombie_Base",_distance];
|
_listTalk = _pos nearEntities ["zZombie_Base",_distance];
|
||||||
_inVehicle = (vehicle _unit != _unit);
|
|
||||||
_isAir = vehicle player iskindof "Air";
|
|
||||||
_isLand = vehicle player iskindof "Land";
|
|
||||||
_isSea = vehicle player iskindof "Sea";
|
|
||||||
_speed = speed (vehicle _unit);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
private["_localtargets","_remotetargets","_targets","_dis"];
|
|
||||||
|
|
||||||
_distance = _distance max floor(_distance*.9);
|
_distance = _distance max floor(_distance*.9);
|
||||||
|
|
||||||
_dis = _x distance _unit;
|
_dis = _x distance _unit;
|
||||||
_zombie = _x;
|
_zombie = _x;
|
||||||
|
|
||||||
switch (true) do {
|
call {
|
||||||
case (_dis < 51): {
|
if (_dis < 51) exitwith {
|
||||||
if (_doRun) then {
|
if (_doRun) then {
|
||||||
_localtargets = _x getVariable ["localtargets",[]];
|
_localtargets = _x getVariable ["localtargets",[]];
|
||||||
_remotetargets = _x getVariable ["remotetargets",[]];
|
_remotetargets = _x getVariable ["remotetargets",[]];
|
||||||
_targets = _localtargets + _remotetargets;
|
_targets = _localtargets + _remotetargets;
|
||||||
if (!(_unit in _targets)) then {
|
if (!(_unit in _targets)) then {
|
||||||
switch (local _x) do {
|
if !(local _x) then {
|
||||||
case false: {
|
_remotetargets set [count _remotetargets,_unit];
|
||||||
_remotetargets set [count _remotetargets,_unit];
|
_x setVariable ["remotetargets",_remotetargets,true];
|
||||||
_x setVariable ["remotetargets",_remotetargets,true];
|
} else {
|
||||||
};
|
_localtargets set [count _localtargets,_unit];
|
||||||
case true: {
|
_x setVariable ["localtargets",_localtargets,false];
|
||||||
_localtargets set [count _localtargets,_unit];
|
|
||||||
_x setVariable ["localtargets",_localtargets,false];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
_zombie setVariable ["myDest",_pos,true];
|
_zombie setVariable ["myDest",_pos,true];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
case ((_dis > 50) and (_dis <= 71)): {
|
if ((_dis > 50) && {_dis <= 71}) exitwith {
|
||||||
_50 = round(random 100);
|
_50 = round(random 100);
|
||||||
if (_50 < 50) then {
|
if (_50 < 50) then {
|
||||||
if (_doRun) then {
|
if (_doRun) then {
|
||||||
@@ -50,15 +39,12 @@ private["_localtargets","_remotetargets","_targets","_dis"];
|
|||||||
_remotetargets = _x getVariable ["remotetargets",[]];
|
_remotetargets = _x getVariable ["remotetargets",[]];
|
||||||
_targets = _localtargets + _remotetargets;
|
_targets = _localtargets + _remotetargets;
|
||||||
if (!(_unit in _targets)) then {
|
if (!(_unit in _targets)) then {
|
||||||
switch (local _x) do {
|
if !(local _x) then {
|
||||||
case false: {
|
_remotetargets set [count _remotetargets,_unit];
|
||||||
_remotetargets set [count _remotetargets,_unit];
|
_x setVariable ["remotetargets",_remotetargets,true];
|
||||||
_x setVariable ["remotetargets",_remotetargets,true];
|
} else {
|
||||||
};
|
_localtargets set [count _localtargets,_unit];
|
||||||
case true: {
|
_x setVariable ["localtargets",_localtargets,false];
|
||||||
_localtargets set [count _localtargets,_unit];
|
|
||||||
_x setVariable ["localtargets",_localtargets,false];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@@ -68,31 +54,8 @@ private["_localtargets","_remotetargets","_targets","_dis"];
|
|||||||
_zombie setVariable ["myDest",_pos,true];
|
_zombie setVariable ["myDest",_pos,true];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
case (_dis > 70): {
|
if (_dis > 70) exitwith {
|
||||||
_zombie setVariable ["myDest",_pos,true];
|
_zombie setVariable ["myDest",_pos,true];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
} count _listTalk;
|
||||||
/*
|
|
||||||
_zombie = _x;
|
|
||||||
if (_doRun) then {
|
|
||||||
_localtargets = _x getVariable ["localtargets",[]];
|
|
||||||
_remotetargets = _x getVariable ["remotetargets",[]];
|
|
||||||
_targets = _localtargets + _remotetargets;
|
|
||||||
if (!(_unit in _targets)) then {
|
|
||||||
switch (local _x) do {
|
|
||||||
case false: {
|
|
||||||
_remotetargets set [count _remotetargets,_unit];
|
|
||||||
_x setVariable ["remotetargets",_remotetargets,true];
|
|
||||||
};
|
|
||||||
case true: {
|
|
||||||
_localtargets set [count _localtargets,_unit];
|
|
||||||
_x setVariable ["localtargets",_localtargets,false];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
_zombie setVariable ["myDest",_pos,true];
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
} forEach _listTalk;
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ _projectile = _this select 6;
|
|||||||
//Alert Nearby
|
//Alert Nearby
|
||||||
_audible = getNumber (configFile >> "CfgAmmo" >> _ammo >> "audibleFire");
|
_audible = getNumber (configFile >> "CfgAmmo" >> _ammo >> "audibleFire");
|
||||||
_caliber = getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber");
|
_caliber = getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber");
|
||||||
_distance = round(_audible * 10 * _caliber);
|
_distance = round(_audible * 20 * _caliber);
|
||||||
|
|
||||||
dayz_disAudial = _distance;
|
dayz_disAudial = _distance;
|
||||||
dayz_firedCooldown = time;
|
dayz_firedCooldown = time;
|
||||||
@@ -24,11 +24,12 @@ if (_ammo isKindOf "Melee") exitWith {
|
|||||||
_this call player_harvest; // harvest wood check
|
_this call player_harvest; // harvest wood check
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((_ammo isKindOf "SmokeShell") or (_ammo isKindOf "GrenadeHandTimedWest") or (_ammo isKindOf "G_40mm_HE")) then {
|
if ((_ammo isKindOf "SmokeShell") || {_ammo isKindOf "GrenadeHandTimedWest"} || {_ammo isKindOf "G_40mm_HE"}) then {
|
||||||
if (_ammo isKindOf "G_40mm_HE") then { dayz_disAudial = 30 };
|
if (_ammo isKindOf "G_40mm_HE") then { dayz_disAudial = 30 };
|
||||||
|
|
||||||
[_unit,_ammo] spawn {
|
[_unit,_ammo] spawn {
|
||||||
private ["_pos","_group","_localtargets","_remotetargets"];
|
private ["_pos","_group","_localtargets","_remotetargets","_unit","_ammo","_projectile","_isLocal","_targets"];
|
||||||
|
|
||||||
_unit = _this select 0;
|
_unit = _this select 0;
|
||||||
_ammo = _this select 1;
|
_ammo = _this select 1;
|
||||||
|
|
||||||
@@ -52,18 +53,15 @@ if ((_ammo isKindOf "SmokeShell") or (_ammo isKindOf "GrenadeHandTimedWest") or
|
|||||||
_remotetargets = _group getVariable ["remotetargets",[]];
|
_remotetargets = _group getVariable ["remotetargets",[]];
|
||||||
_targets = _localtargets + _remotetargets;
|
_targets = _localtargets + _remotetargets;
|
||||||
if !(_projectile in _targets) then {
|
if !(_projectile in _targets) then {
|
||||||
switch (_isLocal) do {
|
if (!_isLocal) then {
|
||||||
case false: {
|
_remotetargets set [count _remotetargets,_projectile];
|
||||||
_remotetargets set [count _remotetargets,_projectile];
|
_x setVariable ["remotetargets",_remotetargets,true];
|
||||||
_x setVariable ["remotetargets",_remotetargets,true];
|
} else {
|
||||||
};
|
_localtargets set [count _localtargets,_projectile];
|
||||||
case true: {
|
_x setVariable ["localtargets",_localtargets,false];
|
||||||
_localtargets set [count _localtargets,_projectile];
|
|
||||||
_x setVariable ["localtargets",_localtargets,false];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} forEach (_pos nearEntities ["zZombie_Base",50]);
|
} count (_pos nearEntities ["zZombie_Base",50]);
|
||||||
} else {
|
} else {
|
||||||
while {alive _projectile} do {
|
while {alive _projectile} do {
|
||||||
_pos = getPosATL _projectile;
|
_pos = getPosATL _projectile;
|
||||||
@@ -100,7 +98,7 @@ if ((_ammo isKindOf "SmokeShell") or (_ammo isKindOf "GrenadeHandTimedWest") or
|
|||||||
publicVariable "PVDZ_obj_RoadFlare";
|
publicVariable "PVDZ_obj_RoadFlare";
|
||||||
[_this] spawn player_throwObject;
|
[_this] spawn player_throwObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Auto select main weapon after throwing
|
//Auto select main weapon after throwing
|
||||||
call player_selectWeapon;
|
call player_selectWeapon;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,31 +1,33 @@
|
|||||||
private ["_distance","_endPos","_doWait","_vel"];
|
if (isNil "dayz_sunRise") exitwith {};
|
||||||
|
|
||||||
|
private ["_distance","_endPos","_doWait","_vel","_obj","_unit","_ammo","_projectile"];
|
||||||
|
|
||||||
_obj = _this select 0;
|
_obj = _this select 0;
|
||||||
_unit = _obj select 0;
|
_unit = _obj select 0;
|
||||||
//_weapon = _obj select 1;
|
|
||||||
_ammo = _obj select 4;
|
_ammo = _obj select 4;
|
||||||
_projectile = _obj select 6;
|
_projectile = _obj select 6;
|
||||||
|
|
||||||
waituntil {!isNil "dayz_sunRise"};
|
|
||||||
|
|
||||||
_projectile = nearestObject [_unit,_ammo];
|
_projectile = nearestObject [_unit,_ammo];
|
||||||
_endPos = getPosATL _projectile;
|
_endPos = getPosATL _projectile;
|
||||||
|
|
||||||
_doWait = true;
|
_doWait = true;
|
||||||
|
|
||||||
while {_doWait} do {
|
while {_doWait} do {
|
||||||
_vel = (velocity _projectile) distance [0,0,0];
|
_vel = (velocity _projectile) distance [0,0,0];
|
||||||
if !(alive _projectile) then {_doWait = false};
|
if !(alive _projectile) then {_doWait = false};
|
||||||
if (_vel < 0.1) then {_doWait = false};
|
if (_vel < 0.2) then {_doWait = false};
|
||||||
_endPos = getPosATL _projectile;
|
_endPos = getPosATL _projectile;
|
||||||
uiSleep 0.01;
|
uiSleep 0.01;
|
||||||
};
|
};
|
||||||
|
|
||||||
_distance = parseNumber format["%1",(getArray (configFile >> "CfgAmmo" >> _ammo >> "soundHit") select 3)];
|
_distance = parseNumber format["%1",(getArray (configFile >> "CfgAmmo" >> _ammo >> "soundHit") select 3)];
|
||||||
|
|
||||||
if (_ammo isKindOf "ChemLight") then {
|
if (_ammo isKindOf "ChemLight" && {daytime > 18 || daytime < 7}) exitwith {
|
||||||
_distance = 10;
|
_distance = 10;
|
||||||
|
[_unit,_distance,false,_endPos] call player_alertZombies;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_ammo isKindOf "RoadFlare") then {
|
if (_ammo isKindOf "RoadFlare") then {
|
||||||
_distance = if ((daytime < (24 - dayz_sunRise)) && (daytime > dayz_sunRise)) then {30} else {60};
|
_distance = [60,30] select ((daytime < (24 - dayz_sunRise)) && {daytime > dayz_sunRise})
|
||||||
};
|
};
|
||||||
|
|
||||||
[_unit,_distance,false,_endPos] call player_alertZombies;
|
[_unit,_distance,false,_endPos] call player_alertZombies;
|
||||||
|
|||||||
@@ -1,32 +1,24 @@
|
|||||||
private ["_agent","_range","_target","_targets","_man","_manDis","_localtargets","_remotetargets"];
|
private ["_agent","_range","_target","_targets","_man","_manDis","_localtargets","_remotetargets"];
|
||||||
|
|
||||||
_agent = _this;
|
_agent = _this;
|
||||||
|
|
||||||
if (isNull _agent) exitWith {objNull}; // Prevent errors if zombie is suddenly deleted
|
if (isNull _agent) exitWith {objNull}; // Prevent errors if zombie is suddenly deleted
|
||||||
|
|
||||||
_target = objNull;
|
_target = objNull;
|
||||||
_targets = [];
|
_targets = [];
|
||||||
//_targetDis = [];
|
|
||||||
_range = 100;
|
_range = 100;
|
||||||
_manDis = 0;
|
_manDis = 0;
|
||||||
|
|
||||||
_localtargets = _agent getVariable ["localtargets",[]];
|
_localtargets = _agent getVariable ["localtargets",[]];
|
||||||
_remotetargets = _agent getVariable ["remotetargets",[]];
|
_remotetargets = _agent getVariable ["remotetargets",[]];
|
||||||
|
|
||||||
if (isNil "_localtargets") then{
|
|
||||||
_localtargets = [];
|
|
||||||
};
|
|
||||||
if (isNil "_remotetargets") then{
|
|
||||||
_remotetargets = [];
|
|
||||||
};
|
|
||||||
_targets = _localtargets + _remotetargets;
|
_targets = _localtargets + _remotetargets;
|
||||||
|
|
||||||
//diag_log ("Targets: " +str(_targets));
|
//diag_log ("Targets: " +str(_targets));
|
||||||
|
|
||||||
//if (isNil "_targets") exitWith {};
|
|
||||||
|
|
||||||
//Search for objects
|
//Search for objects
|
||||||
if (count _targets == 0) then {
|
if (count _targets == 0) then {
|
||||||
//"ThrownObjects","GrenadeHandTimedWest","SmokeShell"]
|
private "_objects";
|
||||||
private["_objects"];
|
|
||||||
_objects = _agent nearObjects ["GrenadeHand", 300];
|
_objects = _agent nearObjects ["GrenadeHand", 300]; //"ThrownObjects","GrenadeHandTimedWest","SmokeShell"]
|
||||||
{
|
{
|
||||||
if (!(_x in _targets)) then {
|
if (!(_x in _targets)) then {
|
||||||
if (local _x) then {
|
if (local _x) then {
|
||||||
@@ -35,7 +27,7 @@ if (count _targets == 0) then {
|
|||||||
_remotetargets set [count _remotetargets,_x];
|
_remotetargets set [count _remotetargets,_x];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} foreach _objects;
|
} count _objects;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Find best target
|
//Find best target
|
||||||
@@ -44,7 +36,7 @@ if (count _targets > 0) then {
|
|||||||
_manDis = _man distance _agent;
|
_manDis = _man distance _agent;
|
||||||
//diag_log (str(_man) + str(_manDis));
|
//diag_log (str(_man) + str(_manDis));
|
||||||
{
|
{
|
||||||
private["_dis"];
|
private "_dis";
|
||||||
_dis = _x distance _agent;
|
_dis = _x distance _agent;
|
||||||
if (_dis < _manDis) then {
|
if (_dis < _manDis) then {
|
||||||
_man = _x;
|
_man = _x;
|
||||||
@@ -54,7 +46,7 @@ if (count _targets > 0) then {
|
|||||||
_man = _x;
|
_man = _x;
|
||||||
_manDis = _dis;
|
_manDis = _dis;
|
||||||
};
|
};
|
||||||
} forEach _targets;
|
} count _targets;
|
||||||
_target = _man;
|
_target = _man;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user