Jump to content

Wicked AI/Mission system


Markk311

Recommended Posts

Nice catch. Accidentally put a custom loot table line in there

find

missionconfigFile

and change to

configFile

 

in crash_spawner

 

 

How can I fix this:

 

_item = createV>

21:37:08   Error Undefined variable in expression: _iclass

21:37:08 File z\addons\dayz_code\compile\spawn_loot.sqf, line 9

21:37:08 Error in expression <s select _index;

_itemType = _itemTypes select _index;

[_itemType select 0, _ite>

21:37:08   Error position: <select _index;

[_itemType select 0, _ite>

21:37:08   Error Zero divisor

21:37:08 File z\addons\dayz_server\WAI\missions\missions\crash_spawner.sqf, line 73

21:37:08 Error in expression <t 2;

_radius =    _this select 3;

switch (_iClass) do

{

default

 

:(

The above post explains the fix, this has been said multiple times. :)

Link to comment
Share on other sites

First of all my hats off to Markk311 for an awesome mission script this is by far the best out there!

 

This is for those who've asked to add their own custom missions to WAI here is how I did it.

 

Step 1

First go to your wai/missions/missions folder and open weapon_cache.sqf save it as weapon_cache_1.sqf.

 

Find this line

[_box] call spawn_ammo_box;

Change it to

[_box] call spawn_ammo_box_1;

you can also change the type of ammobox you want to spawn ie.

_box = createVehicle ["BAF_VehicleBox",[(_position select 0),(_position select 1),0], [], 0, "CAN_COLLIDE"];
_box = createVehicle ["GuerillaCacheBox",[(_position select 0),(_position select 1),0], [], 0, "CAN_COLLIDE"];

you can use almost any type of storage box that can be used in Arma2. I would not recommend using the gunracks however. Found this out the hard way as all the loot was on the ground!

If you want change the message displayed for the type of mission you are adding on these lines:

[_position,"Weapon Cache"] execVM "\z\addons\dayz_server\WAI\missions\compile\markers.sqf";
[nil,nil,rTitleText,"Bandits have obtained a weapon cache! Check your map for the location!", "PLAIN",10] call RE;
	diag_log format["WAI: Mission weapon cache ended at %1",_position];
	[nil,nil,rTitleText,"Survivors have secured the weapon cache!", "PLAIN",10] call RE;
	diag_log format["WAI: Mission weapon cache timed out at %1",_position];
	[nil,nil,rTitleText,"Survivors did not secure the weapon cache in time!", "PLAIN",10] call RE;

These are what my lines look like:

[_position,"Weapon Delivery"] execVM "\z\addons\dayz_server\WAI\missions\compile\markers.sqf";
[nil,nil,rTitleText,"Bandits have obtained a weapon delivery! Check your map for the location!", "PLAIN",10] call RE;
	diag_log format["WAI: Mission weapon delivery ended at %1",_position];
	[nil,nil,rTitleText,"Survivors have secured the weapon delivery!", "PLAIN",10] call RE;
	diag_log format["WAI: Mission weapon delivery timed out at %1",_position];
	[nil,nil,rTitleText,"Survivors did not secure the weapon delivery in time!", "PLAIN",10] call RE;

this way I can tell which weapon cache mission is active!

Now save and close the file.

 

Step 2a

Next open your wai/missions/missionsCfg.sqf find this code:

// missions used when selecting the next random mission
wai_missions = [
"weapon_cache",

and add the new mission to this list:

// missions used when selecting the next random mission
wai_missions = [
"weapon_cache",
"weapon_cache_1",

Step2b

Now scroll down to these lines:

// classnames of guns to spawn in ammo boxes (only class weapons)
ammo_box_guns = [
"List of weapons here"
];

and add in your new list for your new mission like so

// classnames of guns to spawn in ammo boxes (only class weapons)
ammo_box_guns = [
"List of weapons here"
];

ammo_box_guns_1 = [
"Your list of weapons here"
];

Don't forget to end each line of weapons you add with a comma with the exception of the last one added.

 

Now do the same for toolbelt items like so

// classnames of tools to spawn in ammo boxes (only toolbelt items or weapon class Eg. "Chainsaw" or "ItemToolbox")
ammo_box_tools =[
"ItemCrowbar",
"ItemEtool",
"ItemMachete"
];

ammo_box_tools_1 =[
"ItemKnife",
"ItemHatchet_DZE",
"ItemMatchbox_DZE",
"ItemCompass"
];

and also magazines

// classnames of items to spawn in ammo boxes (only type magazine will work here)
ammo_box_items =[
"100Rnd_127x99_M2",
"48Rnd_40mm_MK19"
];

ammo_box_items_1 =[
"8Rnd_9x18_MakarovSD",
"HandGrenade_west"
];

save and close this file.

 

Step 3

Open the missionIni.sqf in wai/missions and under

spawn_ammo_box  = compile preprocessFileLineNumbers "\z\addons\dayz_server\WAI\missions\compile\ammobox.sqf";

add

spawn_ammo_box_1  = compile preprocessFileLineNumbers "\z\addons\dayz_server\WAI\missions\compile\ammobox_1.sqf";

Save and close your file.

 

Step 4

Open ammobox.sqf in the wai/missions/compile folder and save it as ammobox_1.sqf then close it!

 

Your done! Repack your pbo and viola you've added a new mission to your server!

To add more weapon cache missions repeat the above just increment everything from _1 to _2 and so on!

 

To add a gold cache mission

Follow Step1, Step2a and Step3 above and replace ammo, ammobox and weapon_cache with gold, goldbox and gold_cache!

 

Since we don't want our box to spawn in with 10+ briefcases and we do not want weapons or toolbelt items we need to make different edits and create a new file!

 

Step2b

In the missionsCfg.sqf scroll to the bottom and before

//////////////////////////////////////////////////////////////////////
WAImissionconfig = True;

add

// Number of briefcases to spawn in boxes 
wai_mission_numberofgold = 1;
// classnames of items to spawn in ammo boxes (only type magazine will work here)
gold_box_items =[
"ItemBriefcase100oz",
"ItemBriefcaseEmpty",
"ItemBriefcase90oz",
"ItemBriefcase80oz",
"ItemBriefcase70oz",
"ItemBriefcase60oz",
"ItemBriefcase50oz",
"ItemBriefcase40oz",
"ItemBriefcase30oz",
"ItemBriefcase20oz",
"ItemBriefcase10oz"
];

This way the briefcases that will spawn in our box will either be one briefcase or a combination of 2 to 3 briefcases on the list (I know it says 1 but you will see in the next step).

Save and close the file!

 

Step 4

Open a new file in notepad++ and paste this code:

private ["_mission","_box","_class","_namecfg","_numberofgold","_item"];
_box = _this select 0;

//_box = createVehicle ["BAF_VehicleBox",[(_position select 0),(_position select 1),0], [], 0, "CAN_COLLIDE"];
_box setVariable ["ObjectID","1",true];
_box setVariable ["permaLoot",true];
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_box];


clearWeaponCargoGlobal _box;
clearMagazineCargoGlobal _box;

_numberofgold = (round (random 2)) + wai_mission_numberofgold;

for "_i" from 1 to _numberofgold do {
	_item = gold_box_items call BIS_fnc_selectRandom;
	_box addMagazineCargoGlobal [_item,1];
};

You can set (random 2) to whatever number you want to randomly spawn 1 to whatever number you specify to spawn in your box.

Save it as goldbox.sqf and place it in wai/missions/compile folder.

 

Repack your PBO and your done!

 

Note you can also substitute any other item ( building parts, food, drinks, medical supplies etc.) just use different names!

 

I hope this helps those that were trying to add more missions.

Link to comment
Share on other sites

Thanks to all those who tried to help.  What ended up working was:  I deleted WAI from server.pbo.  Reinstalled it fresh.  Ran it once (missions spawning on side of hills etc.).  Edited missions with predetermined flat spots (Taviana map).  Worked!  I don't know what the error was that was giving me such a hard time.

Link to comment
Share on other sites

Hi man.,

Simple custom span to Bolota Airstrip.

 

1)  Decompile you server pbo: 

2)  Go to WAI mission folder open notepad ++ and make file gru1.sqf

// NEW GRU SETUP
//HAMWI POSITION***************************************************************************************************
[[4629.7285, 2530.1265,0],   //Position to patrol
[4629.7285, 2530.1265],	// Position to spawn at
200,					//Radius of patrol
10,                     //Number of waypoints to give
"HMMWV_Armored",		//Classname of vehicle (make sure it has driver and gunner)
1						//Skill level of units 
] spawn vehicle_patrol;

//GRU ONE POSITION****************************************************************************************************
[[4637.3896, 2567.8103,0], //position
4,						  //Number Of units
1,					      //Skill level 0-1 or skill array number if using custom skills "Random" for random Skill array.
2,			      //Primary gun set number. "Random" for random weapon set.
4,						  //Number of magazines
"DZ_GunBag_EP1",						  //Backpack "" for random or classname here.
"CZ_Special_Forces_GL_DES_EP1_DZ",			  //Skin "" for random or classname here.
"Random"                  //Gearset number. "Random" for random gear set.
] call spawn_group;

//GRU TWO POSITION****************************************************************************************************
[[4911.8955, 2492.0625,0], //position
4,						  //Number Of units
1,					      //Skill level 0-1 or skill array number if using custom skills "Random" for random Skill array.
2,			      //Primary gun set number. "Random" for random weapon set.
4,						  //Number of magazines
"DZ_GunBag_EP1",						  //Backpack "" for random or classname here.
"CZ_Special_Forces_GL_DES_EP1_DZ",			  //Skin "" for random or classname here.
"Random"                  //Gearset number. "Random" for random gear set.
] call spawn_group;

//GRU THREE POSITION****************************************************************************************************
[[4637.8892, 2608.6577,0], //position
4,						  //Number Of units
1,					      //Skill level 0-1 or skill array number if using custom skills "Random" for random Skill array.
2,			      //Primary gun set number. "Random" for random weapon set.
4,						  //Number of magazines
"DZ_GunBag_EP1",						  //Backpack "" for random or classname here.
"CZ_Soldier_Sniper_EP1_DZ",			  //Skin "" for random or classname here.
"Random"                  //Gearset number. "Random" for random gear set.
] call spawn_group;

//GRU CHOPER POSITION****************************************************************************************************
[[4654.4756, 2540.5149,2.6292224],  //Position that units will be dropped by
[0,0,0],                           //Starting position of the heli
400,                               //Radius from drop position a player has to be to spawn chopper
"UH1H_DZ",                         //Classname of chopper (Make sure it has 2 gunner seats!)
5,                                 //Number of units to be para dropped
1,                                 //Skill level 0-1 or skill array number if using custom skills "Random" for random Skill array.
"Random",                          //Primary gun set number. "Random" for random weapon set.
4,                                 //Number of magazines
"",                                //Backpack "" for random or classname here.
"CZ_Special_Forces_GL_DES_EP1_DZ",                      //Skin "" for random or classname here.
"Random",                          //Gearset number. "Random" for random gear set.
True                               //True: Heli will stay at position and fight. False: Heli will leave if not under fire. 
] spawn heli_para;

this code adding 1 hamwi MG chain + specnaz solder around barraks 2 snipers. If player go to barraks helicopter is active and player see paradrop :)

this custom very strong by hardcore server :)

 

