Jump to content

[RELEASE] WAI 2.2.6


JasonTM

Recommended Posts

Wicked AI 2.2.6

This release is for DayZ Epoch/Overpoch 1.0.6.2.

<<<Download Here>>>

Due to reports of poor performance on high population servers. I have rewritten this mod so it runs more efficiently.

Most of the work is code optimization and bug fixes, but I did add some new features.

Review of changes

  • Each mission only spawns one thread with one loop unless it has a para-drop, then it spawns two.
  • The patrol missions also spawn two threads for now.
  • The mission files no longer suspend, waiting for the mission to complete to spawn the crate loot and remove the mission data.
  • The minefield feature no longer spawns an individual thread for each mine. It uses a player check radius.
  • Players in vehicles receive a bold red warning when they are 200 meters from the edge of a mine field.
  • Optional mission vehicle entry messages.
  • Improved mission clean up. All mission objects and data are deleted including unclaimed vehicles and AI unit groups.
  • The AI monitor loop has been replaced by a modified version of the server scheduled function sched_corpses.
  • AI vehicles no longer spawn their own vehicle monitoring threads. It is all handled in the mission thread in a queue.
  • The invisible static gun glitch has been fixed.
  • The static spawns have a dedicated monitoring loop much like the mission system. One loop manages all vehicles and deletes AI unit groups.
  • Where possible, I moved commonly used code blocks to compiled functions.
  • I made a few new missions - hero outpost, bandit outpost, and farmer.
  • Captured MV-22, medical camp, and weapon cache missions have been reworked for improved aesthetics and/or functionality.
  • Rewritten auto claim feature that is fully integrated.
  • Boat patrols - examples in the static mission files.
  • Redundant and\or unnecessary code has been removed from some of the files.
  • I cleaned up and standardized the formatting in the mission files and elsewhere.
  • Helicopters for AI drops and patrols start at a random distance of 3k to 4k away from the mission instead of way down by debug island.
  • Added a new check for mission locations. As they are used, positions get added to an array and checked in find_position.sqf, so missions will not spawn in the same spot twice.
  • Optional indestructible mission vehicles.
  • The AI and mission clean up times and spawn schedule in config.sqf have been converted to minutes for easier reading.
  • Fixed an issue with the spawn time delays in the mission init file.
  • Adjusted the distance the vehicles spawn from the crate so there is no trouble with accessing gear when near a locked vehicle.
  • You can disable static gun placements, vehicle patrols, and paratrooper drops on missions with variables in config.sqf
  • AI numbers have been standardized on all missions. You can adjust the numbers. Easy = 5-10, Medium = 10-15, Hard = 15-20, Extreme = 20-25.
  • I removed the cache units feature because it spawns a thread with a monitoring loop for each unit group and it only works on ground troops.
  • I moved the Dynamic Text mission announcements up the screen and made the text a little smaller so it is not so overwhelming.
  • Added a second dynamic text option for the minefield warnings.
  • Fixed the "auto-repair" glitch on mission vehicles. This also fixes the inability to repair mission vehicles due to the hitpoint variables not being set.

Notes

  • The AK_74 and RPK_74 variants have been disabled in config.sqf until the 1.0.6.3 patch because the 45rnd 5.45mm magazine was removed in the A2 OA 1.64 corepatch and they post errors to the logs.
  • The format of the missions has changed, so if you have your own custom missions they will have to be adjusted.
  • I have updated the mission example file and created a new mission example file for a single spawn point mission. They are heavy on comments to help server owners create their own missions.
  • I have left extensive comments throughout the updated files if you want to understand more about how the updated code and functions work.

Since this is a major coding overhaul, this release will not be merged into the main github repository until all potential bugs, errors, and incompatibilities have been corrected. Please report errors, discrepancies, and general weirdness in this topic.

Also, most of the files have been altered, so please use this version as a base and merge your custom files into it, paying attention to the changes.

 

 

