Simple AI Tutorial (no rMod or DayZ_Factions)

Ok, here's a weird one for y'all:

So I got everything working first try using the default files from the first post.

I notice that the "militia" class is spawning in without rifles.

I open the add_unit_server.sqf and find that the militia class has L85A2AWS(banned weapon)set as it's primary(and StanagSD ammo for some reason).

I edited and replaced the BAF_L85A2_RIS_CWS(L85A2AWS)- with SCAR_L_CQC_Holo(an unbanned MK16 variant) and also edit the ammo to be standard stanag. Save/close/repack/re-upload/restart.

Ever since this change everyone joining the server gets the following error message:
"you cannot play/edit this mission its dependent on downloadable content that has been deleted. dayz.anim" - but they are still able to join and play normally.


Ok, so the weird thing is, that's the same error people used to get when picking up the L85A2AWS in-game when it was removed/glitched in a patch about 9mo. ago.

I replaced SCAR_L_CQC_Holo with G36C(100% positively for sure unbanned) but still get the error.

I went through my add_unit_server.sqf and couldn't find any other references to BAF_L85A2_RIS_CWS or any other specific weapon outside the "case sections", so I'm kind of at a loss on where to make any corrections to fix this.

Any ideas? (relevent portion of my current add_unit_server.sqf is posted below)

Code:
// to add more gear sets, just add another case, and copy and paste the variables from one of the other cases into it, and then reference it in the init.
switch (_gearSet) do {
    case 0 : {
        _sniperSkin = "BAF_Soldier_Sniper_MTP";
        _sniperRifle = "DMR";
        _sniperAmmo = "20Rnd_762x51_DMR";
        _sniperAmmoCount = 10;
        _sniperGear = ["ItemBandage"];
        _sniperWeapons = ["ItemMatchbox"];
        _gunnerSkin = "BAF_Soldier_MTP";
        _gunnerRifle = "Mk_48_DZ";
        _gunnerAmmo = "100Rnd_762x51_M240";
        _gunnerAmmoCount = 10;
        _gunnerGear = ["ItemBandage"];
        _gunnerWeapons = ["ItemMatchbox"];
        _militiaSkin = "BAF_Soldier_L_MTP";
        _militiaRifle = "G36C";
        _militiaAmmo = "30Rnd_556x45_Stanag";
        _militiaAmmoCount = 10;
        _militiaGear = ["ItemBandage"]; // Additional gear (does not include tools or guns)
        _militiaWeapons = ["ItemMatchbox"]; //Additional Guns and Tools
    };

Try giving them the same item as the gunner and see if the error still exists, it seems it may be an issue of Arma2 vs Arma2OA model by a quick look into this error.
 
6:54:21 Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/UN_CDF_Soldier_EP1/
6:54:21 "Spawned: "32" UralCivil2"
6:54:22 "Spawned: "33" V3S_Civ"
6:54:22 Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/Woodlander2/
6:54:22 "Spawned: "35" HMMWV_DES_EP1"
6:54:22 "Spawned: "37" datsun1_civil_3_open"
6:54:22 Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/Villager4/
6:54:22 "Spawned: "38" car_hatchback"
6:54:22 "Spawned: "40" datsun1_civil_3_open"
6:54:22 "Spawned: "41" Ural_INS"
6:54:22 Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/Ins_Soldier_2/
6:54:22 "Spawned: "42" Ural_INS"
6:54:22 "Spawned: "43" Ural_INS"
6:54:22 "Spawned: "44" Ural_INS"
6:54:22 "Spawned: "45" Old_bike_TK_INS_EP1"
6:54:22 "Spawned: "47" TT650_TK_CIV_EP1"
6:54:22 "Spawned: "48" TT650_Civ"
6:54:22 "Spawned: "50" TT650_Gue"
6:54:22 Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/GUE_Soldier_3/

Gary, have you changed your add_unit_server.sqf since the one you posted before, either way can you post your current one, it seems like there are some errors loading some stuff in your setup.

Regards
 
Gary I may have found your error.

Looks OK (Is good)
_aispawn = [[10490,17604,0],900,50,3,4,1,7,10,0,1000] execVM "scripts\add_unit_server.sqf";

NOT OK (Not good, wont work)
_aispawn = [[16630,11598,0]],700,50,3,4,1,7,10,0,1000] execVM "scripts\add_unit_server.sqf";

See the error? You are putting an extra ']' where it doesnt belong for the coordinates where the ai should be spawning.

I edited your init sqf that u posted a couple pages back. Give this a try

If you could post your full rpt log after attempting that I'll be able to help a bit more

I've also found that spawning too many squads in one location tends to not work. BUT YMMV
 

Attachments

  • init.sqf
    5.1 KB · Views: 5
