Jump to content

[Release] Wicked AI 2.2.0


f3cuk

Recommended Posts

yeah saw it :D

 

find_suitable_ammunition = {

	private["_weapon","_result","_ammoArray"];

	_result 	= false;
	_weapon 	= _this;
	_ammoArray 	= getArray (configFile >> "cfgWeapons" >> _weapon >> "magazines");

	if (count _ammoArray > 0) then {
		_result = _ammoArray select 0;
		call {
			if(_result == "20Rnd_556x45_Stanag") 	exitWith { _result = "30Rnd_556x45_Stanag"; };
			if(_result == "30Rnd_556x45_G36") 		exitWith { _result = "30Rnd_556x45_Stanag"; };
			if(_result == "30Rnd_556x45_G36SD") 	exitWith { _result = "30Rnd_556x45_StanagSD"; };
		};
	};

	_result

};

hero_warning = {

	private ["_warned"];
	_position = _this select 0;
	_mission = _this select 1;
	_running = (typeName (wai_mission_data select _mission) == "ARRAY");

	while {_running} do {
		{
			_warning_one = _x getVariable ["warning_one", false];
			_warning_two = _x getVariable ["warning_two", false];
			_warning_bandit = _x getVariable ["warning_bandit", false];
			if((isPlayer _x) && ((_x distance _position) <= 1200) && (_x getVariable ["humanity", 0] > player_bandit)) then {

				if (_x distance _position > ai_hero_engage_range) then {

					if (!_warning_one && (_x distance _position <= 150)) then {

						_msg = format ["Warning! This is a restricted area! Come closer and we will engage!"];
						[nil,_x,rTitleText,_msg,"PLAIN",10] call RE;
						_x setVariable ["warning_one", true];
					};

				} else {

					if (!_warning_two) then {
						_msg = format ["You were warned %1.", name _x];
						[nil,_x,rTitleText,_msg,"PLAIN",10] call RE;
						_x setVariable ["warning_two", true];
					};

				};
			};
		} 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
};

 

Link to comment
Share on other sites

if(isServer) then {
	 
	private 		["_complete","_baserunover","_mission","_directions","_position","_crate","_num","_crate_type","_baserunover0","_baserunover1","_baserunover2","_baserunover3","_baserunover4","_baserunover5","_baserunover6","_baserunover7"];

	// Get mission number, important we do this early
	_mission 		= count wai_mission_data -1;

	_position		= [80] call find_position;
	[_mission,_position,"Hard","Bandit Base","MainHero",true] call mission_init;
	
	diag_log 		format["WAI: [Mission:[Hero] Bandit Base]: Starting... %1",_position];

	//Setup the crate
	_crate_type 	= crates_large call BIS_fnc_selectRandom;
	_crate 			= createVehicle [_crate_type,[(_position select 0),(_position select 1),0],[],0,"CAN_COLLIDE"];
	
	//Buildings
	_baserunover0 	= createVehicle ["land_fortified_nest_big",[(_position select 0) - 40, (_position select 1),-0.2],[], 0, "CAN_COLLIDE"];
	_baserunover1 	= createVehicle ["land_fortified_nest_big",[(_position select 0) + 40, (_position select 1),-0.2],[], 0, "CAN_COLLIDE"];
	_baserunover2 	= createVehicle ["land_fortified_nest_big",[(_position select 0), (_position select 1) - 40,-0.2],[], 0, "CAN_COLLIDE"];
	_baserunover3 	= createVehicle ["land_fortified_nest_big",[(_position select 0), (_position select 1) + 40,-0.2],[], 0, "CAN_COLLIDE"];
	_baserunover4 	= createVehicle ["Land_Fort_Watchtower",[(_position select 0) - 10, (_position select 1),-0.2],[], 0, "CAN_COLLIDE"];
	_baserunover5 	= createVehicle ["Land_Fort_Watchtower",[(_position select 0) + 10, (_position select 1),-0.2],[], 0, "CAN_COLLIDE"];
	_baserunover6 	= createVehicle ["Land_Fort_Watchtower",[(_position select 0), (_position select 1) - 10,-0.2],[], 0, "CAN_COLLIDE"];
	_baserunover7 	= createVehicle ["Land_Fort_Watchtower",[(_position select 0), (_position select 1) + 10,-0.2],[], 0, "CAN_COLLIDE"];
	_baserunover = [_baserunover0,_baserunover1,_baserunover2,_baserunover3,_baserunover4,_baserunover5,_baserunover6,_baserunover7];
	
	_directions = [90,270,0,180,0,180,270,90];
	{ _x setDir (_directions select _forEachIndex) } forEach _baserunover;
	
	{ _x setVectorUp surfaceNormal position _x; } count _baserunover;
	
	//Troops
	_num = 4 + round (random 3);
	[[_position select 0,_position select 1,0],_num,"Hard",["Random","AT"],4,"Random","Bandit","Random","Bandit",_mission] call spawn_group;
	[[_position select 0,_position select 1,0],4,"Hard","Random",4,"Random","Bandit","Random","Bandit",_mission] call spawn_group;
	[[_position select 0,_position select 1,0],4,"Hard","Random",4,"Random","Bandit","Random","Bandit",_mission] call spawn_group;
	[[_position select 0,_position select 1,0],4,"Hard","Random",4,"Random","Bandit","Random","Bandit",_mission] call spawn_group;
	[[_position select 0,_position select 1,0],4,"Hard","Random",4,"Random","Bandit","Random","Bandit",_mission] call spawn_group;

	//Humvee Patrol
	[[(_position select 0) + 100, _position select 1, 0],[(_position select 0) + 100, _position select 1, 0],50,2,"HMMWV_Armored","Hard","Bandit","Bandit",_mission] call vehicle_patrol;
	 
	//Static Guns
	[[[(_position select 0) - 10, (_position select 1) + 10, 0]],"M2StaticMG","Easy","Bandit","Bandit",0,2,"Random","Random",_mission] call spawn_static;
	[[[(_position select 0) + 10, (_position select 1) - 10, 0]],"M2StaticMG","Easy","Bandit","Bandit",0,2,"Random","Random",_mission] call spawn_static;
	[[[(_position select 0) + 10, (_position select 1) + 10, 0]],"M2StaticMG","Easy","Bandit","Bandit",0,2,"Random","Random",_mission] call spawn_static;
	[[[(_position select 0) - 10, (_position select 1) - 10, 0]],"M2StaticMG","Easy","Bandit","Bandit",0,2,"Random","Random",_mission] call spawn_static;

	//Heli Paradrop
	[[(_position select 0), (_position select 1), 0],[0,0,0],400,"UH1H_DZ",10,"Random","Random",4,"Random","Bandit","Random","Bandit",true,_mission] spawn heli_para;

	//Condition
	_complete = [
		[_mission,_crate],	// mission number and crate
		["crate"], 			// ["crate"], or ["kill"], or ["assassinate", _unitGroup],
		[_baserunover], 	// cleanup objects
		"A jungle task force have set up a temporary encampment! Go and ambush it to make it yours!",	// mission announcement
		"Survivors captured the base, HOOAH!!",															// mission success
		"Survivors were unable to capture the base"														// mission fail
	] call mission_winorfail;

	if(_complete) then {
		[_crate,[16,ai_wep_sniper],[8,crate_tools_sniper],[3,crate_items_high_value],[4,crate_backpacks_large]] call dynamic_crate;
	};

	diag_log format["WAI: [Mission:[Hero] Bandit Base]: Ended at %1",_position];

	h_missionsrunning = h_missionsrunning - 1;
};

this is the mission

Link to comment
Share on other sites

have reinstalled WAI but the same error popup in the .rpt

 

0:41:11 "WAI: [Mission:[Hero] Bandit Patrol]: Starting... [10420.7,8631.49,0]"
 0:41:12 Error in expression <ret = _this select _ret;           
};

