Simple AI Tutorial (no rMod or DayZ_Factions)

@ 1S1KCH - I have the same problem, All AI that get killed respawn at the very last spawn point listed in the init.sqf
I'm sure Sycosis will find a fix :)
 
Greetings,

I am added with Editor a few WEST patrol's and i use now this ;

waitUntil{initialized};
//0Day
createCenter east;
createCenter resistance;
//Survivors
WEST setFriend [RESISTANCE,1];
WEST setFriend [EAST,0];
WEST setFriend [CIVILAN,0]; (i added this, but its not work)
//Bandits
EAST setFriend [RESISTANCE,0];
EAST setFriend [WEST,0];
//AI Units
RESISTANCE setFriend [WEST,1];
RESISTANCE setFriend [EAST,0];
RESISTANCE setFriend [CIVILIAN,0];//AI Units attack zeds

//CIVILIAN setFriend [RESISTANCE,0];//Testing Zeds attack AI units, doesn't seem to help..

I dont want Bandit AI's, i only want WEST protected Safe Camp's for newbies. This is possible?
WEST added with Editor and set them fire zombies and bandits (i think they already attack bandits)​
By the way i use RMod and my some patrols "FAC Operator" and "Saboteur".​
Thanks for answers..​
 
If you don't want bandits then don't have any AI set to East, All of this has been answered in the previous 22 pages, just read through and follow the instructions.
 
Can someone look at this and tell me what is wrong with it:

Code:
//_aispawnpos - Worldspace location(1st #)
//_wpradius - Distance you want units to be able to travel (2nd #)
//_wpnum - Number of waypoints to place withing that distance. The higher the number, the more extensively the units will travel (3rd #)
//_numunits - Number of units to place. Keep in mind that squads will be placed in multiples of this number (4th #)
//_unitType - Type of unit to place. 0: Random, 1: Sniper, 2: Gunner, 3: Militia, 4: Squad of the previous 3 types (5th #)
//_faction - The type of faction you want this unit to adhere to. 0: RESISTANCE, 1: EAST, 2: WEST. Factions loyalties are set in scripts\set_unit_faction.sqf (6th #)
//_baseSkill - Lowest possible skill that the units can posess from 1 to 10 (7th #)
//_potentialSkill - Highes possible skill that the units can posess from 1 to 10 (8th #)
//_gearSet - Which set of gear your units will use. To set the types of gear, edit the variables at the top of scripts\add_units_server.sqf (9th #)
//_respawnTime - How long to wait until NPCs respawn (in seconds) (10th #)
    _aispawn = [[11900,9100,0],150,5,4,4,0,5,6,1,1800] execVM "Scripts\add_unit_server.sqf";//Berezino center
    _aispawn = [[12200,9500,0],150,5,8,4,0,5,6,1,1800] execVM "Scripts\add_unit_server.sqf";//Berezino nord
    _aispawn = [[10500,2300,0],200,5,6,4,0,5,6,1,1800] execVM "Scripts\add_unit_server.sqf";//Electrozavodsk east
    _aispawn = [[10000,1900,0],200,5,8,4,0,5,6,1,1800] execVM "Scripts\add_unit_server.sqf";//Electrozavodsk west
    _aispawn = [[6700,2700,0],200,5,8,4,0,5,6,1,1800] execVM "Scripts\add_unit_server.sqf";//Chernogorsk east
    _aispawn = [[6400,2400,0],200,5,8,4,0,5,6,1,1800] execVM "Scripts\add_unit_server.sqf";//Chernogorsk west
    _aispawn = [[2700,5300,0],200,6,5,4,0,5,6,1,1800] execVM "Scripts\add_unit_server.sqf";//Zelenogorsk center
    _aispawn = [[6100,7700,0],300,8,6,4,0,5,6,1,1800] execVM "Scripts\add_unit_server.sqf";//Stary Sobor center
    _aispawn = [[6900,11400,0],400,10,3,4,1,5,6,0,1800] execVM "Scripts\add_unit_server.sqf";//Evil Castle center
    _aispawn = [[11000,12300,0],300,10,5,4,0,5,6,1,1800] execVM "Scripts\add_unit_server.sqf";//Krasnostav center sity
    _aispawn = [[12000,12600,0],400,10,5,4,0,5,6,1,1800] execVM "Scripts\add_unit_server.sqf";//Krasnostar center aero
    _aispawn = [[4900,9500,0],300,10,8,4,0,5,6,1,60] execVM "Scripts\add_unit_server.sqf";//NW Aero south baracs
    _aispawn = [[4700,10500,0],300,10,8,4,0,5,6,1,60] execVM "Scripts\add_unit_server.sqf";//NW Aero center baracs
    _aispawn = [[13600,2900,0],100,5,6,4,1,7,8,0,28800] execVM "Scripts\add_unit_server.sqf";//Community Base BANDIT CAMP
    _aispawn = [[11500,11300,0],100,5,6,4,1,7,8,0,28800] execVM "Scripts\add_unit_server.sqf";//Klen Bandit Base

