Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DayZ Epoch 1.0.6 Updates #153

Merged
merged 11 commits into from Jul 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
@@ -1,7 +1,7 @@
WICKED AI 2.2.0
==============

Since I really like (read love) the Wicked AI missions and support for them has gone in the latest patches, I decided to dust off the old files and start making these 1.0.5+ compatible. Starting with a few minor bugfixes and some custom loadouts, but quickly turning into a proper redo with awesome help of the - very much alive - mod community!
Since I really like (read love) the Wicked AI missions and support for them has gone in the latest patches, I decided to dust off the old files and start making these 1.0.6+ compatible. Starting with a few minor bugfixes and some custom loadouts, but quickly turning into a proper redo with awesome help of the - very much alive - mod community!

### Release 2.2.0
- Native Linux server support
Expand Down Expand Up @@ -106,7 +106,7 @@ Note: These are on by default, change *wai_radio_announce* in config.sqf to *fal

Find:
~~~~
class DayZ_loadingScreen
#include "\z\addons\dayz_code\gui\description.hpp"
~~~~

Add above
Expand Down
20 changes: 16 additions & 4 deletions WAI/compile/ai_monitor.sqf
@@ -1,6 +1,6 @@
if (isServer) then {

private["_killedat"];
private ["_killedat","_sound"];

diag_log "WAI: AI Monitor Started";

Expand All @@ -11,10 +11,22 @@ if (isServer) then {
_killedat = _x getVariable "killedat";
if (!isNil "_killedat") then {
if ((time - _killedat) >= ai_cleanup_time) then {
deleteVehicle _x;
//Delete flies and body
PVCDZ_flies = [0,_x];
publicVariable "PVCDZ_flies";
_sound = _x getVariable ["sched_co_fliesSource", nil];
if !(isNil "_sound") then {
detach _sound;
deleteVehicle _sound;
};
_x spawn {
// Wait for PVEH to finish on all clients
uiSleep 15;
_this call sched_co_deleteVehicle;
};
};
};
} count allDead;
} forEach allDead;
};

if(debug_mode) then {
Expand All @@ -28,4 +40,4 @@ if (isServer) then {

};

};
};
6 changes: 3 additions & 3 deletions WAI/compile/custom_publish_vehicle.sqf
Expand Up @@ -65,7 +65,7 @@ if (isServer) then {
_dam = 0.8
};

_isglass = ["glass", _selection] call KK_fnc_inString;
_isglass = ["glass", _selection] call fnc_inString;

if(!_isglass && _dam > 0.1) then {
_vehicle setHit[_selection,_dam];
Expand All @@ -81,7 +81,7 @@ if (isServer) then {

};

_vehicle addeventhandler ["HandleDamage",{ _this call vehicle_handleDamage } ];
_vehicle addeventhandler ["HandleDamage",{ _this call fnc_veh_handleDam } ];

if (wai_lock_vehicles) then {
_keyid = ceil(random(12500));
Expand All @@ -108,7 +108,7 @@ if (isServer) then {
_vehicle setVariable ["CharacterID","0",true];
};

PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_vehicle];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_vehicle];

if(wai_keep_vehicles) then {

Expand Down
4 changes: 2 additions & 2 deletions WAI/compile/dynamic_crate.sqf
Expand Up @@ -9,7 +9,7 @@ if(typeName (_this select 1) == "ARRAY") then {
_weapons_array = (_this select 1) select 1;
} else {
_num_weapons = _this select 1;
_weapons_array = ai_wep_random call BIS_fnc_selectRandom;;
_weapons_array = ai_wep_random call BIS_fnc_selectRandom;
};

if(typeName (_this select 2) == "ARRAY") then {
Expand Down Expand Up @@ -40,7 +40,7 @@ if(debug_mode) then {
diag_log format["WAI: Spawning in a dynamic crate with %1 guns, %2 tools, %3 items and %4 backpacks",_num_weapons,_num_tools,_num_items,_num_backpacks];
};

PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_crate];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_crate];