_ret;>
 0:41:12   Error position: <_ret;>
 0:41:12   Error Undefined variable in expression: _ret
 0:41:12 File z\addons\dayz_code\compile\BIS_fnc\fn_selectRandom.sqf, line 24
 0:41:12 Error in expression <l BIS_fnc_selectRandom; };
};
_rocket = _launcher call find_suitable_ammunition;>
 0:41:12   Error position: <_launcher call find_suitable_ammunition;>
 0:41:12   Error Undefined variable in expression: _launcher
 0:41:12 File z\addons\dayz_server\WAI\compile\spawn_group.sqf, line 190
 0:41:12 "WAI: Spawned a group of 3 AI (Bandit) at [10420.7,8631.49,0]"
 0:41:13 Error in expression <ret = _this select _ret;           
};

_ret;>
 0:41:13   Error position: <_ret;>
 0:41:13   Error Undefined variable in expression: _ret
 0:41:13 File z\addons\dayz_code\compile\BIS_fnc\fn_selectRandom.sqf, line 24
 0:41:13 Error in expression <l BIS_fnc_selectRandom; };
};
_rocket = _launcher call find_suitable_ammunition;>
 0:41:13   Error position: <_launcher call find_suitable_ammunition;>
 0:41:13   Error Undefined variable in expression: _launcher
 0:41:13 File z\addons\dayz_server\WAI\compile\spawn_group.sqf, line 190

 