Optional Mission Vehicle Entry Messages

If you turn this option on players will get a message that says either "You have claimed this vehicle! It is now saved to the database." or "WARNING: This vehicle will be deleted at restart!" depending on if you have vehicle hive saving turned on or not. This feature can be toggled with this variable:

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/config.sqf#L101

Indestructible Mission Vehicles

This option will disable the damage handlers on mission vehicles until a player enters them. It can be toggled on and off with this variable:

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/config.sqf#L99

Avoid Same Spot

This option will prevent a mission spawning in the same spot twice by adding the position to an array. The find position function will check that a new position will not be selected that is within 200 meters of one that was previously used.

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/config.sqf#L80

Enable/Disable Static Gun Placements, Vehicle Patrols, and Paradrops

I added this feature for scalability and because someone asked for it. These are the variables to set true or false.

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/config.sqf#L115-L117

Auto-Claim

The original author of the auto-claim feature is no longer a part of this community. I wrote my own version of it which is fully integrated. I never really used this mod myself in the past, so please let me know if I need to add features that were there previously.

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/config.sqf#L222-L229

Boat Patrols

There is really no difference between a boat patrol and a land vehicle patrol other than the classname of the vehicle the fact that they spawn offshore. I have placed examples in the static mission files and I left my Skalisty Island test boat patrols commented in the chernarus.sqf file. To activate them, enable the static_per_world feature in config.sqf and remove the comments from this section:

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/static/Chernarus.sqf#L114-L147

When creating boat patrols you should make sure that the distance you place them offshore is at least the distance of the radius used for waypoints, otherwise the waypoints will be on land and the AI might not handle the boat correctly.

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/static/Chernarus.sqf#L140

Mission Cleanup

All mission data and mission objects will be removed from the map after mission completion or mission timeout, including the ai unit groups and unclaimed mission vehicles. You can remove the crates from cleanup if  you want them to remain on the map for looting by toggling this variable to false:

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/config.sqf#L94

If a player is within 75 meters of the crate, it will not be deleted as it is assumed that it is still being looted.

To "claim" a mission vehicle, a player simply has to get into it and it will not be deleted.

Invisible Static Gun Glitch

Credit to salival for discovering that this was a JIP issue and the fix is to have the AI get out and back into the static gun at regular intervals. During testing, I could not even see this happening unless I added a sleep, so players shouldn't notice.

Static Spawn Manager

Instead of having each static spawned group and vehicle spawn its own monitoring thread, the data is added to a multi-dimensional array and monitored in one loop. The monitor is spawned from the static init.sqf file and will shut down when all null AI groups have been removed from the array.

 

The Overwatch configs have been moved to its own file in the configs folder. The file is not loaded unless the Overwatch mod is detected.

According to KillZone Kid and other Arma super nerds, when selecting random things from arrays, it is faster to use a statement like this: selection = array select (floor (random (count array))); instead of calling BIS_fnc_selectRandom. I replaced several instances in files where it is called repeatedly like dynamic crate and group spawning. This might save a millisecond or two :).

That is all of the updates I can think of right now. If I can remember more, I will add them.

 

 

Thanks to @MerlijnD and @LadyVal for testing my initial files.

Credit to @salivalfor the invisible static gun glitch fix.

Credit to @ibenfor the original IWAC.

Credit to @BigEgg for the localization solution

Credit to @Schalldampfer for testing and finding bugs

Credit to @Grahame for assistance in discord with mission vehicle spawning issue

 

 

Link to comment
Share on other sites

10 minutes ago, DAmNRelentless said:

Good work on that Jason. Cool that you maintain this repository since all of the existing mission systems are huge performance impacts.

I'll take a look on the repo when I have some time. Keep it up!

Thanks. That was hard work, but someone has to do it I suppose.

Link to comment
Share on other sites

51 minutes ago, RedLink said:

Localized WAI 2.2.5