clearWeaponCargoGlobal _crate;
clearMagazineCargoGlobal _crate;
Expand Down
23 changes: 0 additions & 23 deletions WAI/compile/functions.sqf
Expand Up @@ -55,27 +55,4 @@ hero_warning = {
} forEach playableUnits;
_running = (typeName (wai_mission_data select _mission) == "ARRAY");
};
};

KK_fnc_inString = {

private ["_needle","_haystack","_needleLen","_hay","_found"];

_needle = [_this, 0, "", [""]] call BIS_fnc_param;

_haystack = toArray ([_this, 1, "", [""]] call BIS_fnc_param);
_needleLen = count toArray _needle;

_hay = +_haystack;
_hay resize _needleLen;
_found = false;

for "_i" from _needleLen to count _haystack do {

if (toString _hay == _needle) exitWith {_found = true};
_hay set [_needleLen, _haystack select _i];
_hay set [0, "x"]; _hay = _hay - ["x"]
};

_found
};
4 changes: 2 additions & 2 deletions WAI/compile/heli_para.sqf
Expand Up @@ -125,12 +125,12 @@ if (isServer) then {
} count _skillarray;

{
_x addweapon "Makarov";
_x addweapon "Makarov_DZ";
_x addmagazine "8Rnd_9x18_Makarov";
_x addmagazine "8Rnd_9x18_Makarov";
} count (units _unitgroup);

PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_helicopter];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_helicopter];
[_helicopter] spawn vehicle_monitor;

_unitGroup allowFleeing 0;
Expand Down
4 changes: 2 additions & 2 deletions WAI/compile/heli_patrol.sqf
Expand Up @@ -100,7 +100,7 @@ if (isServer) then {
} count _aicskill;

{
_x addweapon "Makarov";
_x addweapon "Makarov_DZ";
_x addmagazine "8Rnd_9x18_Makarov";
_x addmagazine "8Rnd_9x18_Makarov";
} count (units _unitgroup);
Expand All @@ -109,7 +109,7 @@ if (isServer) then {
_x addEventHandler ["Killed",{[_this select 0, _this select 1, "air"] call on_kill;}];
} forEach (units _unitgroup);

PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_helicopter];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_helicopter];
[_helicopter] spawn vehicle_monitor;

_unitGroup allowFleeing 0;
Expand Down
46 changes: 12 additions & 34 deletions WAI/compile/mission_winorfail.sqf
Expand Up @@ -39,7 +39,7 @@ if(isServer) then {
} else {
[nil,nil,rTitleText,_msgstart,"PLAIN",10] call RE;
};

clearWeaponCargoGlobal _crate;
clearMagazineCargoGlobal _crate;

