Jump to content

Wicked AI/Mission system


Markk311

Recommended Posts

Location does NOT need to be converted, though you can dispense with the radial orientation part. For example if you had this as your position:

[271,[16905.2,6272.22,0.00584412]]

you can dispense with the first number as it tells the direction you are facing (out of 360 degrees). You need this part:

[16905.2,6272.22,0]

and you can almost always just use zero on the last one. The engine will place the object to ground level for you.

Link to comment
Share on other sites

Hello all, I would really like to implement this however I do not know how to understand cords to set to spawns. My server has the

Napf map, and I would like for the North east Island/military base to have roaming AI, and Stationary AI. Anyone with Napf have the

cords, or could someone please explain to me how to do this.

 

Thanks.

Link to comment
Share on other sites

ZG, I'll be in my teamspeak for the next 30 minutes or so: legion.teamspeakserverhost.com:21929

 

It's not terribly complicated but you need to have live access to the database using something like HeidiSQL. Provided you have that and you know your PlayerID then here are the steps you can follow (this is only one way, there are much easier ways if you use infistar or install certain mods to the server):

 

1. Travel to the exact spot you want the mission/squad/patrol/whatever to spawn.

2. Escape out of game to the lobby. DON'T disconnect. This will update your position to the database.

3. Using Heidi or whatever DB program go to character_data and find your PID. Your PID can be found at the bottom of your profile screen in case you need to get that.

4. Make sure that the column "Alive" has a "1" in it. This will be your current alive character. Having a "0" means that character is dead.

5. Find the column "Worldspace" for your PlayerID that is alive and current and copy that number series down exactly as you see it.

6. Using my post above clean up your coordinates and you are ready to rock.

 

If you need more coords then just rejoin the server, move to the next position, and repeat.

 

Like I said, there are much easier ways using other things but this is about as stone simple a way as you can get for any server admin running any map/mod.

Link to comment
Share on other sites

Anyone have some kind of static ( like red mission ) for napf working im trying to set up a AI position in milan that the ai will spawn there from server restart till death/ restart off the server having alot off trouble setting this one up . any help will be really appreciate

Link to comment
Share on other sites

The only examples or documentation I've seen have this line:

 

"Random",                 //Primary gun set number. "Random" for random weapon set.

 

Can someone please direct me to the documentation that shows what the other possible values of this parameter are?

 

Other than "Random" what can I use here? Specifically, I'd like to create an AI mission around a farmhouse with AI that only have shotguns.

Link to comment
Share on other sites

Side, go grab my WAI mission pack in the second post on this thread:

Now grab the sniper mission out and use that as a template for what you want to do. You'll need to edit two files in your WAI package, so follow these examples:

 

Here is a copy of my AIConfig file:

///////////////////////////////////////////////////////
///Use the built in mission system (config file for mission system in mission folder)
ai_mission_sysyem = True;

///////////////////////////////////////////////////////
/// clears all Weapons and Magazines off body on death
ai_clear_body = False;

/// Clears dead bodies after given time
ai_clean_dead = True;

/// Time (in seconds) after which a dead body will be cleaned up
cleanup_time = 1800;
///////////////////////////////////////////////////////
/// Sets radius for AI patrols (call spawn_group)
ai_patrol_radius = 200;

/// Sets number of waypoints to add in patrol area (call spawn_group)
ai_patrol_radius_wp = 10;

/// Sets behavior of AI groups
ai_combatmode = "RED";
ai_behaviour = "SAFE";

///////////////////////////////////////////////////////
/// Turns on AI info sharing (Makes them very hard even on low skill settings)
ai_ahare_info = True;

/// Distance AI will let other enemies know of your position (currently only on kill)
ai_share_distance = 1;   //was 200

///////////////////////////////////////////////////////
/// Gain humanity for killing an AI unit (True: is on. False: is off.)
ai_humanity_gain = True;

/// Humanity added for AI kill
ai_add_humanity = 10;

/// Adds bandit kill when killing an AI (True: on. False: off.)
ai_banditkills_gain = True;

///////////////////////////////////////////////////////
/// Allows you to set a custom skill array for units. (True: will use these arrays. False: will use number in spawn array)
ai_custom_skills = True;