3)  Save it on WAI folder

4) Go to Miission folder by SERVER SIDE change mission.sql path dayz_server_missions\dayz_Epoch_11.Chernarus\mission.sqf and add to bottom text

_vehicle_2000 = objNull;
if (true) then
{
  _this = createVehicle ["Land_Mil_Barracks_i", [4626.4512, 2549.4001, 3.8146973e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_2000 = _this;
  _this setDir -325.27335;
  _this setPos [4626.4512, 2549.4001, 3.8146973e-006];
};

_vehicle_2001 = objNull;
if (true) then
{
  _this = createVehicle ["Land_Mil_Barracks_i", [4633.7515, 2559.5676, 1.9073486e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_2001 = _this;
  _this setDir 33.431316;
  _this setPos [4633.7515, 2559.5676, 1.9073486e-006];
};
_vehicle_2002 = objNull;

if (true) then
{
  _this = createVehicle ["RU_WarfareBAircraftFactory", [4629.7285, 2530.1265, -0.29968175], [], 0, "CAN_COLLIDE"];
  _vehicle_2002 = _this;
  _this setDir 35.866905;
  _this setPos [4629.7285, 2530.1265, -0.29968175];
};

This add 3 bullding 2 loot military barracks and Aircraft warfare on the end of bolota strip. Go to init.sqf on WAI folder.

 

5) Search //Load custom spawns and adding [] ExecVM "\z\addons\dayz_server\WAI\gru.sqf";

 

result 

//Load custom spawns
//[] ExecVM "\z\addons\dayz_server\WAI\customSpawns.sqf";
[] ExecVM "\z\addons\dayz_server\WAI\gru.sqf";
if (ai_mission_sysyem) then {
	//Load AI mission system
	[] ExecVM "\z\addons\dayz_server\WAI\missions\missionIni.sqf";
};

6) Save all. compile pbo. and start server

Link to comment
Share on other sites

I asked this earlier in the thread, but it seems to have been overlooked, so I shall ask again. :)

 

Is there a way for me to play custom sounds when the mission has been completed?

 

Can I upload ogg files to say WAI/sounds and play them from the mission files sqf?

 

Cheers.

Link to comment
Share on other sites

Hello guys. I know that some of you want to add some heavy weapons to the bots, because they are not shooting in some armored vehicles with default weapons, so I made a little script change for you.

AI will have RPG only on missions, and only 1 person from one group will have an RPG.

 

1) So, first of all you need to open SpawnGroup.sqf in WAI/custom/ folder.

