Simple AI Tutorial (no rMod or DayZ_Factions)

Code:
// 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 "\z\addons\dayz_code\init\compiles.sqf";
progressLoadingScreen 1.0;
 
// Set Tonemapping
"Filmic" setToneMappingParams [0.153, 0.357, 0.231, 0.1573, 0.011, 3.750, 6, 4];
setToneMapping "Filmic";
 
// Run the server monitor
if (isServer) then {
    _serverMonitor = [] execVM "\z\addons\dayz_server\system\server_monitor.sqf";
};
 
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, group type [0:random unit, 1:sniper, 2:gunner, 3:militiaman, 4:squad], faction [0:hates everyone except survivors, 1:hates everyone]]
    _aispawn = [[4648.7422,8.9400539,2553.0039],10,1,2,4,0] execVM "scripts\add_unit_server.sqf";
    _aispawn = [[4726.9707,9,2508.1321],10,1,2,4,0] execVM "scripts\add_unit_server.sqf";
    _aispawn = [[4784.3374,9,2472.6526],10,1,2,4,0] execVM "scripts\add_unit_server.sqf";
    _aispawn = [[4850.0493,9,2432.9983],10,1,2,4,0] execVM "scripts\add_unit_server.sqf";
   
};
   
};
 
// Run the player monitor
if (!isDedicated) then {
    0 fadeSound 0;
    waitUntil { !isNil "dayz_loadScreenMsg" };
    dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
 
    _id = player addEventHandler ["Respawn", { _id = [] spawn player_death; }];
    _playerMonitor = [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
   
    #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
};
What am I doing wrong? I don't use a pbo file. It's a mission folder called dayz_1.chernarus.; From what I understand it's almost like an extracted pbo file. I have been trying to make this work for the past couple of weeks now(the A.I. will not spawn) . I have tried almost everything. As a last resort, I have come hear to seek help. I will post any needed info, please help me :D
 
Code:
// 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 "\z\addons\dayz_code\init\compiles.sqf";
progressLoadingScreen 1.0;
 
// Set Tonemapping
"Filmic" setToneMappingParams [0.153, 0.357, 0.231, 0.1573, 0.011, 3.750, 6, 4];
setToneMapping "Filmic";
 
// Run the server monitor
if (isServer) then {
    _serverMonitor = [] execVM "\z\addons\dayz_server\system\server_monitor.sqf";
};
 
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, group type [0:random unit, 1:sniper, 2:gunner, 3:militiaman, 4:squad], faction [0:hates everyone except survivors, 1:hates everyone]]
    _aispawn = [[4648.7422,8.9400539,2553.0039],10,1,2,4,0] execVM "scripts\add_unit_server.sqf";
    _aispawn = [[4726.9707,9,2508.1321],10,1,2,4,0] execVM "scripts\add_unit_server.sqf";
    _aispawn = [[4784.3374,9,2472.6526],10,1,2,4,0] execVM "scripts\add_unit_server.sqf";
    _aispawn = [[4850.0493,9,2432.9983],10,1,2,4,0] execVM "scripts\add_unit_server.sqf";
 
};
 
};
 
