Simple AI Tutorial (no rMod or DayZ_Factions)

Reiben,

Here it is, I have only spawned one group of survivors here, but it should be enough for you to test if it works, they are at [3589.66,2206.73,0] Kamarovo.

Thank you morox for being as helpful as ever, I have been busy testing Sarge AI but have met with some issues, but I would take a look at what you've done for me and figure out from there.

Will post again if I encounter any issues while doing that.

Cheers, you deserve a beer for all the help in this thread lol.
 
Bolbies,

I have not seen that, are you packing these into a pbo or using them as straight files?

Gary,

Are you using the updated faction code I have added - it is possible that if the AI as died and respawned that it took the faction of the last _aispawn line in init.sqf to avoid this in the add_unit_server.sqf change the eventhandler line to look like this

Code:
_aiunit addEventHandler["Killed",{null=_this+[(getPosATL (_this Select 0)),wpradius,wpnum,1,1,(side (group (_this Select 0))),baseSkill,potentialSkill,gearSet,respawnTime] execVM "scripts\unit_killed.sqf";}];

Peter,

You can follow the OP tutorial and it should work, I have seen many posts which say that. I can tell you where I had some issues which seem to be the same for most users.

1. The AI disappear when you kill them
2. The AI don't respawn in the correct place
3. The AI change faction when they respawn

For me all three issues are solved by using the line I recommend to Gary above in place of the _aiunit addMPEventhandler line that comes in the OP add_unit_server.sqf. Now depending on what exactly you are trying to do with the AI you may run into other issues. I would be glad to assist in any troubleshooting I can.
 
Sasha, what version are you running 1.7.6.1? Your zombie_gen script is quite different than my default.
 
Bolbies,

I have not seen that, are you packing these into a pbo or using them as straight files?

Gary,

Are you using the updated faction code I have added - it is possible that if the AI as died and respawned that it took the faction of the last _aispawn line in init.sqf to avoid this in the add_unit_server.sqf change the eventhandler line to look like this

Code:
_aiunit addEventHandler["Killed",{null=_this+[(getPosATL (_this Select 0)),wpradius,wpnum,1,1,(side (group (_this Select 0))),baseSkill,potentialSkill,gearSet,respawnTime] execVM "scripts\unit_killed.sqf";}];

Peter,

You can follow the OP tutorial and it should work, I have seen many posts which say that. I can tell you where I had some issues which seem to be the same for most users.

1. The AI disappear when you kill them
2. The AI don't respawn in the correct place
3. The AI change faction when they respawn

For me all three issues are solved by using the line I recommend to Gary above in place of the _aiunit addMPEventhandler line that comes in the OP add_unit_server.sqf. Now depending on what exactly you are trying to do with the AI you may run into other issues. I would be glad to assist in any troubleshooting I can.

I am using them as straight files. Should I put them in a pbo?
 
Cool, Sasha try using this zombie gen and see if it makes a difference.
 

Attachments

  • zombie_generate.sqf
    2.9 KB · Views: 6
Sorry found issue in the original file, this one should work.

Bolbies, Sasha, Rhythmz you should all grab this and replace your old one.
 

Attachments

  • zombie_generate.sqf
    3 KB · Views: 12
I ran with the exact files Sasha put up and had issues then did the fix to zombie-gen I posted and now everything works for me. I'll double check you say it's in Elektro you get no spawns?
 
Is it possible to have the AI troops not despawn when killed? So they become lootable? Mine seem to despawn instantly.

Also ZEDS seem to be spawning really slow rates ;3.
 

Attachments

  • add_unit_server.sqf
    14.4 KB · Views: 3
  • set_unit_faction.sqf
    298 bytes · Views: 3
  • unit_killed.sqf
    1.4 KB · Views: 2
  • zombie_generate.sqf
    3 KB · Views: 3
The despawn times are tied to the respawn time, I noticed in your init.sqf you have the first two spawns set to 30 sec while the rest are 14000, I would say try adjusting that time and see if that works. I am running your files on my server and zombies are spawning at the proper rate, I ran through Elektro and there are plenty running around and spawning
 
I found the issue, your old zombie_gen was modified to be a little crazy on the zombie spawns, you don't check for max zombies nor do you have checks for various other things, adding your original mods back in, I can see how you would feel they are slow to spawn, there was easily triple the number of zombies with your mod. Here is the working AI with your mods.
 

Attachments

  • zombie_generate.sqf
    2.8 KB · Views: 8
Sasha,

So you have some stuff in your init that I don't have, but taking your files straight and removing the following lines - as I do not have the files

Code:
call compile preprocessFileLineNumbers "fixes\variables.sqf";                //Initilize the Variables (IMPORTANT: Must happen very early)
player_spawn_2 = compile preprocessFileLineNumbers "fixes\player_spawn_2.sqf";
[] execVM "scripts\kh_actions.sqf";
sleep 1; _fast_rope = [] execVM "addons\BTC_fast_roping_init.sqf";
sleep 1; _mv22_ramp = [] execVM "addons\mv22\mv22_init.sqf";

Everything works, Zombies + Loot + AI <- can you try commenting out those lines on yours and see if it works, it may be that one of those other scripts in somehow interfering.
 
Going through more of the files I see that there are errors for me in your add_unit_server.sqf and in one of you _aispawn lines in init.sqf

Code:
IN init.sqf
 
_aispawn = [[13371,6163.98,0],250,5,2,4,9,4,7,1,13600] execVM "scripts\add_unit_server.sqf"; //  Solchiniy Resistance(Survivors)

You have a 9 for global faction which is wrong

In add_unit_server.sqf for me it gives me errors on the skin names

17:15:37 Warning Message: Bad vehicle type Skin_Survivor2_DZ
17:32:32 Warning Message: Bad vehicle type Skin_Sniper1_DZ

I think you need to remove the skn_ unless you have modded this elsewhere.

I would say if you want me to test it fully provide the entire mission pbo or folder with all your addons.
 
Back
Top