Find there that code:

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

and replace it with that code:

if (count _this > 8) then {
	_mission = _this select 8;
	_RPG = 1;
} else {
	_mission = False;
	_RPG = -1;
};

2) find this code:

for "_i" from 1 to _mags do {_unit addMagazine _magazine;};
_unit addBackpack _aipack;	

and replace it with this code:

for "_i" from 1 to _mags do {_unit addMagazine _magazine;};
if ((_x == 1) && (_RPG > 0)) then {
  _unit addweapon "RPG7V"; 
  _unit addmagazine "PG7VL"; 
  _unit addmagazine "PG7VL";
} else {
  _unit addBackpack _aipack;	
};

If you want to leave RPG and ammo on the deadbodies that will be enough, but if you want to remove it after bot's death, you should do this thing:

Open file ai_killed.sqf and right after this code:

private ["_unit","_player","_humanity","_banditkills"];
_unit = _this select 0;
_player = _this select 1;
_type = _this select 2;

add this:

_unit removeWeapon "RPG7V";
_unit removeMagazine "PG7VL";
_unit removeMagazine "PG7VL";

So, you've done this! Your AI will now have an RPG on the missions and you know, they really like to shoot it:)

 

By the way, I also tested an RPG ammo, and I can say that if you want to kill any vehicle with oneshot, you should use "PG7VR" magazines.