Link to comment
Share on other sites

  • 4 weeks later...

Hey,

I created a mission with the WAI Example.

this is the result:

  Reveal hidden contents

 

i placed some other buildings on that location in another file (which works fine), which are standing there all the time (i wanted that so)

my question is how can i make this mission spawn always on restart and then not again?

also that the fiberplants don't despawn after mission cleared?

also no timeout for the mission?

and is there any other mistake in that script?

Here is my WAI config.sqf because of the loadouts:

  Reveal hidden contents

 

Link to comment
Share on other sites

  • 3 weeks later...

Hey all, 

Iv got a few custom missions iv made for our server as events etc. does anyone know if its possible to remote execute a mission through infistars admin menu for example? as I don't want these events running randomly.

Iv got additions to infistars menu working fine but need a point in the right direction with calling the mission. 

any help would be appreciated

 

cheers.

Link to comment
Share on other sites

I would like to run 2 wai I'm running a overpochins server wai 1 runs sector b and bandit island with alil dzai support from what I can tell so I wanted to add wai2 just to run the wia missions I went threw and changed every wai to wai2 in every file it loads in no missions spawn and in rpt all that comes up is no owner what am I doing wrong can sumone help me point me in the right direction

Link to comment
Share on other sites

  On 2/1/2016 at 3:17 PM, way420 said:

I would like to run 2 wai I'm running a overpochins server wai 1 runs sector b and bandit island with alil dzai support from what I can tell so I wanted to add wai2 just to run the wia missions I went threw and changed every wai to wai2 in every file it loads in no missions spawn and in rpt all that comes up is no owner what am I doing wrong can sumone help me point me in the right direction

Expand  

You would need to change all the global variables etc too. Missions in WAI2 are probably not loading because mission-started variables set in WAI1 are preventing WAI2 from working! Run DZMS for the regular missions , it's going to be a lot cleaner and easier to manage :)

Link to comment
Share on other sites

ty for the answer I did go threw each mission as well and change that to wai2 as well I just got this feeling like I'm so close but missing sumthing what I first started and tried it messed with every mission and ai now it don't  already run missions from dzms but wanted more its a small amount of friends on it so lots of missions lots of ai

 

Link to comment
Share on other sites

  On 2/1/2016 at 3:53 PM, way420 said:

ty for the answer I did go threw each mission as well and change that to wai2 as well I just got this feeling like I'm so close but missing sumthing what I first started and tried it messed with every mission and ai now it don't  already run missions from dzms but wanted more its a small amount of friends on it so lots of missions lots of ai

 

Expand  

Not everything will be that obvious , WAI wise. like: markerready .. I'm sure there are dozens more like this both global and public :(

Every file in here would need to be checked and edited: https://github.com/f3cuk/WICKED-AI/tree/master/WAI/compile

Link to comment
Share on other sites

Don't know if you already knew this, but WAI has support for static missions. You can call the code from your own files, so for example you could have 1 or more static missions on any Island(s) that you run at server start, then just run WAI dynamic missions as normal.  I used it on my old server, I had a couple of WAI static missions running via Epoch events and another at startup through server_monitor.sqf and then the dynamic missions via WAI itself.. Did you understand that? :p