// Run the player monitor
if (!isDedicated) then {
    0 fadeSound 0;
    waitUntil { !isNil "dayz_loadScreenMsg" };
    dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
 
    _id = player addEventHandler ["Respawn", { _id = [] spawn player_death; }];
    _playerMonitor = [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
 
    #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
};
What am I doing wrong? I don't use a pbo file. It's a mission folder called dayz_1.chernarus.; From what I understand it's almost like an extracted pbo file. I have been trying to make this work for the past couple of weeks now(the A.I. will not spawn) . I have tried almost everything. As a last resort, I have come hear to seek help. I will post any needed info, please help me :D
Upload your entire folder ill check it
 
Bandit,

If you are using Sycosis's files then your _aispawn lines are missing variables

Code:
 _aispawn = [[4648.7422,8.9400539,2553.0039],10,1,2,4,0] execVM "scripts\add_unit_server.sqf";

You only have 10 (Radius) 1 (waypoints) 2 (num units) 4 (unit type) 0 (faction) you need baseskill, potential skill, gearset and respawn time.

Full one looks like

Code:
_aispawn = [[6876.0,11165.0,0],300,100,1,4,0,3,10,1,900] execVM "Scripts\add_unit_server.sqf"; // Devils Castle
 
Bandit,

If you are using Sycosis's files then your _aispawn lines are missing variables

Code:
_aispawn = [[4648.7422,8.9400539,2553.0039],10,1,2,4,0] execVM "scripts\add_unit_server.sqf";

You only have 10 (Radius) 1 (waypoints) 2 (num units) 4 (unit type) 0 (faction) you need baseskill, potential skill, gearset and respawn time.

Full one looks like

Code:
_aispawn = [[6876.0,11165.0,0],300,100,1,4,0,3,10,1,900] execVM "Scripts\add_unit_server.sqf"; // Devils Castle
I'll give this a go, if not i'll post the file. Thanks :D
 
Where is the Script.txt file in the server files, its the only thing I can't seem to find.
Could someone put up some example files?
They would be great, for me to reference from.
 
This file comes with Battleye, depending on your version etc it could be quite different, if you run more than one mod it may be extremely different from person to person, if you are running the files from the OP it makes it pretty clear that you should change the lines that start with

5 addWaypoint, 5 addMPeventhandler, and 5 addWeapon to 1 addWaypoint, 1 addMPeventhandler, and 1 addWeapon.

The line numbers are provided for an original unchanged scripts.txt.

While this is not the best way to do it it will solve the problem.

My version of this mod is slightly different but you can see what the full line looks like here

http://opendayz.net/threads/morox-ai-sycosis-simple-ai-mod.9354/ post #13
 
I havent installed any mods, but I cant seem to find the script.txt file. Ive done searches for it, and I come up with nothing.
Does one know where in general it would be?

EDIT: I found them, but I found 5 of them

Also, did I do this file correctly?

Code:
// 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 "\z\addons\dayz_code\init\compiles.sqf";
 
progressLoadingScreen 1.0;
 
// Set Tonemapping
 
"Filmic" setToneMappingParams [0.153, 0.357, 0.231, 0.1573, 0.011, 3.750, 6, 4];
 
setToneMapping "Filmic";
 
// Run the server monitor
 
if (isServer) then {
 
_serverMonitor = [] execVM "\z\addons\dayz_server\system\server_monitor.sqf";
 
};
 
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 = [[136,37, 0],75,5,12,0,0,5,10,0,1800] execVM "scripts\add_unit_server.sqf";//Berezino Resistance
 
_aispawn = [[48,52, 0],250,14,12,0,1,5,10,1,1800] execVM "scripts\add_unit_server.sqf";//NorthEast Airfield East
 
};
 
// Run the player monitor
 
if (!isDedicated) then {
 
0 fadeSound 0;
 
waitUntil { !isNil "dayz_loadScreenMsg" };
 
dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
 
_id = player addEventHandler ["Respawn", { _id = [] spawn player_death; }];
 
_playerMonitor = [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
 
#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
 
};
 
ok crazy question, i want my AI to be hostile to all bandits, that works, shoot zombies, that works, but is there anyway to make the AI shoot regular survivors if they engage the AI?

thanks
 
If you are using Sycosis's AI you can control this in one of two ways, setting the AI to be EAST will mean they shoot everyone, or changing the friendliness of Resistance to a lower number. The other option is to add a hit eventhandler which will cause the AI to shoot back at the player, this is the way Sarge handles it in his AI I believe.
 
I have not tested this in A3 yet good to know it works, I need to test my updated code with it as well as it solves many of the issues with Sycosis' original files.
 
I have not tested this in A3 yet good to know it works, I need to test my updated code with it as well as it solves many of the issues with Sycosis' original files.
If you post your updated code I'll edit it to work for a3 and send it back.
 
I'll be honest, I didn't read all 41 pages. I am being told that this script is causing a "create vehicle restriction #1" during high traffic times. Long story short the AI are being counted as players and when actual players are joining as the server is filling up they spawn as gulls, hence the restriction. Anyone heard of this? Is it true?
 
The seagull issue is because of Arma2's 144 group/side limit. Since each DayZ player takes up 1 slot of the West side, you need to reserve 50 West groups for players. Personally I would avoid using West for AI altogether or limit the number of west AI groups to a maximum of 80 or so.
 
only when your AI is defined to be side west. Since Dayz generates a group for every single player, some might run into the limitation of Arma 2 140 groups / side.
 
Hey sarge I tried using your new release v1.1.0 of the sarge_ai script. ive done everything step by step. but as I join the server it just hangs on a screen that says Wait for host. i use the Dayz.st hosting if that helps
 
Hey Sycosis,

Thanks for this great piece of work, I do however have a question for you, whenever I try to enter the game after following your instructions I get the error message saying that the zombie_genarate.sqf file is missing, I have rechecked everything I can think of but nothing seems to work.

Thanks
 
Back
Top