in arhive mission files (hero/bandit) for WAI and stringtable.xml

https://yadi.sk/d/F0ZRMIdk3Wgnis

Hello,

This won't work how you think it does, it is what I was trying to explain on discord

If the server is started up in English locale, it will always send an english translation, same if the server locale is german, it will send a german translation.

I think the better way to do it is to modify remote_message.sqf in ZSC/WAI to be able to send the specific stringtable reference (i.e "STR_CL_VG_NEED_HELIPAD") from the server to the client and the client then just uses that localization, infact that's what I'll do

Link to comment
Share on other sites

Hi there,

I have loaded this up and it works great except for two things:

1. When I approach larger circle of the mission that signifies the claiming radius and I accept that I want to claim the mission, it correctly displays a message that I have claimed it. But as I am advancing toward the mission or if I stand behind a tree doing nothing but still within the claiming radius, it displays a message that I have moved out of the circle and no longer have a claim on the mission. Then it just keeps running that loop where it gives me the claim then takes it away (about every 15-30 seconds) while I am just standing there or moving closer to the mission.

2. I don't really understand the crate format in the default.sqf file. I have tried to use the format I was using but all it does is spawn light machine gun ammo in every crate. Can you please give me an example of how it should look? The format I used before in the earlier version is in the spoiler below.

Other than that, this is awesome so far. Thanks again!

Spoiler

_crate = createVehicle ["USVehicleBox",[13697.3,2937.91,0.001],[],0,"CAN_COLLIDE"];
_crate1 = createVehicle ["USVehicleBox",[13711.3,2943.25,0.001],[],0,"CAN_COLLIDE"];
_crate2 = createVehicle ["USVehicleBox",[3891.1,7888.03,0.00140381],[],0,"CAN_COLLIDE"];
_crate3 = createVehicle ["USVehicleBox",[3907.08,7886.69,0.00140381],[],0,"CAN_COLLIDE"];
_crate4 = createVehicle ["USVehicleBox",[6881.97,11463.4,0.00149536],[],0,"CAN_COLLIDE"];

[_crate] call wai_crate_setup;
[_crate1] call wai_crate_setup;
[_crate2] call wai_crate_setup;
[_crate3] call wai_crate_setup;
[_crate4] call wai_crate_setup;

