Simple AI Tutorial (no rMod or DayZ_Factions)

just one question for you xyberviri where is them lines which you posted as i cant see them anywhere in the files we got are you sure that is for this specific one and not another add AI thread?
 
//generate waypoints
for [{ x=1 },{ x < _wpnum },{ x = x + 1; }] do {
_wppos = [_xpos+(x*20),_ypos+(x*20),_wpradius];
_wp = _aiGroup addWaypoint [_wppos, _wpradius];
_wp setWaypointType "MOVE";
};
_wp = _aiGroup addWaypoint [[_xpos,_ypos,0], _wpradius];
_wp setWaypointType "CYCLE";


thats whats at the bottom of that file so adding yours it should still make it all work yes?
 
i think also if their behavior of crouching and prone and standing over and over again doesn't look so great to you either, change these
_aiunit setCombatMode "RED";
_aiunit setBehaviour "COMBAT";
to
_aiunit setCombatMode "YELLOW";
_aiunit setBehaviour "AWARE";
or for snipers
_aiunit setCombatMode "YELLOW";
_aiunit setBehaviour "STEALTH";

play around with the code, have fun, see what it does, don't forget your ';'
http://wiki.zspecialunit.org/index.php?title=ArmA_2_AI_Intelligence
 
has aney one on dayz.st got this to work if yas can u please post y mision pob tx so i can us it as a reference
 
no go into set_unit_faction.sqf and changed the desired ones to 6 for friendly towards them and anything under it will attack all
 
The set_unit_faction.sqf on the first page is screwed up, everything is set to .5 so 0 and 1 will attack anything. I have even noticed resistance will attack other resistance squads so I had to make another line setting resistance friends with itself.

Anyone know how to set them friends with a _uid?
 
The east guys are all configured to have nvg's but they arent actually spawning with them, thus at night the players on my server can basically just walk right up to them and shoot them with no repercussions? Am I doing something wrong? Why arent they spawning with the gear I assign?
 
Has anyone gotten this to work and if so where do i put this bit of code:

// Alert zombies if a weapon is fired
_aiunit addEventHandler ["Fired", {[(_this Select 0),100,true,(getPosATL (_this Select 0))] execvm "Scripts\NPC_AlertZombies.sqf";}];

//_aiunit addEventHandler ["Fired", {diag_log format ["AIUNIT: Alert - unit is shooting shit - %1",_this];}]; // for testing eventhandler
diag_log format ["AIUNIT: Creating MPEvent Handler for %1 ",_aiunit];
 
you need to get that ai_alertzombies.sqf file, fn_spawn_deathFlies.sqf, ai_fired.sqf, and dayz_ai_functions from dayzBanditAI, edit dayz_ai_functions.sqf to look like this:
Code:
/*
  // if ((Player getVariable "SpareTime") > 0) then {...
  //Usage: call compile preprocessFileLineNumbers "dayz_ai_functions.sqf";
*/
 
    waituntil {!isnil "bis_fnc_init"};
    // [] call BIS_fnc_help;
    fnc_spawn_deathFlies = compile preprocessFileLineNumbers "compile\fn_spawn_deathFlies.sqf";
    ai_fired = compile preprocessFileLineNumbers "compile\ai_fired.sqf";
    ai_alertzombies = compile preprocessFileLineNumbers "compile\ai_alertzombies.sqf";
 
initialized = true;

add this to the bottom of your add_unit_server.sqf:
Code:
    _aiunit addEventHandler ["Fired", {_this call ai_fired;}];                        // Unit firing catches zombies attention, like player
    _aiunit addEventHandler ["Killed",{[_this,"banditKills"] call local_eventKill;}]; // Credit player for killing the AI bandit
    _aiunit addEventHandler ["Killed",{_this call fnc_spawn_deathFlies;}];            // Spawn flies for AI bandit corpse
    _aiunit addEventHandler ["Killed",{(_this select 0) setDamage 1;}];                            // (?)

and then add this in your mission init.sqf near the end of the loading screen stuff:

call compile preprocessFileLineNumbers "compile\dayz_ai_functions.sqf";
 
Thanks Cancerous, is this all i need to do, not sure if the Zeds are reacting to the AI shots, been runnin what you suggested and just can't tell, doesn't seem to be any more zeds than normal
 
you can adjust how 'loud' the AI gunshots are in that alert zombies, check your rpt log for errors if you still don't see an AI firing a lee enfield get mobbed, I don't think any of this stuff will make there be more zombies than normal tho
 
Do i need to have this anywhere? ALSO which line do i edit to change how loud
They are not getting mobbed and my report log doesn't show any errors

Code:
// Alert zombies if a weapon is fired
_aiunit addEventHandler ["Fired", {[(_this Select 0),100,true,(getPosATL (_this Select 0))] execvm "units\NPC_AlertZombies.sqf";}];
 
//_aiunit addEventHandler ["Fired", {diag_log format ["AIUNIT: Alert - unit is shooting shit - %1",_this];}]; // for testing eventhandler
diag_log format ["AIUNIT: Creating MPEvent Handler for %1 ",_aiunit];
 
Back
Top