/// Custom skill array. Use 0 to use this with ai_custom_skills = True
ai_custom_array1 = [
["aimingAccuracy",0.10],
["aimingShake",0.10],
["aimingSpeed",0.50],
["endurance",1.00],
["spotDistance",0.40],
["spotTime",1.00],
["courage",0.25],
["reloadSpeed",1.00],
["commanding",0.30],
["general",0.10]
];

/// Custom skill array. Use 1 to use this with ai_custom_skills = True
ai_custom_array2 = [
["aimingAccuracy",0.10],
["aimingShake",0.10],
["aimingSpeed",0.50],
["endurance",1.00],
["spotDistance",0.40],
["spotTime",1.00],
["courage",0.25],
["reloadSpeed",1.00],
["commanding",0.30],
["general",0.10]
];

/// Custom skill array. Use 2 to use this with ai_custom_skills = True
ai_custom_array3 = [
["aimingAccuracy",0.10],
["aimingShake",0.10],
["aimingSpeed",0.50],
["endurance",1.00],
["spotDistance",0.40],
["spotTime",1.00],
["courage",0.25],
["reloadSpeed",1.00],
["commanding",0.30],
["general",0.10]
];

/// Sniper custom skillset, very tough
ai_custom_array4 = [
["aimingAccuracy",1.00],
["aimingShake",1.00],
["aimingSpeed",1.00],
["endurance",1.00],
["spotDistance",1.00],
["spotTime",1.00],
["courage",1.00],
["reloadSpeed",1.00],
["commanding",1.00],
["general",1.00]
];


/// Arrays used in "Random" custom skill
ai_skill_random = [ai_custom_array1,ai_custom_array2,ai_custom_array3];

///////////////////////////////////////////////////////
/// Allows AI on static guns to have a loadout
ai_static_useweapon = True;

/// Allows you to set custom array for AI on static weapons. (True: On False: Off)
ai_static_skills = True;

/// Custom skill array. Use this with ai_static_skills = True;
ai_static_array = [
["aimingAccuracy",0.10],
["aimingShake",0.10],
["aimingSpeed",0.50],
["endurance",1.00],
["spotDistance",0.40],
["spotTime",1.00],
["courage",0.40],
["reloadSpeed",1.00],
["commanding",0.40],
["general",0.10]
];

///////////////////////////////////////////////////////
/// Gearset arrays for unit Loadouts ///

/// 0 ///
ai_gear0 = [
["ItemBandage","ItemBandage","ItemPainkiller","ItemGoldBar10oz","FoodMRE","SmokeShellRed"],
["ItemKnife","ItemFlashlight","ItemRadio"]
];

/// 1 ///
ai_gear1 = [
["ItemBandage","ItemBandage","ItemPainkiller","ItemGoldBar","FoodCanPasta"],
["ItemKnife","ItemFlashlight"]
];

/// 2 ///
ai_gear2 = [
["ItemBandage","ItemBandage","ItemPainkiller","ItemBriefcase40oz","SmokeShellGreen"],
["ItemKnife","ItemFlashlight"]
];

/// 3 ///
ai_gear3 = [
["ItemBandage","ItemBandage","ItemPainkiller","ItemGoldBar","ItemAntibiotic"],
["ItemKnife","ItemFlashlight","ItemRadio"]
];

/// 4 ///
ai_gear4 = [
["ItemBandage","ItemBandage","ItemPainkiller","ItemGoldBar","ItemMorphine","SmokeShell"],
["ItemKnife","ItemFlashlight"]
];

/// Gearsets to use if set to "Random" ///
ai_gear_random = [ai_gear0,ai_gear1,ai_gear2,ai_gear3,ai_gear4];

///////////////////////////////////////////////////////
/// Weapon arrays for unit Loadouts ///
/// Format is ["Gun","Ammo"] ///

/// 0 ///
ai_wep0 = [
["RPG18","RPG18"],  
["M4A3_CCO_EP1","30Rnd_556x45_Stanag"],
["M4A1_Aim","30Rnd_556x45_StanagSD"],
["M16A4_ACG","30Rnd_556x45_Stanag"],
["m8_carbine","30Rnd_556x45_Stanag"],
["BAF_L85A2_RIS_Holo","30Rnd_556x45_Stanag"],
["Sa58V_CCO_EP1","30Rnd_762x39_AK47"]
];

