Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
private["_aiunit","_xpos","_ypos","_unitpos","_aiGroup","_wppos","_wpradius","_wpnum","_numunits","_rndLOut","_ailoadout","_aiwep","_aiammo","_wp","_aispawnpos"];
_aiunit = objNull;
_aiGroup = createGroup resistance;
_aispawnpos =_this select 0;
_wpradius = _this select 1;
_wpnum = _this select 2;
_numunits = _this select 3;
_xpos = _aispawnpos select 0;
_ypos = _aispawnpos select 1;
diag_log format ["AIUNIT: Spawn initiated: Centre:%1 | Radius in m:%2 | Waypoint number:%3",_aispawnpos,_wpradius,_wpnum];
for [{ x=1 },{ x < _numunits+1 },{ x = x + 1; }] do {
_unitpos = [_xpos+x,_ypos+x,0];
_rndLOut=floor(random 3);
_ailoadout=
switch (_rndLOut) do
{
case 0: {["AK_47_M","30Rnd_762x39_AK47"]};
case 1: {["M4A1_AIM_SD_camo","30Rnd_556x45_StanagSD"]};
case 2: {["Remington870_lamp","8Rnd_B_Beneli_74Slug"]};
};
"BAF_Soldier_L_DDPM" createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];
diag_log format ["AIUNIT: Creating BAF_Soldier_L_DDPM by %1 at %2. Result:%3 | Loadout:%4 / Num:%5",player,_unitpos,_aiunit,_ailoadout,_rndLOut];
_aiunit enableAI "TARGET";
_aiunit enableAI "AUTOTARGET";
_aiunit enableAI "MOVE";
_aiunit enableAI "ANIM";
_aiunit enableAI "FSM";
_aiunit allowDammage true;
_aiunit setCombatMode "RED";
_aiunit setBehaviour "COMBAT";
//clear default weapons / ammo
removeAllWeapons _aiunit;
//add random selection
_aiwep = _ailoadout select 0;
_aiammo = _ailoadout select 1;
_aiunit addweapon _aiwep;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
//set skills
_aiunit setSkill ["aimingAccuracy",1];
_aiunit setSkill ["aimingShake",1];
_aiunit setSkill ["aimingSpeed",1];
_aiunit setSkill ["endurance",1];
_aiunit setSkill ["spotDistance",1];
_aiunit setSkill ["spotTime",1];
_aiunit setSkill ["courage",1];
_aiunit setSkill ["reloadSpeed",1];
_aiunit setSkill ["commanding",1];
_aiunit setSkill ["general",1];
//sleep 0.5;
} ;
//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";
diag_log format ["AIUNIT: Last Waypoint %1 at %2",_wp,_wppos];
I have them at Martin and the racetrack rest of them random
Middle of martin [0,[16485.23,14424.41,0]]
I would add an eventhandler to each, on killed, then check if any of the group still live, if not call another spawn command..is there anyway you can get these guards to respawn after a certain ammount of time? been at this all day, got the NPC's working, just they die then never respawn. any help would be much appreciated.
is there anyway you can get these guards to respawn after a certain ammount of time? been at this all day, got the NPC's working, just they die then never respawn. any help would be much appreciated.
_aiunit enableAI "TARGET";
_aiunit enableAI "AUTOTARGET";
_aiunit enableAI "MOVE";
_aiunit enableAI "ANIM";
_aiunit enableAI "FSM";
_aiunit allowDammage true;
_aiunit setCombatMode "RED";
_aiunit setBehaviour "COMBAT";
//When npc is dead, reappears in this dead place
_aiunit addEventHandler ["Killed",{null=_this+[(getPosATL (_this Select 0)),wpradius,wpnum,1] execVM "units\unit_killed.sqf";}];
private ["_player","_killer","_aispawnpos","_wpradius","_wpnum","_numUnits","_banditKills","_humanity"];
_player = _this select 0;
_killer = _this select 1;
_aispawnpos = _this select 2;
_wpradius = _this select 3;
_wpnum = _this select 4;
_numUnits = _this select 5;
_banditKills = 0;
_humanity = 0;
//AI kill counter & humanity
//I play with npc bandit
_banditKills = _killer getVariable["banditKills",0];
_killer setVariable["banditKills",_banditKills+1,true];
_humanity = _killer getVariable["humanity",0];
_killer setVariable["humanity",_humanity+100,true];
sleep 12;//12 seconds test
aispawnpos = _aispawnpos;
wpradius = _wpradius;
wpnum = _wpnum;
numUnits = _numUnits;
//_player hideObject true;
_aispawn = [aispawnpos,wpradius,wpnum,numUnits] execVM "units\add_unit_server.sqf";
Check your .rpt file for an error.. if nothing make sure all files are where they should be. Zeroday is a separate issue, are you using another ai mod ?I only get Wait for host
Check your .rpt file for an error.. if nothing make sure all files are where they should be. Zeroday is a separate issue, are you using another ai mod ?
It is up to date, as in works on 1.7.6.1, links at the end to useful posts also. Always take backupsIs the tutorial on page one of this post up to date? i think i am following it.... :/ maybe i'll back up my files before i try this..![]()
Have you changed the worldspace entries for tavi ? Locations are different..I just get a loading screen, do i add the code including this if (isServer) then { or just below it? Because i just added it below it and it didnt work