Simple AI Tutorial (no rMod or DayZ_Factions)

For anyone using this mod, in the zombie_generate.sqf step, add this line instead:

_agent addRating -20000;

This is a much more efficient way to make AI hostile to zombies by addRating each zombie as it's spawned instead of addRating every zombie each time.
 
Hi Essix,

Thanks for the response

I have checked the spelling and it is exactly "zombie_generate.sqf" (with out the "") and the text in the init.sqf file is

zombie_generate = compile preprocessFileLineNumbers "scripts\zombie_generate.sqf";

I have even tried adding a capital S to the scripts folder which is located under MPMissions/scripts

Not sure what isn't working??

Thanks
 
Hi Essix,
Yes exactly like this - mpmission/scripts/ zombie_generate.sqf
Yes again the mpmissions folder has the following inside
Folder called "scripts"
Dayz_Chernarus1.PBO file. (my format of the file name may be wrong as I am at work)

Hi Morox,
Thanks I will have a look tonight when I'm home from work.

Thanks guys I will keep you updated

Regards
 
change this in your init.sqf
zombie_generate = compile preprocessFileLineNumbers "\scripts\zombie_generate.sqf";
to this
zombie_generate = compile preprocessFileLineNumbers "\mpmission\scripts\zombie_generate.sqf";
 
Does anyone know of a way to make these work client side as I have my own mod for dayz and want to reduce server lag by making them client side. Would make it one hell of a mod if I can get these in client side
 
Hey guys,

Thanks for this info, I managed to get the NPC's working on my server, no matter what I tried I couldn't get the Zombie_generate file to be seen so I removed it and all references to it.

In the end I changed the location to MPMissions\scripts (as suggested by Essix) in all of the files, this then started to work, I need to tidy a few loose ends but works great thank you.

Essix - Special thanks and thumbs up to you for giving the final fix.

Morox - I am going to have a go at your version over the weekend, thanks.

Thanks guys you have been a great help which has been much appreciated.

Mike
 
Scottieo,

I have never attempted it, since most AI is usually handled in the mission.sqm which is server side, I think that is why most people take that approach, also if set to client side I think every client would duplicate each spawn as it is coded at the moment. Are you seeing major performance issues with this?

Shiroken,

Glad to hear you have it working, I released a new version of my mod of this yesterday(alpha), and can be found at:

http://opendayz.net/threads/morox-ai-sycosis-simple-ai-mod.9354/page-7

It adds:

1. AI spawn their own Zeds
2. Zeds can attack and kill AI
3. Mission.sqm parser to allow conversion of custom waypoints into these AI script's

It fixes:

Respawning issues tracking gear/skill/locations/group membership

Regards
 
Current 1.7.6.1 Unbanned Skins Usable On AI:
Code:
    //class Ins_Soldier_1: Banned {};
    //class CDF_Soldier: Banned {};
    //class CDF_Soldier_Militia: Banned {};
    //class CDF_Soldier_AR: Banned {}
    //class Citizen3: Banned {};
    //class Worker1: Banned {};
    //class Villager1: Banned {};
    //class TK_CIV_Takistani01_EP1: Banned {};
    //class TK_CIV_Takistani05_EP1: Banned {};
    //class TK_INS_Soldier_EP1: Banned {};
    //class CZ_Soldier_DES_EP1: Banned {};
    //class US_Soldier_EP1: Banned {};
 
How long after restart of the server does the AI spawn?

Im at the NWAF now, where I put like 2 groups of 4, and none have spawned 15-20 minutes later...




Is this code below how long after restart they spawn, and only spawn 1 time pr restart?
OR
Do they spawn, say every 5 minutes, if you put it to like 300 seconds?

Code:
//_respawnTime - How long to wait until NPCs respawn (in seconds)
 
They should spawn instantly on the first player's join after server restart. If you are using Sycosis's code the issue with respawns is that the position of the AI gets over written if you have multiple AI lines.
 
Can someone Help me with the script? I hope people still read this fourm. My ai arent spawning some reason. I didnt mess with the Add_unit_server.sqf or the unit_killed.sqf i just touched the set_unit faction .
I dont know how to do this so i'll just copy and paste :

MissionPBO/int.sqf
-----------------------------------