Has anyone got this working for Lingor (1.7.5)? I changed my (dayz.st) server from Chernarus, and updated the worldspace, but now am getting an error "server is 1.7.5, my dayz_code.pbo is 1.7.6.1". I did update the add_unit_server.sqf, by changing the skins of the AI. Maybe that may be the issue, I was using the unbanned skins that was posted on axemans thread. I will look at that later as I was getting a bin\config.bin/CfgVehicles/ as well.
 
I have this running on a lingor server as well. Sounds like you are grabbing the zombie generate / other files from the Cherno which is 1.7.6.1, but you should be grabbing it from the lingor folder
 
Gary I may have found your error.

Looks OK (Is good)
_aispawn = [[10490,17604,0],900,50,3,4,1,7,10,0,1000] execVM "scripts\add_unit_server.sqf";

NOT OK (Not good, wont work)
_aispawn = [[16630,11598,0]],700,50,3,4,1,7,10,0,1000] execVM "scripts\add_unit_server.sqf";

See the error? You are putting an extra ']' where it doesnt belong for the coordinates where the ai should be spawning.

I edited your init sqf that u posted a couple pages back. Give this a try

If you could post your full rpt log after attempting that I'll be able to help a bit more

I've also found that spawning too many squads in one location tends to not work. BUT YMMV
Thank you FAQ!!!! ill check it out!!
 
Heres my addunit.sqf, I have not changed it at all that I can remember.
 

Attachments

  • add_unit_server.sqf
    13 KB · Views: 4
FAQdaWorld - You're right, that is exactly what I blindly did...Didn't even think about it!
Thank you from preventing me from wasting an hour+ looking for the issue!
 
The respawn npc's, is not working very well.

I put 2 npc in Chernogorsk, and the other 2 in airfield.

In Chernogorsk, i killed two NPCs, however, not reappeared.

I checked the log, and the respawn occurred in the airfield.


My mission file (init.sqf) in spawn sequence, Chernogorsk, and then airfield:
Code:
_aispawn = [[6689.49,2623.59,0],30,5,1,4,1,7,10,0,12] execVM "units\add_unit_server.sqf"; //CHERNOGORSK
_aispawn = [[4598.66,10197.7,0],30,5,1,4,1,7,10,0,12] execVM "units\add_unit_server.sqf"; //AIRFIELD

arma2oaserver.rpt
Code:
21:28:54 "NPC dead! Respawning in 12"
21:29:04 "NPC dead! Respawning in 12"
21:29:06 "Respawning NPC at [4598.66,10197.7,0]"  <------airfield????
21:29:06 "globalFaction is 1"
21:29:16 "Respawning NPC at [4598.66,10197.7,0]"  <------airfield????
21:29:17 "globalFaction is 1"
 
Funny how a few goofy errors can make all the difference. I want to thank you guys for all the help! The AI claimed a lot of players today! Problem I'm still having is that they do not respawn except on restarts.
 
The respawn npc's, is not working very well.

I put 2 npc in Chernogorsk, and the other 2 in airfield.

In Chernogorsk, i killed two NPCs, however, not reappeared.

I checked the log, and the respawn occurred in the airfield.


My mission file (init.sqf) in spawn sequence, Chernogorsk, and then airfield:
Code:
_aispawn = [[6689.49,2623.59,0],30,5,1,4,1,7,10,0,12] execVM "units\add_unit_server.sqf"; //CHERNOGORSK
_aispawn = [[4598.66,10197.7,0],30,5,1,4,1,7,10,0,12] execVM "units\add_unit_server.sqf"; //AIRFIELD

arma2oaserver.rpt
Code:
21:28:54 "NPC dead! Respawning in 12"
21:29:04 "NPC dead! Respawning in 12"
21:29:06 "Respawning NPC at [4598.66,10197.7,0]"  <------airfield????
21:29:06 "globalFaction is 1"
21:29:16 "Respawning NPC at [4598.66,10197.7,0]"  <------airfield????
21:29:17 "globalFaction is 1"

This works:

Code:
_aiunit addEventHandler ["Killed",{null=_this+[(getPosATL (_this Select 0)),wpradius,wpnum,1] execVM "units\unit_killed.sqf";}];

getPosATL (_this Select 0)
 
Gary, it would go in your add_unit_server.sqf file, this line is the event handler for what to do when an NPC is killed. A couple of things to note here, first Jomine, like myself has changed the line to read addEventHandler and "Killed" instead of the addMPEventHandler and "MPKilled" that is in the original files posted - I explain what this fixed for me in my previous posts.

Gary my question to you is are you sure they are not just respawning somewhere else as was originally happening to Jomine? Does your log show Respawn NPC line like Jomine's does?