/// 1 ///
ai_wep1 = [
["AK_107_pso","30Rnd_545x39_AK"],
["M16A4_ACG","30Rnd_556x45_Stanag"],
["Sa58V_RCO_EP1","30Rnd_762x39_AK47"],
["SCAR_H_LNG_Sniper_SD","20rnd_762x51_SB_SCAR"],
["BAF_L85A2_RIS_Holo","30Rnd_556x45_Stanag"],
["M4A1_Aim","30Rnd_556x45_StanagSD"],
["M14_EP1","20Rnd_762x51_DMR"],
["m8_sharpshooter","30Rnd_556x45_Stanag"]
];

/// 2 ///
ai_wep2 = [
["AK_107_GL_pso","30Rnd_545x39_AK"],
["AK_107_GL_kobra","30Rnd_545x39_AK"],
["M4A1_HWS_GL_camo","30Rnd_556x45_Stanag"],
["M16A4_ACG","30Rnd_556x45_Stanag"],
["m8_carbine","30Rnd_556x45_Stanag"],
["SCAR_H_LNG_Sniper_SD","20rnd_762x51_SB_SCAR"],
["BAF_L85A2_RIS_Holo","30Rnd_556x45_Stanag"],
["M4A3_CCO_EP1","30Rnd_556x45_Stanag"]
];

/// 3 ///
ai_wep3 = [
["RPG18","RPG18"],
["M110_NVG_EP1","20rnd_762x51_B_SCAR"],
["SCAR_H_LNG_Sniper_SD","20rnd_762x51_SB_SCAR"],
["SVD_CAMO","10Rnd_762x54_SVD"],
["VSS_vintorez","20Rnd_9x39_SP5_VSS"],
["DMR","20Rnd_762x51_DMR"],
["M40A3","5Rnd_762x51_M24"]
];

/// 4 ///
ai_wep4 = [
["RPK_74","75Rnd_545x39_RPK"],
["MK_48_DZ","100Rnd_762x51_M240"],
["M249_EP1_DZ","200Rnd_556x45_M249"],
["Pecheneg_DZ","100Rnd_762x54_PK"],
["M240_DZ","100Rnd_762x51_M240"]
];

// Sniper custom loadout //
ai_wep5 = [
["BAF_AS50_scoped","5Rnd_127x99_as50"]
];


/// Arrays used in "Random" for weapons///
ai_wep_random = [ai_wep0,ai_wep1,ai_wep2,ai_wep3,ai_wep4];

///////////////////////////////////////////////////////
/// Backpacks used when "" for random ///
ai_packs = [
"DZ_Assault_Pack_EP1",
"DZ_Czech_Vest_Puch",
"DZ_TerminalPack_EP1",
"DZ_ALICE_Pack_EP1",
"DZ_TK_Assault_Pack_EP1",
"DZ_CompactPack_EP1",
"DZ_British_ACU",
"DZ_GunBag_EP1",
"DZ_CivilBackpack_EP1",
"DZ_Backpack_EP1",
"DZ_LargeGunBag_EP1"
];

///////////////////////////////////////////////////////
/// Skins used when "" for random ///
ai_skin = [
"CZ_Special_Forces_GL_DES_EP1_DZ"
];
//////////////////////////////////////////////////////
WAIconfigloaded = True;

 

 

and in SpawnGroup.sqf add this

private ["_RPG","_mission","_aipack","_aicskill","_position","_unitnumber","_skill","_gun","_mags","_backpack","_skin","_gear","_aiweapon","_aigear","_aiskin","_skillarray","_unitGroup","_weapon","_magazine","_weaponandmag","_gearmagazines","_geartools","_unit"];
_position = _this select 0;
_unitnumber = _this select 1;
_skill = _this select 2;
_gun = _this select 3;
_mags = _this select 4;
_backpack = _this select 5;
_skin = _this select 6;
_gear = _this select 7;
if (count _this > 8) then {
    _mission = _this select 8;
    _RPG = 1;
} else {
    _mission = False;
    _RPG = -1;
};

_aiweapon = [];
_aigear = [];
_aiskin = "";
_aicskill = [];
_aipack = "";
_skillarray = ["aimingAccuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"];
_unitGroup = createGroup east;

if (!isServer) exitWith {};