[_crate,[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4] call dynamic_crate;
[_crate1,[16,ai_wep_sniper],[8,crate_tools_sniper],[3,crate_items_high_value],[4,crate_backpacks_large]] call dynamic_crate;
[_crate2,[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4] call dynamic_crate;
[_crate3,[16,ai_wep_sniper],[8,crate_tools_sniper],[3,crate_items_high_value],[4,crate_backpacks_large]] call dynamic_crate;
[_crate4,[16,ai_wep_sniper],[8,crate_tools_sniper],[3,crate_items_high_value],[4,crate_backpacks_large]] call dynamic_crate;

 

Link to comment
Share on other sites

1 hour ago, Vladick said:

Hi there,

I have loaded this up and it works great except for two things:

1. When I approach larger circle of the mission that signifies the claiming radius and I accept that I want to claim the mission, it correctly displays a message that I have claimed it. But as I am advancing toward the mission or if I stand behind a tree doing nothing but still within the claiming radius, it displays a message that I have moved out of the circle and no longer have a claim on the mission. Then it just keeps running that loop where it gives me the claim then takes it away (about every 15-30 seconds) while I am just standing there or moving closer to the mission.

2. I don't really understand the crate format in the default.sqf file. I have tried to use the format I was using but all it does is spawn light machine gun ammo in every crate. Can you please give me an example of how it should look? The format I used before in the earlier version is in the spoiler below.

Other than that, this is awesome so far. Thanks again!

  Reveal hidden contents

_crate = createVehicle ["USVehicleBox",[13697.3,2937.91,0.001],[],0,"CAN_COLLIDE"];
_crate1 = createVehicle ["USVehicleBox",[13711.3,2943.25,0.001],[],0,"CAN_COLLIDE"];
_crate2 = createVehicle ["USVehicleBox",[3891.1,7888.03,0.00140381],[],0,"CAN_COLLIDE"];
_crate3 = createVehicle ["USVehicleBox",[3907.08,7886.69,0.00140381],[],0,"CAN_COLLIDE"];
_crate4 = createVehicle ["USVehicleBox",[6881.97,11463.4,0.00149536],[],0,"CAN_COLLIDE"];

[_crate] call wai_crate_setup;
[_crate1] call wai_crate_setup;
[_crate2] call wai_crate_setup;
[_crate3] call wai_crate_setup;
[_crate4] call wai_crate_setup;

[_crate,[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4] call dynamic_crate;
[_crate1,[16,ai_wep_sniper],[8,crate_tools_sniper],[3,crate_items_high_value],[4,crate_backpacks_large]] call dynamic_crate;
[_crate2,[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4] call dynamic_crate;
[_crate3,[16,ai_wep_sniper],[8,crate_tools_sniper],[3,crate_items_high_value],[4,crate_backpacks_large]] call dynamic_crate;
[_crate4,[16,ai_wep_sniper],[8,crate_tools_sniper],[3,crate_items_high_value],[4,crate_backpacks_large]] call dynamic_crate;

 

Thanks for the feedback. I'll look into the autoclaim issue tonight. For now, just disable it.

The crate format has changed a little bit in this version. So to convert yours, you do this:

This is fine. You have each crate object saved to a unique variable.

_crate = createVehicle ["USVehicleBox",[13697.3,2937.91,0.001],[],0,"CAN_COLLIDE"];
_crate1 = createVehicle ["USVehicleBox",[13711.3,2943.25,0.001],[],0,"CAN_COLLIDE"];
_crate2 = createVehicle ["USVehicleBox",[3891.1,7888.03,0.00140381],[],0,"CAN_COLLIDE"];
_crate3 = createVehicle ["USVehicleBox",[3907.08,7886.69,0.00140381],[],0,"CAN_COLLIDE"];
_crate4 = createVehicle ["USVehicleBox",[6881.97,11463.4,0.00149536],[],0,"CAN_COLLIDE"]; 

Here you just need to remove the brackets around the crate variable. Since only the singular crate variable is sent to the setup function and not an array of objects, I removed the need for the brackets.

_crate call wai_crate_setup;
_crate1 call wai_crate_setup;
_crate2 call wai_crate_setup;
_crate3 call wai_crate_setup;
_crate4 call wai_crate_setup;

Here, the dynamic crate function is asking for two arguments, the crate object and the dynamic array. You just need to put an extra set of brackets around the array so it is one argument as a whole.

[_crate,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate1,[[16,ai_wep_sniper],[8,crate_tools_sniper],[3,crate_items_high_value],[4,crate_backpacks_large]]] call dynamic_crate;
[_crate2,[[2,crate_weapons_buildables],[4,crate_tools_buildable],[30,crate_items_buildables],4]] call dynamic_crate;
[_crate3,[[16,ai_wep_sniper],[8,crate_tools_sniper],[3,crate_items_high_value],[4,crate_backpacks_large]]] call dynamic_crate;
[_crate4,[[16,ai_wep_sniper],[8,crate_tools_sniper],[3,crate_items_high_value],[4,crate_backpacks_large]]] call dynamic_crate;

So you can see that the loot array is an array with nested arrays inside [[1],[2],[3],[4],[5]] or just numbers [1,2,3,4,5] or a mix.

 

 

Link to comment
Share on other sites

Hi mate, this is great. Good work!! 

 

Just a couple of issues. The loot box still spawns in before the mission has been finished. 

And secondly my server rpt displays this

Spoiler

23:51:16 Error in expression <ion) select 4), _helicopter];
} else {
(wai_static_data select 1) set [count (wa>
23:51:16   Error position: <wai_static_data select 1) set [count (wa>
23:51:16   Error Undefined variable in expression: wai_static_data
23:51:16 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 144

 

Link to comment
Share on other sites

15 hours ago, JakeQue said:

Hi mate, this is great. Good work!! 

 

Just a couple of issues. The loot box still spawns in before the mission has been finished. 

And secondly my server rpt displays this

  Reveal hidden contents

23:51:16 Error in expression <ion) select 4), _helicopter];
} else {
(wai_static_data select 1) set [count (wa>
23:51:16   Error position: <wai_static_data select 1) set [count (wa>
23:51:16   Error Undefined variable in expression: wai_static_data
23:51:16 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 144

 

You must be using mixed files because that variable is defined here: https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/static/init.sqf#L2

Install this version and test it, then merge your other files checking for the updated formatting.

Loot boxes always spawn with the mission buildings. The loot in missions does not spawn until the mission is finished. The loot in static spawn boxes spawns right away because there is no completion criteria for static spawns.

Link to comment
Share on other sites

I have updated the auto-claim feature to account for player death. The affected files are missionwinorfail.sqf, functions.sqf, and position_functions.sqf. I also added nil variable checks to sched_corpses.sqf so it doesn't post undefined variable errors if a server owner disables WAI. You can download the new files and replace them, or replace the following sections:

https://github.com/worldwidesorrow/WICKED-AI/blob/master/dayz_server/system/scheduler/sched_corpses.sqf#L3-L4

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/compile/functions.sqf#L77-L107

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/compile/mission_winorfail.sqf#L139-L214

New function added to the bottom of the file to check for returning dead player.

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/compile/position_functions.sqf#L204-L221

Link to comment
Share on other sites

heli_patrol forgot [7] argument

Spoiler

private ["_start_position","_diag_distance","_rndnum","_mission","_aitype","_aiskin","_skin","_aicskill","_wpnum","_radius","_gunner2","_gunner","_skillarray","_startingpos","_heli_class","_startPos","_helicopter","_unitGroup","_pilot","_skill","_position","_wp"];

_position             = _this select 0;
//_startingpos         = _this select 1;
_radius             = _this select 1;
_wpnum                 = _this select 2;
_heli_class         = _this select 3;
_skill                 = _this select 4;
_skin                = _this select 5;
_aitype                = _this select 6;

if (count _this > 8) then {
    _mission = _this select 8;
} else {
    _mission = nil;
};
 

(please left _mission argument, I use it in mission)tiny issue mission_winorfail forgot declaration of private variable

Link to comment
Share on other sites

13 hours ago, JakeQue said:

Hi mate, one more error we have noticed, I have turned off autoclaim but when you get into a mission vehicle, It's alerting all players that the player has claimed that vehicle? 

Replace these two lines.

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/compile/custom_publish_vehicle.sqf#L150

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/compile/custom_publish_vehicle.sqf#L160

I didn't have "loc" in there. I read through the MP framework documentation and it said that it was an "arbitrary setting." I guess it is not so arbitrary.

I updated the file in github, just copy the new lines over.

That has nothing to do with autoclaim.

Link to comment
Share on other sites

3 hours ago, Schalldampfer said:

heli_patrol forgot [7] argument

  Reveal hidden contents

private ["_start_position","_diag_distance","_rndnum","_mission","_aitype","_aiskin","_skin","_aicskill","_wpnum","_radius","_gunner2","_gunner","_skillarray","_startingpos","_heli_class","_startPos","_helicopter","_unitGroup","_pilot","_skill","_position","_wp"];

_position             = _this select 0;
//_startingpos         = _this select 1;
_radius             = _this select 1;
_wpnum                 = _this select 2;
_heli_class         = _this select 3;
_skill                 = _this select 4;
_skin                = _this select 5;
_aitype                = _this select 6;

if (count _this > 8) then {
    _mission = _this select 8;
} else {
    _mission = nil;
};
 

(please left _mission argument, I use it in mission)tiny issue mission_winorfail forgot declaration of private variable 

Nice catch. I forgot to adjust the parameters there. I updated the github.

Thanks!

Link to comment
Share on other sites

On 6/1/2018 at 5:54 PM, JakeQue said:

Hi mate, this is great. Good work!! 

 

Just a couple of issues. The loot box still spawns in before the mission has been finished. 

And secondly my server rpt displays this

  Reveal hidden contents

23:51:16 Error in expression <ion) select 4), _helicopter];
} else {
(wai_static_data select 1) set [count (wa>
23:51:16   Error position: <wai_static_data select 1) set [count (wa>
23:51:16   Error Undefined variable in expression: wai_static_data
23:51:16 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 144

 

OK, I see this error now. I have updated the github. Add this line to get rid of the undefined variable error.

https://github.com/worldwidesorrow/WICKED-AI/blob/master/WAI/init.sqf#L53

Even though it's not being used for regular missions, it needs to be defined.

Link to comment
Share on other sites

I was checking every single mission to fix what I was doing wrong.

I think I have them all done.

I did all these changes you posted above and the heli one where the static was missing.

I am having this error:

 

Spoiler

20:44:49 "DZAI Debug: Permanently deleting a static spawn at Heli AI Parachute 035089."

20:44:51 Error in expression <ion) select 4), _helicopter];

} else {

(wai_static_data select 1) set [count (wa>

20:44:51   Error position: <wai_static_data select 1) set [count (wa>

20:44:51   Error Undefined variable in expression: wai_static_data

20:44:51 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 144

20:45:02 "DZAI Debug: Deleting static group O 1-1-A."

20:46:20 Error in expression <mission) select 1), _pgroup];

} else {

(wai_static_data select 1) set [count (wa>

20:46:20   Error position: <wai_static_data select 1) set [count (wa>

20:46:20   Error Undefined variable in expression: wai_static_data

20:46:20 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 186

20:46:21 Error in expression <mission", _mission, true];

};


 

} else {

wai_static_data set [0, ((wai_static_dat>

20:46:21   Error position: <wai_static_data set [0, ((wai_static_dat>

20:46:21   Error Undefined variable in expression: wai_static_data

20:46:21 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 302

20:46:21 No speaker given for Taras Novak

20:46:23 Error in expression <mission", _mission, true];

};


 

} else {

wai_static_data set [0, ((wai_static_dat>

20:46:23   Error position: <wai_static_data set [0, ((wai_static_dat>

20:46:23   Error Undefined variable in expression: wai_static_data

20:46:23 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 302

20:46:23 No speaker given for Kiril Konopnik

20:46:25 Error in expression <mission", _mission, true];

};


 

} else {

wai_static_data set [0, ((wai_static_dat>

20:46:25   Error position: <wai_static_data set [0, ((wai_static_dat>

20:46:25   Error Undefined variable in expression: wai_static_data

20:46:25 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 302

20:46:26 Error in expression <mission", _mission, true];

};


 

} else {

wai_static_data set [0, ((wai_static_dat>

20:46:26   Error position: <wai_static_data set [0, ((wai_static_dat>

20:46:26   Error Undefined variable in expression: wai_static_data

20:46:26 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 302

20:46:28 Error in expression <mission", _mission, true];

};


 

} else {

wai_static_data set [0, ((wai_static_dat>

20:46:28   Error position: <wai_static_data set [0, ((wai_static_dat>

20:46:28   Error Undefined variable in expression: wai_static_data

20:46:28 File z\addons\dayz_server\WAI\compile\heli_para.sqf, line 302

But, no matter different lines, guess it was the same issue, right?

Thanks a lot for all the hard work, Jason.

 

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...