// Mission Initialization
startLoadingScreen ["", "RscDisplayLoadCustom"];
cutText ["", "BLACK OUT"];
enableSaving [false, false];

// Variable Initialization
dayZ_instance = 1;
dayzHiveRequest = [];
initialized = false;
dayz_previousID = 0;

// Settings
player setVariable ["BIS_noCoreConversations", true];// Disable greeting menu
//enableRadio false;// Disable global chat radio messages

// Compile and call important functions
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\variables.sqf";
progressLoadingScreen 0.1;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf";
progressLoadingScreen 0.2;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\setup_functions_med.sqf";
progressLoadingScreen 0.4;
call compile preprocessFileLineNumbers "compiles.sqf";
call compile preprocessFileLineNumbers "custom\compiles.sqf"; //Compile custom compiles };
zombie_generate = compile preprocessFileLineNumbers "scripts\zombie_generate.sqf";
progressLoadingScreen 1.0;

// Set Tonemapping
"Filmic" setToneMappingParams [0.153, 0.357, 0.231, 0.1573, 0.011, 3.750, 6, 4];
playerstats = compile preprocessFileLineNumbers "debug\playerstats.sqf";
setToneMapping "Filmic";

// Run the server monitor - BACKUP RIGHT NOW
if (isServer) then {
_serverMonitor = [] execVM "\z\addons\dayz_server\system\server_monitor.sqf";
_factions = [] execVM "scripts\set_unit_faction.sqf";
_aispawn = [[6689.49,2623.59,0],160,8,4,0,0,3,6,0,200] execVM "units\add_unit_server.sqf"; //Chernogorsk Resistance
_aispawn = [[5468.26,13326.3,0],350,5,1,0,1,3,6,0,200] execVM "units\add_unit_server.sqf"; // Admin Base East
_aispawn = [[6393.14,7862.84,0],5000,20,8,0,0,3,6,0,200] execVM "units\add_unit_server.sqf"; // Stary Resistance
_aispawn = [[4482.47,10287.6,0],6000,27,8,0,1,3,6,0,200] execVM "units\add_unit_server.sqf"; // NWAF EAST


};

if (!isServer && isNull player) then {
waitUntil { !isNull player };
waitUntil { time > 3 };
};

if (!isServer && player != player) then {
waitUntil { player == player };
waitUntil { time > 3 };
};



// Run the player monitor
if (!isDedicated) then {
[] execVM "Scripts\kh_actions.sqf";
0 fadeSound 0;
waitUntil { !isNil "dayz_loadScreenMsg" };
dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");

_id = player addEventHandler ["Respawn", { _id = [] spawn player_death; }];
_playerMonitor = [] execFSM "admintools\player_monitor.fsm";

#include "gcam\gcam_config.hpp"
#include "gcam\gcam_functions.sqf"

#ifdef GCAM
waitUntil { alive Player };
waituntil { !(IsNull (findDisplay 46)) };

if (serverCommandAvailable "#kick") then { (findDisplay 46) displayAddEventHandler ["keyDown", "_this call fnc_keyDown"]; };
#endif
};

//Admin Tools
[] execVM "admintools\Activate.sqf";

//Weather - Snow - Fog
// SnowStorm:
if (!isDedicated) then {
[] execVM "effects.sqf";
};
 
They should spawn instantly on the first player's join after server restart. If you are using Sycosis's code the issue with respawns is that the position of the AI gets over written if you have multiple AI lines.

What do you mean Multiple Lines? My AI are having the same problem as Alexander. I have Multiple AI spawn points, and the AI arent spawning at anyof them. I checked around the areas. Nothing! Can you elaborate a solution to this?
 
I was referring to respawning which the OP scripts have an issue with. I would highly recommend looking at:

http://opendayz.net/threads/morox-ai-sycosis-simple-ai-mod.9354/

Which solves many of the problems in these scripts.

However towards your current problem are you seeing any errors in your RPT log, you should see an entry saying "Global Faction is #" (the number being the side you set each group to) in the log when the AI spawn.

I would also recommend for testing setting the wpradius and number of waypoints to 1,1 which will lock the AI in place to make sure they don't move around.
 
I was referring to respawning which the OP scripts have an issue with. I would highly recommend looking at:

http://opendayz.net/threads/morox-ai-sycosis-simple-ai-mod.9354/

