Simple AI Tutorial (no rMod or DayZ_Factions)

Then put this sqf file in your units\ directory:

Code:
//NPC_AlertZombies.sqf
 
private["_unit","_distance","_i","_listTalk","_zombie","_targets","_pos"];
//Alert Zed's to noise of shot
_unit =_this select 0;
_distance = _this select 1;
_doRun =_this select 2;
_pos =_this select 3;
_listTalk = _pos nearEntities ["zZombie_Base",_distance * 2];
 
 
// post to the RPT file if an npc alerts a zed
diag_log format ["NPC_AlertZombies: %1, %2, %3, %4",_unit,_distance,_dorun,_pos];
 
 
//hint str(_listTalk);
 
{
_zombie = _x;
if (_doRun) then {
_targets = _zombie getVariable ["targets",[]];
if (!(_unit in _targets)) then {
_targets set [count _targets,_unit];
_zombie setVariable ["targets",_targets,true];
};
} else {
_zombie setVariable ["myDest",_pos,true];
};
} forEach _listTalk;

That's pretty much the same code that alerts the zombies to a player gunshot, but the dayz code passes some ranges based upon the fired weapon, which I'm sure could be added pretty easily - baby steps :)[/quote]

Where is the Units Directory??
 
He is just saying to create a units directory at the root of the mission folder and place this file in there, I believe.
 
He is just saying to create a units directory at the root of the mission folder and place this file in there, I believe.
okay for some reason after trying this and removing it none of my AIs will spawn:/?? I corrected my add_unit_server.sqf back to the way it was as far as I could tell..
 
Try using this init.sqf and tell me if it works
Nope:/ That only brought me to an empty grass plane? I'm not sure why they suddenly all vanished I don't get any error messages or anything it happened right after attempting to get the zeds to react to AI gunfire, than they vanished so I switched everything back and it stopped working??
 
Gary all players are West by default, and you can make AI either EAST or RESISTANCE at the moment with this add-on, as such any changes would affect the way AI treated any player char, that being said it may be possible to code a list of units that the ai is individually friendly to, I don't know how you would do that.
After thinking about this I started wondering: is "east" and "west" an ARMA thing or is it just a way to set the difference between friend and go in this script? If the 2nd is the case is it possible to add a "north" that would do what I'm looking for? I think this would be a hit as I know I'm not the only server owner who has a base that I test from and also has jerk players that insist on stealing vehicle and such, lol.
 
question is this separate from Axeman's script for adding AI or is this a modification to it? can i use your script as a standalone for adding AI to my server or do i need to do Axeman's scripts and then edit it and change it with your script (i really don't want to have to use Dayz factions i would rather just have script and no additional addons)
 
UNRELATED TO THE MOD: Has anyone ellse been playing dayz on chernaurus and Elektro suddenly explodes?? I was in the Northwest airfield and got shot by someone appearantly but only me and my friend tony were playing and he was in elektro when in exploded??? WTF!?! Like the whole city went up in a huge explosion and when I respawned it was still on fire and stayed that way till my server reset??
 
question is this separate from Axeman's script for adding AI or is this a modification to it? can i use your script as a standalone for adding AI to my server or do i need to do Axeman's scripts and then edit it and change it with your script (i really don't want to have to use Dayz factions i would rather just have script and no additional addons)
THIS IS STANDALONE ITY SAYS AT THE TOP NO RMOD OR DAYZ_FACTIONS.
 
_aispawn = [[4994.81,5114.19,0] 100,5,3,4,1,7,10,0,1800] execVM "scripts>
12:30:52 Error position: <100,5,3,4,1,7,10,0,1800] execVM "scripts>
12:30:52 Error Missing ]
12:30:52 File mpmissions\__cur_mp.oring\init.sqf, line 38
12:30:52 Error in expression <





Itried everything but everytim there are those errors. Can anybody halp me?

_aispawn = [[4994.81,5114.19,0] 100,5,3,4,1,7,10,0,1800] execVM "scripts>
12:30:52 Error position: <100,5,3,4,1,7,10,0,1800] execVM "scripts>
12:30:52 Error Missing ]
12:30:52 File mpmissions\__cur_mp.oring\init.sqf, line 38
12:30:55 Warning Message: Script scripts\zombie_generate.sqf not found
12:31:55 Client: Remote object 2:681 not found
12:33:10 Server error: Player without identity [TOP]Kevin334 (id 1545560980)
12:34:29 Error in expression <







_aispawn = [[4994.81,5114.19,0] 100,5,3,4,1,7,10,0,1800] execVM "scripts>
12:34:29 Error position: <100,5,3,4,1,7,10,0,1800] execVM "scripts>
12:34:29 Error Missing ]
12:34:29 File mpmissions\__cur_mp.oring\init.sqf, line 38
12:34:29 Error in expression <







