Simple AI Tutorial (no rMod or DayZ_Factions)

Sycosis

Valued Member!
Help and discussion for Syscosis simple AI begins here...
bravo my friend. you saved me some valuable time from making my video tutorial.
I've been immersed in this stuff since I saw your thread, so really you should get some of the credit too.. lol.. i'll add you to the top..
 
In your Scripts folder (or wherever you host your files) insert an extracted copy of your zombie_generate.sqf from dayz.pbo and insert this line at the bottom of the sqf file:

Code:
{ _x addRating -20000; } forEach allMissionObjects "zZombie_Base";

To find your zombie_generate file you have to go into your dayz_code.pbo which is located inside of your arma 2 install folder, inside of the map you're editing, which for me is @DayZOring. Just open the pbo and it's inside of the compile folder.

I wouldn't edit anything else in the file. Thanks to ButtFace for this.
Ok got one here for you, I am using a managed server and DO NOT have access to this file however I have access to the dayz_mission.pbo in which I do all my editing and this particular file does not exist in here, so I guess I cannot get AI working with this method. The reason I am asking is because I got 3dJokers pbo, opened it, ripped some files out, re-coded others to my server bliss version the threw it in to see if it works and it did, so I used it as a guide to start my own file and got em working last night but am having trouble with getting them to patrol and thats how I have ended up here, trying to work out if this way would work on my server, Any Idea's?
 
Ok got one here for you, I am using a managed server and DO NOT have access to this file however I have access to the dayz_mission.pbo in which I do all my editing and this particular file does not exist in here, so I guess I cannot get AI working with this method. The reason I am asking is because I got 3dJokers pbo, opened it, ripped some files out, re-coded others to my server bliss version the threw it in to see if it works and it did, so I used it as a guide to start my own file and got em working last night but am having trouble with getting them to patrol and thats how I have ended up here, trying to work out if this way would work on my server, Any Idea's?
This file is located on your PC in your Arma2 install directory, you just have to copy it into your mission.pbo
 
Sycosis, Could you please have a quick look at my test file for the init.sqf and let me know if it is right?

Code:
/*
    INITILIZATION
*/
startLoadingScreen ["","DayZ_loadingScreen"];
cutText ["","BLACK OUT"];
enableSaving [false, false];
 
//disable greeting menu
player setVariable ["BIS_noCoreConversations", true];
//disable radio messages to be heard and shown in the left lower corner of the screen
enableRadio false;
 
//Load in compiled functions
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\variables.sqf";                //Initilize the Variables (IMPORTANT: Must happen very early)
progressLoadingScreen 0.1;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf";                //Initilize the publicVariable event handlers
progressLoadingScreen 0.2;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\setup_functions_med.sqf";    //Functions used by CLIENT for medical
progressLoadingScreen 0.4;
call compile preprocessFileLineNumbers "compiles.sqf";                //Compile regular functions
progressLoadingScreen 1.0;
 