for "_x" from 1 to _unitnumber do {
    switch (_gun) do {
        case 0 : {_aiweapon = ai_wep0;};
        case 1 : {_aiweapon = ai_wep1;};
        case 2 : {_aiweapon = ai_wep2;};
        case 3 : {_aiweapon = ai_wep3;};
        case 4 : {_aiweapon = ai_wep4;};
        case "Random" : {_aiweapon = ai_wep_random call BIS_fnc_selectRandom;};
        case "Sniper" : {_aiweapon = ai_wep5;};
    };
    _weaponandmag = _aiweapon call BIS_fnc_selectRandom;
    _weapon = _weaponandmag select 0;
    _magazine = _weaponandmag select 1;
        switch (_gear) do {
        case 0 : {_aigear = ai_gear0;};
        case 1 : {_aigear = ai_gear1;};
        case 2 : {_aigear = ai_gear2;};
        case 3 : {_aigear = ai_gear3;};
        case 4 : {_aigear = ai_gear4;};
        case "Random" : {_aigear = ai_gear_random call BIS_fnc_selectRandom;};
    };
    _gearmagazines = _aigear select 0;
    _geartools = _aigear select 1;
    if (_skin == "") then {
        _aiskin = ai_skin call BIS_fnc_selectRandom;
    } else {
        _aiskin = _skin
    };
    _unit = _unitGroup createUnit [_aiskin, [(_position select 0),(_position select 1),(_position select 2)], [], 10, "PRIVATE"];
    [_unit] joinSilent _unitGroup;
    if (_backpack == "") then {
        _aipack = ai_packs call BIS_fnc_selectRandom;
    } else {
        _aipack = _backpack
    };
    _unit enableAI "TARGET";
    _unit enableAI "AUTOTARGET";
    _unit enableAI "MOVE";
    _unit enableAI "ANIM";
    _unit enableAI "FSM";
    _unit setCombatMode ai_combatmode;
    _unit setBehaviour ai_behaviour;
    removeAllWeapons _unit;
    removeAllItems _unit;
    _unit addweapon _weapon;
    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;    
};
    {_unit addMagazine _x} forEach _gearmagazines;
    {_unit addweapon _x} forEach _geartools;
    if (ai_custom_skills) then {
        switch (_skill) do {
        case 0 : {_aicskill = ai_custom_array1;};
        case 1 : {_aicskill = ai_custom_array2;};
        case 2 : {_aicskill= ai_custom_array3;};
        case "Random" : {_aicskill = ai_skill_random call BIS_fnc_selectRandom;};
        case "Sniper" : {_aicskill= ai_custom_array4;};
    };
        {_unit setSkill [(_x select 0),(_x select 1)]} forEach _aicskill;
    } else {
        {_unit setSkill [_x,_skill]} forEach _skillarray;
    };
    ai_ground_units = (ai_ground_units + 1);
    _unit addEventHandler ["Killed",{[_this select 0, _this select 1, "ground"] call on_kill;}];
    if (_mission) then {
        _unit setVariable ["missionclean", "ground"];
    };
};
_unitGroup selectLeader ((units _unitGroup) select 0);
[_unitGroup, _position, _mission] call group_waypoints;

diag_log format ["WAI: Spawned a group of %1 Bandits at %2",_unitnumber,_position];

 

 

You need to merge mine with yours. You are looking for the sections in red, add those into your existing AIConfig and SpawnGroup. What this does is set up the Snipers to spawn with true AS50's, maximum damage rounds (not the 107 ones, they don't do as much damage), and they have maximum skill sets. Doing it this way won't mess with any other missions. You are free to change these weapons/skills/inventory/whatever into any custom group you want. Just rename the mission when you are done of course.

 

This also gives you a nice template to follow in case you want to add more custom, specific AI at particular places. If I had time I'd totally custom out my entire groups, adding Generals and lower ranking officers, specific snipers to each squad, etc so it was more like a real military mission. Time is my enemy, I just never seem to have enough.

Link to comment
Share on other sites

Sad that its not compatible with DZAI, I really wish to use it with it.

I'm currently running DZAI air patrols/vehicle patrols along with the WAI missions on my Napf server. It seems to work fine as far as I can tell. The missions spawn in and the air and land patrols go about their business.

Link to comment
Share on other sites

Would it be possible to use customSpawns.sqf to spawn in both friendly and enemy AI? One thing I like about SARGE AI is when you spawn in on your server there is already a battle going on between the opposing factions of AI. It just oozes ambience when spawning into a war zone and it gives you the feeling that you are just a small part of the bigger picture. If it can be done, I'll spawn in some opposing factions nearby my base.  

Link to comment
Share on other sites