Expand All @@ -52,7 +52,7 @@ if(isServer) then {

while {!_start && !_timeout} do {

sleep 1;
uiSleep 1;
_currenttime = time;

{
Expand All @@ -78,7 +78,7 @@ if(isServer) then {

while {!_timeout && !_complete} do {

sleep 1;
uiSleep 1;
_currenttime = time;
{
if((isPlayer _x) && (_x distance _position <= wai_timeout_distance)) then {
Expand Down Expand Up @@ -157,7 +157,7 @@ if(isServer) then {

if (typeOf(_crate) in (crates_large + crates_medium + crates_small)) then {

if(wai_crates_smoke && sunOrMoon == 1) then {
if (wai_crates_smoke && sunOrMoon == 1) then {
_marker = "smokeShellPurple" createVehicle getPosATL _crate;
_marker setPosATL (getPosATL _crate);
_marker attachTo [_crate,[0,0,0]];
Expand All @@ -168,14 +168,8 @@ if(isServer) then {
_marker setPosATL (getPosATL _crate);
_marker attachTo [_crate, [0,0,0]];

_in_range = _crate nearEntities ["CAManBase",1250];

{
if(isPlayer _x && _x != player) then {
PVDZE_send = [_x,"RoadFlare",[_marker,0]];
publicVariableServer "PVDZE_send";
};
} count _in_range;
PVDZ_obj_RoadFlare = [_marker,0];
publicVariable "PVDZ_obj_RoadFlare";

};

Expand Down Expand Up @@ -218,7 +212,6 @@ if(isServer) then {
_finish_time = time;
_cleaned = false;
while {!_cleaned} do {

_playernear = false;

{
Expand All @@ -228,29 +221,18 @@ if(isServer) then {
_currenttime = time;

if ((_currenttime - _finish_time >= wai_clean_mission_time) && !_playernear) then {

{
if(typeName _x == "ARRAY") then {

if (typeName _x == "ARRAY") then {
{
if ((_x getVariable ["ObjectID", nil]) == nil) then {
deleteVehicle _x;
};
if !(_x isKindOf "AllVehicles") then {deleteVehicle _x;};
} count _x;

} else {
if ((_x getVariable ["ObjectID", nil]) == nil) then {
deleteVehicle _x;
};
if !(_x isKindOf "AllVehicles") then {deleteVehicle _x;};
};

} forEach _clean;

_cleaned = true;

};

sleep 1;
uiSleep 1;
};
};
};
Expand Down Expand Up @@ -284,16 +266,12 @@ if(isServer) then {

{
if(typeName _x == "ARRAY") then {

{
deleteVehicle _x;
} count _x;

} else {

deleteVehicle _x;
};

};
} forEach _baseclean + ((wai_mission_data select _mission) select 2) + [_crate];

if (wai_radio_announce) then {
Expand All @@ -310,4 +288,4 @@ if(isServer) then {
wai_mission_data set [_mission, -1];
_complete

};
};
1 change: 1 addition & 0 deletions WAI/compile/on_kill.sqf
Expand Up @@ -24,6 +24,7 @@ if (isServer) then {
};
};
_unit setVariable ["killedat", time];
_unit setVariable ["bodyName","unknown",false]; //Only needed on server to prevent immediate cleanup in sched_corpses.sqf

if(ai_add_skin) then {

Expand Down
4 changes: 2 additions & 2 deletions WAI/compile/patrol.sqf
Expand Up @@ -65,7 +65,7 @@ if (isServer) then {
diag_log "WAI: Vehicle became undriveable, ejecting crew.";
};

deleteWaypoint [_unitgroup, all];
while {(count (waypoints _unitgroup)) > 0} do {deleteWaypoint ((waypoints _unitgroup) select 0);};

waitUntil { (speed _vehicle < 10) }; // Wait until vehicle slows down before ejecting crew

Expand Down Expand Up @@ -123,4 +123,4 @@ if (isServer) then {

};

};
};
2 changes: 1 addition & 1 deletion WAI/compile/spawn_group.sqf
Expand Up @@ -219,4 +219,4 @@ if (isServer) then {
diag_log format ["WAI: Spawned a group of %1 AI (%3) at %2",_unitnumber,_position,_aitype];

_unitGroup
};
};
2 changes: 1 addition & 1 deletion WAI/compile/spawn_static.sqf
Expand Up @@ -156,7 +156,7 @@ if (isServer) then {
ai_emplacement_units = (ai_emplacement_units + 1);
_unit addEventHandler ["Killed",{[_this select 0, _this select 1, "static"] call on_kill;}];
_static addEventHandler ["GetOut",{(_this select 0) setDamage 1;}];
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_static];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_static];

if (sunOrMoon != 1) then {
_unit addweapon "NVGoggles";
Expand Down
4 changes: 2 additions & 2 deletions WAI/compile/vehicle_patrol.sqf
Expand Up @@ -65,7 +65,7 @@ if (isServer) then {
_vehicle allowCrewInImmobile true;
_vehicle lock true;

PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_vehicle];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_vehicle];

_pilot assignAsDriver _vehicle;
_pilot moveInDriver _vehicle;
Expand All @@ -92,7 +92,7 @@ if (isServer) then {
} count _skillarray;

{
_x addweapon "Makarov";
_x addweapon "Makarov_DZ";
_x addmagazine "8Rnd_9x18_Makarov";
_x addmagazine "8Rnd_9x18_Makarov";
} count (units _unitgroup);
Expand Down