The only reason I think this could happen is because even though the add_unit_server.sqf is being called once per line from the init.sqf it seems that by the time the first NPC dies, all the _aiunit lines have been triggered and thereby the aispawnpos variable that is passed to the respawn script is the last one called in the init.sqf, though if this was truly the behavior it would be possible that when the respawn happens all the units would not only be in the same spot as the last line in the init.sqf but would inherit the rest of the variables as well such as radius/faction/skill/gearset etc - has this been anyone's experience? And does any one know the process tree for these files, or how the variable scope is maintained.

What Jomine's code does is pull the current position of the NPC at death and use that instead of a previously defined variable, which means the NPC should respawn where they died and not the original spawn point in the init.sqf, correct Jomine? And it seems you are not passing any of the variables I was concerned about in my prev paragraph like faction/gearset etc, is this to avoid that issue I described?
 
Could you paste the latest RPT, including a section where you kill an NPC and I would recommend shortening the respawn to 60 sec's for testing.

Mine show me this

Code:
17:45:41 "NPC dead! Respawning in 60"
17:45:46 "DEBUG FPS: 49.8442"
17:46:02 "NPC dead! Respawning in 60"
17:46:28 "Respawning NPC at [3993.98,4193.84,0]"
17:46:28 "globalFaction is 0"
17:46:41 "Respawning NPC at [3993.98,4193.84,0]"
17:46:41 "globalFaction is 0"
17:47:02 "Respawning NPC at [3993.98,4193.84,0]"
17:47:02 "globalFaction is 0"
17:47:46 "DEBUG FPS: 50"
17:47:57 "NPC dead! Respawning in 60"
 
i seriously cannot find one log in the rpt that shows a single AI killed. I do show a buch of "child" lines. Im not sure im looking in the right place. Dayz.st control pannel- view logs-parent directory-arma2oaserver.rpt??
 
Crash? Thats strange. The gps's are added to the add_unit sqf. It goes in tools "ItemGPS".

How specifically do I add them?? Do I only need to change this part :

case 0 : {
_sniperSkin = "BAF_Soldier_Sniper_MTP";
_sniperRifle = "BAF_AS50_scoped";
_sniperAmmo = "5RND_127x99_as50";
_sniperAmmoCount = 10;
_sniperGear = ["ItemBandage"];
_sniperWeapons = ["ItemMatchbox"];
_gunnerSkin = "BAF_Soldier_MTP";
_gunnerRifle = "Mk_48_DZ";
_gunnerAmmo = "100Rnd_762x51_M240";
_gunnerAmmoCount = 10;
_gunnerGear = ["ItemBandage"];
_gunnerWeapons = ["ItemMatchbox"];
_militiaSkin = "BAF_Soldier_L_MTP";
_militiaRifle = "M16A4_ACG";
_militiaAmmo = "30Rnd_556x45_Stanag";
_militiaAmmoCount = 10;
_militiaGear = ["ItemBandage"]; // Additional gear (does not include tools or guns)
_militiaWeapons = ["ItemMatchbox"]; //Additional Guns and Tools
};

to look like this?:
case 0 : {
_sniperSkin = "BAF_Soldier_Sniper_MTP";
_sniperRifle = "BAF_AS50_scoped";
_sniperAmmo = "5RND_127x99_as50";
_sniperAmmoCount = 10;
_sniperGear = ["ItemBandage","NVGoggles","Binocular_Vector"];
_sniperWeapons = ["ItemMatchbox","ItemHatchet","ItemKnife","ItemToolbox","ItemGPS"];
_gunnerSkin = "BAF_Soldier_MTP";
_gunnerRifle = "Mk_48_DZ";
_gunnerAmmo = "100Rnd_762x51_M240";
_gunnerAmmoCount = 10;
_gunnerGear = ["ItemBandage","NVGoggles","Binocular_Vector"];
_gunnerWeapons = ["ItemMatchbox","ItemHatchet","ItemKnife","ItemToolbox","ItemGPS"];
_militiaSkin = "BAF_Soldier_L_MTP";
_militiaRifle = "M16A4_ACG";
_militiaAmmo = "30Rnd_556x45_Stanag";
_militiaAmmoCount = 10;
_militiaGear = ["ItemBandage","NVGoggles","Binocular_Vector"]; // Additional gear (does not include tools or guns)
_militiaWeapons = ["ItemMatchbox","ItemHatchet","ItemKnife","ItemToolbox","ItemGPS"]; //Additional Guns and Tools
};

or do I have to make changes elswhere in the file as well??
 
Also is there a limit to how many NPCS will spawn?? And how do I add beartraps, Grenades, and vehicle parts to thier inventory??
 
It depends a lot on your server I think, as well as how many people are online at once. We're able to run 80 or so ai at once with minimal problems on a server that typically has between 35 - 45 people on. YMMV
 
Back
Top