I am testing at the NW Aero both the South and the Center, the problems i am having are 1, they don't shoot at zombies but will shoot at me 2, if i kill any of them to test the respawn they turn and shoot at me, 3, according to the RPT log they will respawn in 28800 secs even though i have it set to 60.

Here is my set_unit_faction.sqf:

Code:
waitUntil{initialized};
//0Day
createCenter east;
createCenter resistance;
//Survivors
WEST setFriend [RESISTANCE,1];
WEST setFriend [EAST,0];
//AI Units
RESISTANCE setFriend [WEST,1];
RESISTANCE setFriend [EAST,0];
//AI Units 2
EAST setFriend [WEST,0];
EAST setFriend [RESISTANCE,0];

and here is what i see in the report file:

Code:
 4:54:57 "NPC killed, respawning in 28800 seconds"
4:56:21 "NPC killed, respawning in 28800 seconds"
4:56:24 "NPC killed, respawning in 28800 seconds"

EDIT-- Got it to where they don't shoot ANYONE and i have everything set to 0 like below:

Code:
waitUntil{initialized};
//0Day
createCenter east;
createCenter resistance;
//Survivors
WEST setFriend [RESISTANCE,0];
WEST setFriend [EAST,0];
//AI Units
RESISTANCE setFriend [WEST,0];
RESISTANCE setFriend [EAST,0];
//AI Units 2
EAST setFriend [WEST,0];
EAST setFriend [RESISTANCE,0];

but they don't shoot zombies and i have killed the entire squads and according the the rpt log they are spawning in the wrong area:

Code:
6:31:50 "NPC killed, respawning in any seconds"
6:31:50 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 3, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:31:50 "globalFaction is 1"
6:31:51 "NPC killed, respawning in any seconds"
6:31:51 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 1, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:31:51 "globalFaction is 1"
6:32:28 "NPC killed, respawning in any seconds"
6:32:28 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 2, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:32:28 "globalFaction is 1"
6:32:47 "NPC killed, respawning in any seconds"
6:32:47 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 3, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:32:47 "globalFaction is 1"
6:33:22 "NPC killed, respawning in any seconds"
6:33:22 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 3, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:33:22 "globalFaction is 1"
6:33:26 "NPC killed, respawning in any seconds"
6:33:26 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 2, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:33:26 "globalFaction is 1"
6:33:35 "NPC killed, respawning in any seconds"
6:33:35 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 2, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:33:35 "globalFaction is 1"
6:33:44 "NPC killed, respawning in any seconds"
6:33:44 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 1, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:33:44 "globalFaction is 1"
6:33:50 "NPC killed, respawning in any seconds"
6:33:50 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 1, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:33:50 "globalFaction is 1"
6:33:51 "NPC killed, respawning in any seconds"
6:33:51 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 2, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:33:51 "globalFaction is 1"
6:33:53 "NPC killed, respawning in any seconds"
6:33:53 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 2, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:33:53 "globalFaction is 1"
6:33:57 "NPC killed, respawning in any seconds"
6:33:57 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 1, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:33:57 "globalFaction is 1"
6:33:57 "DEBUG FPS  : 10.2171"
6:34:07 "NPC killed, respawning in any seconds"
6:34:07 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 3, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:34:08 "globalFaction is 1"
6:34:35 O 1-1-B:13: moving in direct condition failed, dist 1.88397
6:34:37 "NPC killed, respawning in any seconds"
6:34:37 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 3, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:34:37 "globalFaction is 1"
6:34:40 "NPC killed, respawning in any seconds"
6:34:40 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 1, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:34:40 "globalFaction is 1"
6:34:44 "NPC killed, respawning in any seconds"
6:34:44 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 3, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:34:44 "globalFaction is 1"
6:34:47 "NPC killed, respawning in any seconds"
6:34:47 "Position: [11500,11300,0], Radius: 100, Waypoints: 5, Units: 1, Unit Type: 2, Faction: 1, Base Skill: 7, Potential Skill: 8, Gear Set: 0, Respawn Time: any"
6:34:47 "globalFaction is 1"