"filmic" setToneMappingParams [0.153, 0.357, 0.231, 0.1573, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";
 
if ((!isServer) && (isNull player) ) then
{
waitUntil {!isNull player};
waitUntil {time > 3};
};
 
if ((!isServer) && (player != player)) then
{
  waitUntil {player == player};
  waitUntil {time > 3};
};
 
zombie_generate = compile preprocessFileLineNumbers "scripts\zombie_generate.sqf";
 
if (isServer) then {
    _factions = [] execVM "scripts\set_unit_faction.sqf";
    //diag_log format["Factions executed: %1",_factions];
    //Array to pass to .sqf: [[<worldspace>],radius of waypoints (in metres),number of waypoints,number of ai units]
    _aispawn = [[6229.81,7894.1, 0],75,5,12] execVM "scripts\add_unit_server.sqf";//Stary Sabor
    _aispawn = [[6329.81,7794.1, 0],250,14,12] execVM "scripts\add_unit_server.sqf";//Stary Sabor
};
 
if (isServer) then {
    _serverMonitor =    [] execVM "\z\addons\dayz_code\system\server_monitor.sqf";
};
 
if (!isDedicated) then {
    //Conduct map operations
    [] execVM "Scripts\kh_actions.sqf";
    [] execVM "fixes\change_streetlights.sqf";
    0 fadeSound 0;
    waitUntil {!isNil "dayz_loadScreenMsg"};
    dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
 
    //Run the player monitor
    _id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
    _playerMonitor =    [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
};
Yeah, the syntax is all correct. As long as you have a scripts folder with those 3 files, you should be g2g. Spawning 2 groups of 12 right?
 
Hi and thank you for your work.

I want to know one thing.

It is possible to change the skin of AI? for example:
-bandit skin for ai ennemies
-hero skin for ai friendly
If yes, how?
 
Yeah, someone did the research and found all the skins, give me a sec to find it.

it LOOKS like if you open config.cpp from dayz_anim.pbo in the @DayZ mod folder, look for lines that are marked //class and you get this:


Line 1179://class USMC_Soldier_MG: Banned {};
Line 1275://class Ins_Soldier_1: Banned {};
Line 1299://class CDF_Soldier: Banned {};
Line 1302://class CDF_Soldier_Militia: Banned {};
Line 1309://class CDF_Soldier_AR: Banned {};
Line 1318://class Citizen3: Banned {};
Line 1324://class Worker1: Banned {};
Line 1360://class Villager1: Banned {};
Line 1462://class TK_CIV_Takistani01_EP1: Banned {};
Line 1466://class TK_CIV_Takistani05_EP1: Banned {};
Line 1487://class TK_INS_Soldier_EP1: Banned {};
Line 1520://class CZ_Soldier_DES_EP1: Banned {};
Line 1535://class US_Soldier_EP1: Banned {};
Line 1947://class BAF_Soldier_MTP: Banned {};
Line 1948://class BAF_Soldier_DDPM: Banned {};
Line 1953://class BAF_Soldier_L_MTP: Banned {};
Line 1954://class BAF_Soldier_L_DDPM: Banned {};
Line 1967://class BAF_Soldier_Officer_MTP: Banned {};
Line 1968://class BAF_Soldier_Officer_DDPM: Banned {};
Line 1987://class BAF_Soldier_Sniper_MTP: Banned {};
Line 1988://class BAF_Soldier_SniperH_MTP: Banned {};
Line 1989://class BAF_Soldier_SniperN_MTP: Banned {};
Line 2005://class Soldier_Crew_PMC: Banned {};


I don't know if all of these are available; but I would guess no others would be.


It would appear that these are the default dayz unbanned models.

So from those skins, in your add_unit_server.sqf file, find the lines that have createUnit, and before them change the classname of the skin accordingly.

My code currently doesnt separate the factions loadouts, just their factions. I am working on my server as i go, and i havent gotten to that yet.. lol
 
I apologise in advance for my ignorance :confused:

What I've done so far:
- Extracted the zombie_generate.sqf file from @DayZLingor and put it in my MPMissions/dayz_1.lingor folder under a folder called "scripts"
- Added the line to that file as specified
- Copied the other two files from here to the scripts folder
- Added the lines to my init.sqf and altered the worldspace accordingly for lingor map

When I run the server and have a look at logs, nothing is mentioned about factions being generated, and going to the spot I put in the array it's empty.
Have I done something monumentally stupid (quite likely!) or am I missing something?
 
I apologise in advance for my ignorance :confused:

What I've done so far:
- Extracted the zombie_generate.sqf file from @DayZLingor and put it in my MPMissions/dayz_1.lingor folder under a folder called "scripts"
- Added the line to that file as specified
- Copied the other two files from here to the scripts folder
- Added the lines to my init.sqf and altered the worldspace accordingly for lingor map

When I run the server and have a look at logs, nothing is mentioned about factions being generated, and going to the spot I put in the array it's empty.
Have I done something monumentally stupid (quite likely!) or am I missing something?
I run DayZ.ST and have to use a mission.pbo, so i'm not entirely sure how to do it on other hosts. Is MPMissions/dayz_1.lingor folder the equivalent of a mission.pbo?
 
I run DayZ.ST and have to use a mission.pbo, so i'm not entirely sure how to do it on other hosts. Is MPMissions/dayz_1.lingor folder the equivalent of a mission.pbo?
The dayz_1.lingor folder contains description.ext/init.sqf and mission.sqm, so from what i can tell is pretty much an extracted pbo file
 
can you copy the init.sqf lines real quick so i can see that they're right.
of course, sorry, should have done that initially!
Code:
zombie_generate = compile preprocessFileLineNumbers "scripts\zombie_generate.sqf";
if (isServer) then {
//
    _factions = [] execVM "scripts\set_unit_faction.sqf";
    //diag_log format["Factions executed: %1",_factions];
    //Array to pass to .sqf: [[<worldspace>],radius of waypoints (in metres),number of waypoints,number of ai units, group type [0:random unit, 1:sniper, 2:gunner, 3:militiaman, 4:squad], faction [0:hates everyone except survivors, 1:hates everyone]]
    _aispawn = [[-31,[2981.9072,8077.3325,-0.025956452]],100,5,2,4,0] execVM "scripts\add_unit_server.sqf";
};

the worldspace is where i logged out and checked the DB, so should be a correct position

EDIT - you know what, i'm a fool, i realised the worldspace didn't need the [-31 part...just removed and the AI showed up, sorry for my stupidity!!
 
of course, sorry, should have done that initially!
Code:
zombie_generate = compile preprocessFileLineNumbers "scripts\zombie_generate.sqf";
if (isServer) then {
//
    _factions = [] execVM "scripts\set_unit_faction.sqf"; 
    //diag_log format["Factions executed: %1",_factions];
    //Array to pass to .sqf: [[<worldspace>],radius of waypoints (in metres),number of waypoints,number of ai units, group type [0:random unit, 1:sniper, 2:gunner, 3:militiaman, 4:squad], faction [0:hates everyone except survivors, 1:hates everyone]]
    _aispawn = [[-31,[2981.9072,8077.3325,-0.025956452]],100,5,2,4,0] execVM "scripts\add_unit_server.sqf";
};

the worldspace is where i logged out and checked the DB, so should be a correct position
Get rid of the [-31 in the beginning there. It's irrelevant to the worldspace in this scenario.. get rid of the additional ] after the worldspace as well..

_aispawn = [[2981.90,8077.33,0],100,5,2,4,0] execVM "scripts\add_unit_server.sqf";

That should result in 2 squads of resistance troops at those coords.. to clean it up i got rid of the unnecessary parts of the worldspace.. I only go 2 digits beyond the decimal, and I always make the Z axis 0
 
of course, sorry, should have done that initially!
Code:
zombie_generate = compile preprocessFileLineNumbers "scripts\zombie_generate.sqf";
if (isServer) then {
//
    _factions = [] execVM "scripts\set_unit_faction.sqf";
    //diag_log format["Factions executed: %1",_factions];
    //Array to pass to .sqf: [[<worldspace>],radius of waypoints (in metres),number of waypoints,number of ai units, group type [0:random unit, 1:sniper, 2:gunner, 3:militiaman, 4:squad], faction [0:hates everyone except survivors, 1:hates everyone]]
    _aispawn = [[-31,[2981.9072,8077.3325,-0.025956452]],100,5,2,4,0] execVM "scripts\add_unit_server.sqf";
};

the worldspace is where i logged out and checked the DB, so should be a correct position

EDIT - you know what, i'm a fool, i realised the worldspace didn't need the [-31 part...just removed and the AI showed up, sorry for my stupidity!!

I did the same thing when I did the worldspace from my database location too.. lol
 
Yeah, someone did the research and found all the skins, give me a sec to find it.

So from those skins, in your add_unit_server.sqf file, find the lines that have createUnit, and before them change the classname of the skin accordingly.

My code currently doesnt separate the factions loadouts, just their factions. I am working on my server as i go, and i havent gotten to that yet.. lol

and if I make a copy of add_unit_server.sqf in add_unit_server2.sqf

I put in the first hero skin and in the second, skin of the bandit

In the init file I added this line
Code:
_aispawn = [[4994.81,5114.19,0] 100,5,2,4,1] execVM "scripts\add_unit_server2.sqf" ;// Fort des Dunes
after

Code:
_aispawn = [[4994.81,5114.19,0] 100,5,2,4,0] execVM "scripts\add_unit_server.sqf" ;// Fort des Dunes

Which would
Code:
if (IsServer) then {
//
    _factions = [] execVM "scripts \ set_unit_faction.sqf";
    // diag_log format ["Factions Executed:% 1", _factions];
    // Array to pass to. Sqft: [[<worldspace>] radius of waypoints (in meters), number of waypoints, number of units I, group type [0: random unit, 1: sniper, 2 gunner, 3 : militiaman, 4 squad], faction [0: hates everyone except survivors, 1: everyone hates]]
    _aispawn = [[4994.81,5114.19,0] 100,5,2,4,0] execVM "scripts\add_unit_server.sqf" ; // Fort des Dunes
    _aispawn = [[4994.81,5114.19,0] 100,5,2,4,1] execVM "scripts\add_unit_server2.sqf" ;// Fort des Dunes
};

Although the two are different spawns and faction option [0: hates everyone except survivors, 1: everyone hates]] too.

This is possible without conflicts?
 
and if I make a copy of add_unit_server.sqf in add_unit_server2.sqf

I put in the first hero skin and in the second, skin of the bandit

In the init file I added this line
Code:
_aispawn = [[4994.81,5114.19,0] 100,5,2,4,1] execVM "scripts\add_unit_server2.sqf" ;// Fort des Dunes
after

Code:
_aispawn = [[4994.81,5114.19,0] 100,5,2,4,0] execVM "scripts\add_unit_server.sqf" ;// Fort des Dunes

Which would
Code:
if (IsServer) then {
//
    _factions = [] execVM "scripts \ set_unit_faction.sqf";
    // diag_log format ["Factions Executed:% 1", _factions];
    // Array to pass to. Sqft: [[<worldspace>] radius of waypoints (in meters), number of waypoints, number of units I, group type [0: random unit, 1: sniper, 2 gunner, 3 : militiaman, 4 squad], faction [0: hates everyone except survivors, 1: everyone hates]]
    _aispawn = [[4994.81,5114.19,0] 100,5,2,4,0] execVM "scripts\add_unit_server.sqf" ; // Fort des Dunes
    _aispawn = [[4994.81,5114.19,0] 100,5,2,4,1] execVM "scripts\add_unit_server2.sqf" ;// Fort des Dunes
};

Although the two are different spawns and faction option [0: hates everyone except survivors, 1: everyone hates]] too.

This is possible without conflicts?
Yeah, that should work fine.
 
bit of a stupid question (again!) but if i add two squads to spawn, both hating everyone, will they also attack each other, or are they added on the same group unless i specify otherwise?
 
bit of a stupid question (again!) but if i add two squads to spawn, both hating everyone, will they also attack each other, or are they added on the same group unless i specify otherwise?
0 and 1 hate each other, but 1 and 1 are friends and so are 0 and 0..
 
Back
Top