And if you want to give to player a chance to survive, you can use "OG7" magazines, even HMMVW can survive after this shot.

PG7VL will destroy any  Vodnik's, but if you have any heave armored vehicles (like on my server), PG7VL will destroy tracks or wheels of BMP or BTR.

 

Sorry for my English:)

 

I still can't get this to work. any help anyone? I have followed everything to the letter but AI still don't spawn with RPGS

Link to comment
Share on other sites

Same here with the RPG's... followed to the letter (or I have missed something).

 

rpt file reports:

 

 8:06:47 Error in expression <Magazine _magazine;};
if ((_x == 1) && (_RPG > 0)) then {
_unit addweapon "RPG7V>
 8:06:47   Error position: <_RPG > 0)) then {
_unit addweapon "RPG7V>
 8:06:47   Error Undefined variable in expression: _rpg
 8:06:47 File z\addons\dayz_server\WAI\compile\SpawnGroup.sqf, line 73
 
the missions still run, just no rpg's.
Link to comment
Share on other sites

could someone please tell me why missions start spawning slowly when theres "lots" of players on the server? with only few it works just fine. also i tried adding new mission system with WAI. with that missions spawned again like they should (set them to 1200s (20min)) but had to delete it since it was screwing everyones vehicles. now using only WAY again and missions spawn slowly AGAIN!

Link to comment
Share on other sites

could someone please tell me why missions start spawning slowly when theres "lots" of players on the server? with only few it works just fine. also i tried adding new mission system with WAI. with that missions spawned again like they should (set them to 1200s (20min)) but had to delete it since it was screwing everyones vehicles. now using only WAY again and missions spawn slowly AGAIN!

Your servers lagging, when that happens the ingame time slows down so 20 minutes can take an hour.

Either find what is causing the lag or if you use a shared host consider going dedicated, people on the same machine can have a knock on effect on your server.

Link to comment
Share on other sites

Your servers lagging, when that happens the ingame time slows down so 20 minutes can take an hour.

Either find what is causing the lag or if you use a shared host consider going dedicated, people on the same machine can have a knock on effect on your server.

ok thanks. i tried removing some added buildings. i hope that helps even a little. any idea what could be causing the lag? like i said with only few players missions come normally but when more players join missions get slower

Link to comment
Share on other sites

 

Same here with the RPG's... followed to the letter (or I have missed something).

 

rpt file reports:

 

 8:06:47 Error in expression <Magazine _magazine;};