Looking at the code for where i am (NW Aero Center) that position is the last one in the list.....not even the ones i am killing and not even the right faction.

Not sure what i have done wrong but i can't seem to find the mistake so if ANYONE can give me a little guidance i would really appreciate it
Attacking the zombies is part of the zombie_generate code. Make sure you put in the addRating command as described on the original post at the bottom of that file. Your last 2 spawns DO have their respawn time set to 28880 or whatever. Are you killing those mobs and then checking the log? Make sure you have the latest unit_killed file. I updated it the other day to fix a problem with respawns.
 
@ 1S1KCH - I have the same problem, All AI that get killed respawn at the very last spawn point listed in the init.sqf
I'm sure Sycosis will find a fix :)
I fixed it in the most recent unit_killed update. I was using globalvariables improperly.. ;D
 
If you don't want bandits then don't have any AI set to East, All of this has been answered in the previous 22 pages, just read through and follow the instructions.

Thank you the answer, but i dont want any spawning AI, i added the AI's with Editor. And want them fire zombies, i make somethings in the previous 22 pages, but its not working. AI's still wont fire the zombies..
 
Thank you the answer, but i dont want any spawning AI, i added the AI's with Editor. And want them fire zombies, i make somethings in the previous 22 pages, but its not working. AI's still wont fire the zombies..
if you do what is in the first post of this thread with the zombie_generate file, they will fire on zombies, unless of course you don't have your AI set to attack mode. I don't know how to set them to attack mode from the editor though.
 
if you do what is in the first post of this thread with the zombie_generate file, they will fire on zombies, unless of course you don't have your AI set to attack mode. I don't know how to set them to attack mode from the editor though.

Hmm, i see. Thank you for answer. I try to add all way WEST soldiers, maybe one of them attack the zombies. Because i add the with PBO in my mission all files (zombie_generate/add_unit_server/unit_killed/set_unit_faction) I think i dont need the "unit_killed " and " add_unit_server" but i still added.
 
I fixed it in the most recent unit_killed update. I was using globalvariables improperly.. ;D
Hi Sycosis, I've just redownloaded the unit_killed.sqf from the first post and they are not respawning, I killed them all and waited over the 60 second respawn time and nothing.
No mention in my RPT either.

Any ideas ?
 
Hi Sycosis, I've just redownloaded the unit_killed.sqf from the first post and they are not respawning, I killed them all and waited over the 60 second respawn time and nothing.
No mention in my RPT either.

Any ideas ?
Code:
private ["_player","_killer","_aispawnpos","_wpradius","_wpnum","_numUnits","_unitType","_faction","_baseSkill","_potentialSkill","_gearSet","_respawnTime","_zombieKills","_humanity"];
_player = _this select 0;
_killer = _this select 1;
_aispawnpos = _this select 2;
_wpradius = _this select 3;
_wpnum = _this select 4;
_numUnits = _this select 5;
_unitType = _this select 6;
_faction = _this select 7;
_baseSkill = _this select 8;
_potentialSkill = _this select 9;
_gearSet = _this select 10;
_respawnTime = _this select 11;
_zombieKills = 0;
_humanity = 0;
 