_aispawn = [[4994.81,5114.19,0] 100,5,3,4,1,7,10,0,1800] execVM "scripts>
12:34:29 Error position: <100,5,3,4,1,7,10,0,1800] execVM "scripts>
12:34:29 Error Missing ]
12:34:29 File mpmissions\__cur_mp.oring\init.sqf, line 38
12:34:31 Warning Message: Script scripts\zombie_generate.sqf not found
 
Gary,

The sides in the game are defined in the game while there are actually 7 sides in total the issue is that all players are spawned west, including your char, which means that you all will be treated the same by all AI, no matter the side you make them. My ideas on this would be if based on UID you could make certain players not be West, though I do not know what that would do to the Zombies or any other part of the Dayz MOD. I am also looking into other ways of doing this but I have not had enough time to play with it. If I come up with a solution I will let you know.
 
ShryGuy,

Sorry for the delay - I found your issue in your add_unit_server.sqf

Code:
case 4 : {
_sniperSkin = "BAF_Soldier_Officer_DDPM";
_sniperRifle = "bizon_silenced";
_sniperAmmo = "64Rnd_9x19_SD_Bizon";
_sniperAmmoCount = 4;
_sniperGear = ["ItemBandage","FoodMRE"];
_sniperWeapons = ["NVGoggles","ItemKnife","ItemGPS","ItemMap","ItemMatchbox",];
_gunnerSkin = "US_Soldier_EP1";
_gunnerRifle = "M4A1_AIM_SD_camo";
_gunnerAmmo = "30Rnd_556x45_StanagSD";
_gunnerAmmoCount = 4;
_gunnerGear = ["ItemBandage","FoodMRE"];
_gunnerWeapons = ["NVGoggles","ItemKnife","ItemGPS","ItemMap""ItemMatchbox",];
_militiaSkin = "BAF_Soldier_MTP";
_militiaRifle = "MP5SD";
_militiaAmmo = "30Rnd_9x19_MP5SD";
_militiaAmmoCount = 4;
_militiaGear = ["ItemBandage","FoodMRE","ItemMorphine","ItemEpinephrine","ItemAntibiotic","ItemBloodbag"]; // Additional gear (does not include tools or guns)
_militiaWeapons = ["NVGoggles","ItemKnife","ItemHatchet","ItemGPS","ItemMap","ItemMatchbox"]; //Additional Guns and Tools
};

The issue is with Weapons line for sniper and gunner, you need to get rid of the comma at the end and add a comma between "ItemsMap" and "ItemsMatchbox" - let me know if that works
 
Can you post your init.sqf BF2Freak?

of course :)


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

dayZ_instance = 1;
dayzHiveRequest = [];
initialized = false;
dayz_previousID = 0;

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;

"filmic" setToneMappingParams [0.153, 0.357, 0.231, 0.1573, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";

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

if (isServer) then {

// For settings involving the factions, go to scripts\add_unit_server.sqf and adjust the settings at the top of the file
_factions = [] execVM "scripts\set_unit_faction.sqf";
//_aispawnpos - Worldspace location
//_wpradius - Distance you want units to be able to travel
//_wpnum - Number of waypoints to place withing that distance. The higher the number, the more extensively the units will travel
//_numunits - Number of units to place. Keep in mind that squads will be placed in multiples of this number
//_unitType - Type of unit to place. 0: Random, 1: Sniper, 2: Gunner, 3: Militia, 4: Squad of the previous 3 types
//_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
//_baseSkill - Lowest possible skill that the units can posess from 1 to 10
//_potentialSkill - Highes possible skill that the units can posess from 1 to 10
//_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
//_respawnTime - How long to wait until NPCs respawn (in seconds)

_aispawn = [[4994.81,5114.19,0] 100,5,3,4,1,7,10,0,1800] execVM "scripts\add_unit_server.sqf" ;// Fort des Dunes



};


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

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

if (isServer) then {
_serverMonitor = [] execVM "\z\addons\dayz_code\system\server_monitor.sqf";
};

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";
};
 
Bf2freak,

Are you using a packed pbo or an active mpmissions folder?

Also it may be easier to use the "upload a file" function for future files or add the code braces around it which is [ C O D E ] at the top before the file and [ / C O D E ] at the bottom of your file here on the forum, of course without the spaces between the letters.
 
I like the look of this, and judging by how many replies this post has it must be quite popular!

I started to go through all these, but it's heavy reading - I'm just wondering if it would be a good idea to just upload some files with basic presets?

I would just like to have AI who hate everybody but are medium skilled - I haven't quite worked out how to do this from the posts I have read :)
 
Back
Top