I run DZMS, WAI, and DZAI all together on my server (happily I might add). If you set "DZAI_freeForAll = true;" then ALL of the spawned AI (even from the other two mods) will be hostile towards each other. This has lead to some interesting exchanges I've happened to watch like 2 different AI choppers dogfighting, static M2 and missile gunners shooting at other AI patrols, even full squad-on-squad fighting with a peppering of DZAI bandits involved. They even shoot down any stray AI flying the chopper crash replacement mod as it does it's waypoints.

 

To be honest it all became a bit much and I turned it off. Too much shooting and craziness considering the amount of missions and patrols I run on the server.

Link to comment
Share on other sites

Its working fine I install it and I don,t know why its said to not use DZAI with any other AI, anyway its work. 

 

Anybody know why I got this error in my RTP  

 

_unit = _unitGroup createUnit [_aiskin, [(_position select >
 7:33:48   Error position: <createUnit [_aiskin, [(_position select >
 7:33:48   Error Type Any, expected Number
 7:33:48 File z\addons\dayz_server\WAI\compile\SpawnGroup.sqf, line 53
 7:33:48 Error in expression <{
_aiskin = _skin
};
Link to comment
Share on other sites

 

Its working fine I install it and I don,t know why its said to not use DZAI with any other AI, anyway its work. 

 

Anybody know why I got this error in my RTP  

 

_unit = _unitGroup createUnit [_aiskin, [(_position select >
 7:33:48   Error position: <createUnit [_aiskin, [(_position select >
 7:33:48   Error Type Any, expected Number
 7:33:48 File z\addons\dayz_server\WAI\compile\SpawnGroup.sqf, line 53
 7:33:48 Error in expression <{
_aiskin = _skin
};

 

 

DZAI works fine with the various mission systems around, the author just never guaranteed it would work with Sarge AI.

 

Pastebin your SpawnGroup.sqf for folks to see, looks like there's a missing bracket or something.

Link to comment
Share on other sites

Side, go grab my WAI mission pack in the second post on this thread:

Now grab the sniper mission out and use that as a template for what you want to do. You'll need to edit two files in your WAI package, so follow these examples:

 

 

Thanks for that.

 

I see where, in the file SniperTeam.sqf you are using the string "Sniper"

 

And I see where, in the AIConfig file, you set up the array ai_wep5.

 

But what I don't see is where that string is bound to that array. There must be something that says, "Sniper" = ai_wep5

Link to comment
Share on other sites

Look in SpawnGroup for this:

case "Sniper" : {_aiweapon = ai_wep5;};

and

case "Sniper" : {_aicskill= ai_custom_array4;};

Now, if I had only made them RED in the post you quoted so that you wouldn't have missed them had you looked....Oh wait, I did: ;)

 

You are looking for the sections in red, add those into your existing AIConfig and SpawnGroup.

Link to comment
Share on other sites

How can i make ai neutral + humanity and hostile to - humanity? Also if you have + humanity and shot ai that they will shot back.  i tried this 

 

createCenter RESISTANCE;
RESISTANCE setFriend [EAST,0];
RESISTANCE setFriend [WEST,1];
 
Also changed sides on air land  side options.
they wont shoot back if your west/+ humanity and attack if your -  humanity in a veh. 
Link to comment
Share on other sites

I'll be perfectly honest with you that I need to sit down over a weekend and tear apart the AI code to understand WTF is really going on under the hood with them. I see a lot of odd behavior in them and I think it could be streamlined better so they behave more like we would like them to.

Link to comment
Share on other sites

im getting this error in my rpt. iv not changed anything in the wai files either

 3:32:11 File z\addons\dayz_server\WAI\missions\missions\crash_spawner.sqf, line 73
 3:32:11 Error in expression <t 2;
_radius =	_this select 3;

switch (_iClass) do
{
default
{

_item = createV>
 3:32:11   Error position: <_iClass) do
{
default
{

and the section its referring too

 

for "_x" from 1 to _num do {
    //create loot
    _index = floor(random _cntWeights);
    _index = _weights select _index;
    _itemType = _itemTypes select _index;
    [_itemType select 0, _itemType select 1, _position, 5] call spawn_loot;
    //diag_log(format["CRASHSPAWNER: Loot spawn at '%1' with loot table '%2'", _crashName, _lootTable]);
};

 

 

any help is greatly appreciated

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