_zombieKills = _killer getVariable["zombieKills",0];
_zombieKills = _zombieKills + 1;
_killer setVariable["zombieKills",_zombieKills,true];
_humanity = _killer getVariable["humanity",0];
_humanity = _humanity + 100;
_killer setVariable["humanity",_humanity,true];
 
diag_log format["NPC dead! Respawning in %1",_respawnTime];
sleep _respawnTime;
 
aispawnpos = _aispawnpos;
wpradius = _wpradius;
wpnum = _wpnum;
numUnits = _numUnits;
unitType = _unitType;
globalFaction = _faction;
baseSkill = _baseSkill;
potentialSkill = _potentialSkill;
gearSet = _gearSet;
respawnTime = _respawnTime;
 
diag_log format["Respawning NPC at %1",_aispawnpos];
_player hideObject true;
_aispawn = [aispawnpos,wpradius,wpnum,numUnits,unitType,globalFaction,baseSkill,potentialSkill,gearSet,respawnTime] execVM "scripts\add_unit_server.sqf";

use this code for your unit_killed.. for some reason i took the logging out of the one i posted.. this one will give you details about respawns in your rpt.
 
Attacking the zombies is part of the zombie_generate code. Make sure you put in the addRating command as described on the original post at the bottom of that file. Your last 2 spawns DO have their respawn time set to 28880 or whatever. Are you killing those mobs and then checking the log? Make sure you have the latest unit_killed file. I updated it the other day to fix a problem with respawns.

1st off Sycosis, i love this script and appreciate your time in it, the problem i was having is that i was at the NW AF the spawn time is set at 60 and they were respawning according to the log just at an entirely different location....they were spawning at the last location i had listed. I got the "them shooting zombies" issue fixed and they are shooting them.
 
use this code for your unit_killed.. for some reason i took the logging out of the one i posted.. this one will give you details about respawns in your rpt.

They still respawn at the wrong spawn point, Every AI killed spawns at the very last spawn point on my init.sqf again.
They were killed at the following 3 locations next to each other :
[[13346.4,8620.27,0]
[[13321.3,8731.87,0]
[[13419.3,8666.11,0]

RPT shows they all respawn here :
23:11:14 "NPC dead! Respawning in any"
23:11:14 "Respawning NPC at [8455.84,5615.88,0]"
23:05:17 "NPC dead! Respawning in any"
23:05:17 "Respawning NPC at [8455.84,5615.88,0]"
23:03:49 "NPC dead! Respawning in any"
23:03:49 "Respawning NPC at [8455.84,5615.88,0]"
 
On another note, do you have any idea when you might have it to where the Zeds react to the AI's shooting?

Just a question, not tryin to rush anything.
 
so if I added 2 new gearsets my new add_unit_server.sqf would look like this??
 

Attachments

  • add_unit_server.sqf
    14.3 KB · Views: 8
On another note, do you have any idea when you might have it to where the Zeds react to the AI's shooting?

Just a question, not tryin to rush anything.
I'm fixing some performance issues on my deathmatch server, and then I will work on it.
 
They still respawn at the wrong spawn point, Every AI killed spawns at the very last spawn point on my init.sqf again.
They were killed at the following 3 locations next to each other :
[[13346.4,8620.27,0]
[[13321.3,8731.87,0]
[[13419.3,8666.11,0]

RPT shows they all respawn here :
23:11:14 "NPC dead! Respawning in any"
23:11:14 "Respawning NPC at [8455.84,5615.88,0]"
23:05:17 "NPC dead! Respawning in any"
23:05:17 "Respawning NPC at [8455.84,5615.88,0]"
23:03:49 "NPC dead! Respawning in any"
23:03:49 "Respawning NPC at [8455.84,5615.88,0]"
attach your add_unit_server.. looks like your respawnTimer variable is localized instead of global..

In your add_unit_server it should be respawnTimer and not _respawnTimer
 
I have just one question - hope this hasn't been mentioned already in here .
The AI keep disappearing once I have killed them. When I log out and back in again one body will appear again. Has anyone else had this problem?

When AI gets killed, there is no death animation either. They just disappear.
 
Back
Top