Which solves many of the problems in these scripts.

However towards your current problem are you seeing any errors in your RPT log, you should see an entry saying "Global Faction is #" (the number being the side you set each group to) in the log when the AI spawn.

I would also recommend for testing setting the wpradius and number of waypoints to 1,1 which will lock the AI in place to make sure they don't move around.

Thank's for the reply! I will test the waypoint and look at the multi position fix now. @ Global Faction is # - How can i fix this problem?
 
Sorry M
Thank's for the reply! I will test the waypoint and look at the multi position fix now. @ Global Faction is # - How can i fix this problem?
Misread. I have 30 - so people on my server, so the RPT log gets filled. I skimmed through it couldn't find anything - I will try it locked just for me.
 
Still didn't work. I changed it the way you said too!
int.sqf
-------

// Run the server monitor - BACKUP RIGHT NOW
if (isServer) then {
_serverMonitor = [] execVM "\z\addons\dayz_server\system\server_monitor.sqf";
_factions = [] execVM "scripts\set_unit_faction.sqf";
spawncnt = 0;
_aispawn = [[6689.49,2623.59,0],1,1,4,0,0,3,6,0,200] execVM "units\add_unit_server.sqf"; //Chernogorsk Resistance 160 l 8
_aispawn = [[5468.26,13326.3,0],1,1,1,0,1,3,6,0,200] execVM "units\add_unit_server.sqf"; // Admin Base East 350 l 5
_aispawn = [[6393.14,7862.84,0],1,1,8,0,0,3,6,0,200] execVM "units\add_unit_server.sqf"; // Stary Resistance 5000 l 20
_aispawn = [[4482.47,10287.6,0],1,1,8,0,1,3,6,0,200] execVM "units\add_unit_server.sqf"; // NWAF EAST 6000 l 27
------------------------------

Any other idea's I could try? :/

------------------------
I found couple things in RPT Log. (Before I did the fix for multi positions)
---------------
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/Offroad_SPG9_Gue/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/HMMWV_Ambulance/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/HMMWV_Avenger/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/USMC_Soldier/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/USMC_Soldier_AT/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/Profiteer2/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/M119/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/DSHkM_Mini_TriPod/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/SearchLight/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/Igla_AA_pod_East/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/RU_Soldier/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/2b14_82mm/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/M252/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/M2HD_mini_TriPod/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/MK19_TriPod/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/C130J/
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/T34/
Unrecognized CfgNonAIVehicles simulation thing in bin\config.bin/CfgNonAIVehicles/StreetLamp/
Unrecognized CfgNonAIVehicles simulation thing in bin\config.bin/CfgNonAIVehicles/StreetLamp_BaseWeakYellow/
Unrecognized CfgNonAIVehicles simulation thing in bin\config.bin/CfgNonAIVehicles/StreetLamp_BaseMediumOrange/
Unrecognized CfgNonAIVehicles simulation thing in bin\config.bin/CfgNonAIVehicles/StreetLamp_BaseMediumPale/
Unrecognized CfgNonAIVehicles simulation thing in bin\config.bin/CfgNonAIVehicles/StreetLamp_BaseStrongPale/
Unrecognized CfgNonAIVehicles simulation thing in bin\config.bin/CfgNonAIVehicles/StreetLamp_EP1/
Unrecognized CfgNonAIVehicles simulation thing in bin\config.bin/CfgNonAIVehicles/Land_Lamp_Cable_EP1/
Unrecognized CfgNonAIVehicles simulation thing in bin\config.bin/CfgNonAIVehicles/Land_Lamp_Street1_decor_EP1/
Unrecognized CfgNonAIVehicles simulation thing in bin\config.bin/CfgNonAIVehicles/Land_Lamp_Small_EP1/
Unrecognized CfgNonAIVehicles simulation thing in bin\config.bin/CfgNonAIVehicles/Land_Lamp_Street1_EP1/
Unrecognized CfgNonAIVehicles simulation thing in bin\config.bin/CfgNonAIVehicles/Land_Lamp_Street2_EP1/
Unrecognized CfgNonAIVehicles simulation thing in bin\config.bin/CfgNonAIVehicles/Land_Lampa_Ind_EP1/

-----------------
Thanks for helping me btw :)
 
Back
Top