if ((_x == 1) && (_RPG > 0)) then {
_unit addweapon "RPG7V>
 8:06:47   Error position: <_RPG > 0)) then {
_unit addweapon "RPG7V>
 8:06:47   Error Undefined variable in expression: _rpg
 8:06:47 File z\addons\dayz_server\WAI\compile\SpawnGroup.sqf, line 73
 
the missions still run, just no rpg's.

 

 

You need to define the variable "_RPG" in the SpawnGroup.sqf.  Once I did that on the top line where all the other local variables are defined it worked.

I also moved the _RPG value assignment out of the loop so that all groups spawned one will carry an RPG (including static custom spawns).  This plus some sneaky M2 placements prevents players from using armored vehicles and farming the AI.

 

if (count _this > 8) then {

    _mission = _this select 8;

    _RPG = 1;

} else {

    _mission = False;

    _RPG = -1;

};

 

To

 

if (count _this > 8) then {

    _mission = _this select 8;

} else {

    _mission = False;

};

_RPG = 1;

Link to comment
Share on other sites

Are you using DZAI also ?

As in DZAI you can decide if other ai groups shoot each others or not.

I had it on and was wondering this same problem. Then fixed it and now they dont kill each others.

 

We do not run DZAI or any other AI scripts. WAI is the only one running. Still, most of the times, when I arrive to a mission with a static MG2, everyone's dead except for the static gunner.

It does not look like he's shooting at zombies and kills his buddies in the process.

At this point I switched:

 

/// Allows AI on static guns to have a loadout
ai_static_useweapon = False;
 
Hoping that no static gunners will be spawned at the turret.
 
Any other thoughts/solutions?
 
Thanks!
Link to comment
Share on other sites

Alright, so i've been following this step by step and whenever i import it into my server my trade cities despawn, all of them. I have no idea why.. I'm not using any other type of AI mission (I removed it all). My server will start up i go to a trade city and nothing is there, even some buildings in random cities dissappered. Also my missions wouldn't work. Can someone please tell me why this is?

Contact ID:

Teamspeak server: ts1.lunitix.net:7121

 

PS: From the videos i've seen this script looks great keep it up!

Link to comment
Share on other sites

I just want to use the paradrops and ammo crate spawns. I don't want to use the mission. Can I set ai_mission_sysyem = false;  (Note the misspelling in the config file..), and still get the paradrops and crate spawns?

 

You can use the custom spawns file to make custom para drops and such. As for crates you can do that with a different simple script. If you need a walk through throw me an email!

Link to comment
Share on other sites

You need to define the variable "_RPG" in the SpawnGroup.sqf.  Once I did that on the top line where all the other local variables are defined it worked.

I also moved the _RPG value assignment out of the loop so that all groups spawned one will carry an RPG (including static custom spawns).  This plus some sneaky M2 placements prevents players from using armored vehicles and farming the AI.

 

if (count _this > 8) then {

    _mission = _this select 8;

    _RPG = 1;

} else {

    _mission = False;

    _RPG = -1;

};

 

To

 

if (count _this > 8) then {

    _mission = _this select 8;

} else {

    _mission = False;

};

_RPG = 1;

This does not work for me unfortunately. Although the AI have a RPG + ammo but they do not use it, but use their other primary weapon. anyone have any idea why this is?

Link to comment
Share on other sites

This does not work for me unfortunately. Although the AI have a RPG + ammo but they do not use it, but use their other primary weapon. anyone have any idea why this is?

 

Here's my spawngroup.sqf and ai_killed.sqf: https://drive.google.com/file/d/0B9svef6jQxfZN1V1NU1Cenl5ekk/edit?usp=sharing

https://drive.google.com/file/d/0B9svef6jQxfZanQ2ZVpWaVZGcHc/edit?usp=sharing

 

I was able to spawn in a vodnik, armored SUF and a T90.  In all cases the AI used the RPGs to destroy the vehicles.  If this still doesn't work I'll send you my whole WAI folder.  

Link to comment
Share on other sites

Thx 4 the help, but it don't work. The ai have RPG but don't use it.

I had change the ai behivour to COMBAT. Is that the problem?

Try using my AIcongfig.sqf.  I'm using custom skills and AI behavior is with combat mode "RED" and behavior "SAFE".  

https://drive.google.com/file/d/0B9svef6jQxfZaGowNGJUaDRkT3M/edit?usp=sharing

 

Also here is a piece of custom spawns I used to test.  It's in Balota airfield.  It's essentially a copy off Tarvin's post in this thread: 

 

[[4947.4302,2492.6147,0],2,1,3,3,"","CZ_Soldier_Sniper_EP1_DZ","Random"] call spawn_group;
[[4928.0239,2531.5696,0],3,1,2,3,"","CZ_Special_Forces_GL_DES_EP1_DZ","Random"] call spawn_group;
[[5150.5107, 2346.7832,0],3,1,2,3,"","CZ_Soldier_Sniper_EP1_DZ","Random"] call spawn_group;
[[4895.9258,2408.6536,0],[0,0,0],500,"UH1H_DZ",10,1,"Random",4,"","CZ_Special_Forces_GL_DES_EP1_DZ","Random",True] spawn heli_para;
 
EDIT: Did you walk up to them or drive up to them?  You need to come up to them in a vehicle that is immune to small arms fire otherwise they'll simply disable your car with bullet spam.
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...