Link to comment
Share on other sites

not really m using ElDubya  great release of overpochins I already humped the crap outa it by adding even more mods to it but when ever I touch the missions in any way it takes away ai from the islands so I figured two wai might do the trick all the missions systems in it seem to be tied together I'm learning as I go I can handle adding mods like a pro but writing my own script I'm not there yet lol

Link to comment
Share on other sites

You can call the AI with a simple snippet like this: (this code could be run from an Epoch event script).. Go with DZMS and good luck :)

						[
		[953.237,4486.48,0.001],			// Position
		4,									// Number Of units
		"Random",							// Skill level of unit (easy, medium, hard, extreme, Random)
		"Random",							
		4,									// Number of magazines
		"Random",							// Backpack classname, use "Random" or classname here
		"Random",							// Skin classname, use "Random" or classname here
		"Random",							// Gearset number. "Random" for random gear set
		"Bandit"							// AI Type, "Hero" or "Bandit".
						] call spawn_group;

I used to use this type of code to spawn AI and paradrops onto douche bags camping the hills of Cherno. Just for kicks :D

Link to comment
Share on other sites

  On 2/1/2016 at 4:35 PM, way420 said:

not really m using ElDubya  great release of overpochins I already humped the crap outa it by adding even more mods to it but when ever I touch the missions in any way it takes away ai from the islands so I figured two wai might do the trick all the missions systems in it seem to be tied together I'm learning as I go I can handle adding mods like a pro but writing my own script I'm not there yet lol

Expand  

My files already have "Manual Execution" installed. Check out the modules folder for details and then Sandbird's thread for how to use it.

Link to comment
Share on other sites

  On 2/1/2016 at 3:17 PM, way420 said:

I would like to run 2 wai I'm running a overpochins server wai 1 runs sector b and bandit island with alil dzai support from what I can tell so I wanted to add wai2 just to run the wia missions I went threw and changed every wai to wai2 in every file it loads in no missions spawn and in rpt all that comes up is no owner what am I doing wrong can sumone help me point me in the right direction

Expand  

I did it when we had a Tavi server.

You put this in your server PBO, server_monitor.sqf  place  [] ExecVM "\z\addons\dayz_server\IAW\initIAW.sqf"; above allowConnection = true;    

http://www.mediafire.com/download/tbx7y28dpfiw6fq/IAW.zip

The AI will not spawn until someone is 4000 meters out or closer, it reduces server load when people are not doing it.

There are no crates spawned with this, i used WAI to spawn the crates in WAI/static/default.sqf

Example

 

  Reveal hidden contents

 

Please change all lines that look like this or it will not work, I have redone WAI on our servers to improve performance and errors.

[_crate,[25,ai_wep_box],8,[30,crate_items_buildables],1,[100,ammo_list]] call dynamic_crate;

 

Link to comment
Share on other sites

  On 2/6/2016 at 7:36 PM, Phail said:

I did it when we had a Tavi server.

You put this in your server PBO, server_monitor.sqf  place  [] ExecVM "\z\addons\dayz_server\IAW\initIAW.sqf"; above allowConnection = true;    

http://www.mediafire.com/download/tbx7y28dpfiw6fq/IAW.zip

The AI will not spawn until someone is 4000 meters out or closer, it reduces server load when people are not doing it.

There are no crates spawned with this, i used WAI to spawn the crates in WAI/static/default.sqf

Example

 

Hidden Content

 

Please change all lines that look like this or it will not work, I have redone WAI on our servers to improve performance and errors.

[_crate,[25,ai_wep_box],8,[30,crate_items_buildables],1,[100,ammo_list]] call dynamic_crate;

 

Expand  

OMG! ty so much for this

Link to comment
Share on other sites

Heyho

So i installed latest release on my Namalsk Overpoch server which is in Testing

The missions are taking ages to spawn and the bandit missions don't always shoot at players which i've never seen before

 

Any idea what could be causing this ?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Advertisement
×
×
  • Create New...