Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies and more


Tutorial "Add AI [Easy way]"


Surama

Recommended Posts

In this Tuto i show u how u may to add the set quantity AI on map (on coordinates to which you will set)

AI - will move according to map, visiting different places (in dependence how many control points you to them will set) their radius of movement will depend as on that as far as you will allow to do them!

AI - Can be aggressive to all without exception! Can be aggressive to bandits and the zombie, to peace survived they are adjusted loyally!

 

U need:

 

1) u'r mission.pbo

2) Notepad++(Notepad)

 

1st step

----------------

 

-Unpack u'r mission.pbo, and in thre root creat folder like "Scripts"

- in folder "Scripts" u need create 2-nd folder likes "faction"

 

In folder "faction" creat three files SQF:

 

1nd - add_unit_server.sqf

2d - set_unit_faction.sqf

3th - zombie_generate.sqf

 

2-nd step

----------------

 

 

- in add_unit_server.sqf past this code:

private["_aiunit","_xpos","_ypos","_unitpos","_aiGroup","_wppos","_wpradius","_wpnum","_numunits","_unitType","_faction","_rndLOut","_ailoadout","_aiwep","_aiammo","_wp","_aispawnpos"];
   _aiunit = objNull;
   _aispawnpos =_this select 0;
   _wpradius = _this select 1;
   _wpnum = _this select 2;
   _numunits = _this select 3;
_unitType = _this select 4;
_faction = _this select 5;
   _xpos = _aispawnpos select 0;
   _ypos = _aispawnpos select 1;

// Faction 0 settings (aka Resistance [locals])
_resistanceRandomSkin = "MVD_Soldier_MG";
_resistanceSniperSkin = "MVD_Soldier_MG";
_resistanceGunnerSkin = "MVD_Soldier_MG";
_resistanceMilitiaSkin = "MVD_Soldier_MG";
_resistanceRandomGear = ["ItemMatchbox","FoodCanBakedBeans","ItemSodaPepsi","GER_Soldier_EP1"];
_resistanceSniperRifle = "AK_107_pso";
_resistanceSniperAmmo = "30Rnd_545x39_AK";
_resistanceSniperGear = ["ItemMatchbox","FoodCanBakedBeans","ItemSodaPepsi","UN_CDF_Soldier_AT_EP1"];
_resistanceGunnerRifle = "SVD_CAMO";
_resistanceGunnerAmmo = "10Rnd_762x54_SVD";
_resistanceGunnerGear = ["ItemMatchbox","FoodCanBakedBeans","ItemSodaPepsi","CZ_Soldier_Light_DES_EP1"];
_resistanceMilitiaRifle = "SVD_CAMO";
_resistanceMilitiaAmmo = "10Rnd_762x54_SVD";
_resistanceMilitiaGear = ["ItemMatchbox","FoodCanBakedBeans","ItemSodaPepsi","Soldier_Sniper_PMC"];

// Faction 1 settings (aka East [Military])
_eastRandomSkin = "MVD_Soldier_MG";
_eastSniperSkin = "MVD_Soldier_MG";
_eastGunnerSkin = "MVD_Soldier_MG";
_eastMilitiaSkin = "MVD_Soldier_MG";
_eastRandomGear = ["ItemGPS","NVGoggles","CZ_Soldier_Light_DES_EP1"];
_eastSniperRifle = "SVD_CAMO";
_eastSniperAmmo = "10Rnd_762x54_SVD";
_eastSniperGear = ["ItemGPS","NVGoggles","Soldier_Sniper_PMC"];
_eastGunnerRifle = "AK_107_pso";
_eastGunnerAmmo = "100Rnd_762x51_M240";
_eastGunnerGear = ["ItemGPS","NVGoggles","CZ_Soldier_Light_DES_EP1"];
_eastMilitiaRifle = "AK_107_pso";
_eastMilitiaAmmo = "30Rnd_556x45_StanagSD";
_eastMilitiaGear = ["ItemGPS","NVGoggles","GER_Soldier_EP1"];

switch (_faction) do {
	case 0 : {_aiGroup = createGroup resistance;			
		for [{ x=1 },{ x < _numunits+1 },{ x = x + 1; }] do {
		_unitpos = [_xpos+x,_ypos+x,0];
			switch (_unitType) do {
				case 0 : {
					_rndLOut=floor(random 3);
					_ailoadout=
					switch (_rndLOut) do {
					  case 0: {[_resistanceSniperRifle,_resistanceSniperAmmo]};
					  case 1: {[_resistanceGunnerRifle,_resistanceGunnerAmmo]};
					  case 2: {[_resistanceMilitiaRifle,_resistanceMilitiaAmmo]};
					};

					_resistanceRandomSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _resistanceRandomGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _resistanceRandomGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];			
				};
				case 1 : {
					_ailoadout=[_resistanceSniperRifle,_resistanceSniperAmmo];

					_resistanceSniperSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _resistanceSniperGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _resistanceSniperGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];					
				};
				case 2 : {
					_ailoadout=[_resistanceGunnerRifle,_resistanceGunnerAmmo];

					_resistanceGunnerSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _resistanceGunnerGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _resistanceGunnerGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];					
				};
				case 3 : {
					_ailoadout=[_resistanceMilitiaRifle,_resistanceMilitiaAmmo];

					_resistanceMilitiaSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _resistanceMilitiaGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _resistanceMilitiaGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];			
				};
				case 4 : {
					for [{y=1},{y<=3},{y=y+1}] do {
						switch (y) do {
							case 1 : {
								_ailoadout=[_resistanceSniperRifle,_resistanceSniperAmmo];

								_resistanceSniperSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

								_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 weapon
								_aiwep = _ailoadout select 0;
								_aiammo = _ailoadout select 1;
								_aiunit addweapon _aiwep;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_gearCount = count _resistanceSniperGear;
								for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
									_currentItem = _resistanceSniperGear select z;
									_aiunit addMagazine _currentItem;
								}; 

								//set skills
								_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
								_aiunit setSkill ["courage",(floor(random 4)+8)/10];
								_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
								_aiunit setSkill ["general",(floor(random 4)+8)/10];				
							};
							case 2 : {
								_ailoadout=[_resistanceGunnerRifle,_resistanceGunnerAmmo];

								_resistanceGunnerSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

								_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 weapon
								_aiwep = _ailoadout select 0;
								_aiammo = _ailoadout select 1;
								_aiunit addweapon _aiwep;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_gearCount = count _resistanceGunnerGear;
								for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
									_currentItem = _resistanceGunnerGear select z;
									_aiunit addMagazine _currentItem;
								}; 

								//set skills
								_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
								_aiunit setSkill ["courage",(floor(random 4)+8)/10];
								_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
								_aiunit setSkill ["general",(floor(random 4)+8)/10];					
							};
							case 3 : {
								_ailoadout=[_resistanceMilitiaRifle,_resistanceMilitiaAmmo];

								_resistanceMilitiaSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

								_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 weapon
								_aiwep = _ailoadout select 0;
								_aiammo = _ailoadout select 1;
								_aiunit addweapon _aiwep;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_gearCount = count _resistanceMilitiaGear;
								for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
									_currentItem = _resistanceMilitiaGear select z;
									_aiunit addMagazine _currentItem;
								}; 

								//set skills
								_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
								_aiunit setSkill ["courage",(floor(random 4)+8)/10];
								_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
								_aiunit setSkill ["general",(floor(random 4)+8)/10];				
							};					
						};
					};
				};
				default {};
			};
		} ;
	};
	case 1 : {_aiGroup = createGroup east;

		for [{ x=1 },{ x < _numunits+1 },{ x = x + 1; }] do {
		_unitpos = [_xpos+x,_ypos+x,0];

			switch (_unitType) do {
				case 0 : {
					_rndLOut=floor(random 3);
					_ailoadout=
					switch (_rndLOut) do {
					  case 0: {[_eastSniperRifle,_eastSniperAmmo]};
					  case 1: {[_eastGunnerRifle,_eastGunnerAmmo]};
					  case 2: {[_eastMilitiaRifle,_eastMilitiaAmmo]};
					};

					_eastRandomSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _eastRandomGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _eastRandomGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];			
				};
				case 1 : {
					_ailoadout=[_eastSniperRifle,_eastSniperAmmo];

					_eastSniperSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _eastSniperGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _eastSniperGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];					
				};
				case 2 : {
					_ailoadout=[_eastGunnerRifle,_eastGunnerAmmo];

					_eastGunnerSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _eastGunnerGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _eastGunnerGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];					
				};
				case 3 : {
					_ailoadout=[_eastMilitiaRifle,_eastMilitiaAmmo];

					_eastMilitiaSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _eastMilitiaGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _eastMilitiaGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];			
				};
				case 4 : {
					for [{y=1},{y<=3},{y=y+1}] do {
						switch (y) do {
							case 1 : {
								_ailoadout=[_eastSniperRifle,_eastSniperAmmo];

								_eastSniperSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

								_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 weapon
								_aiwep = _ailoadout select 0;
								_aiammo = _ailoadout select 1;
								_aiunit addweapon _aiwep;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_gearCount = count _eastSniperGear;
								for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
									_currentItem = _eastSniperGear select z;
									_aiunit addMagazine _currentItem;
								}; 

								//set skills
								_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
								_aiunit setSkill ["courage",(floor(random 4)+8)/10];
								_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
								_aiunit setSkill ["general",(floor(random 4)+8)/10];				
							};
							case 2 : {
								_ailoadout=[_eastGunnerRifle,_eastGunnerAmmo];

								_eastGunnerSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

								_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 weapon
								_aiwep = _ailoadout select 0;
								_aiammo = _ailoadout select 1;
								_aiunit addweapon _aiwep;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_gearCount = count _eastGunnerGear;
								for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
									_currentItem = _eastGunnerGear select z;
									_aiunit addMagazine _currentItem;
								}; 

								//set skills
								_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
								_aiunit setSkill ["courage",(floor(random 4)+8)/10];
								_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
								_aiunit setSkill ["general",(floor(random 4)+8)/10];					
							};
							case 3 : {
								_ailoadout=[_eastMilitiaRifle,_eastMilitiaAmmo];

								_eastMilitiaSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

								_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 weapon
								_aiwep = _ailoadout select 0;
								_aiammo = _ailoadout select 1;
								_aiunit addweapon _aiwep;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_gearCount = count _eastMilitiaGear;
								for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
									_currentItem = _eastMilitiaGear select z;
									_aiunit addMagazine _currentItem;
								}; 

								//set skills
								_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
								_aiunit setSkill ["courage",(floor(random 4)+8)/10];
								_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
								_aiunit setSkill ["general",(floor(random 4)+8)/10];				
							};					
						};
					};
				};
				default {};
			};
		} ;
	};
	default {};
};

   //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";

 

 

- in set_unit_faction.sqf past this code:

 

waitUntil{initialized};
//0Day
createCenter east;
createCenter resistance;
//Survivors
WEST setFriend [RESISTANCE,0];
WEST setFriend [EAST,0];
//Bandits
EAST setFriend [RESISTANCE,0];
EAST setFriend [WEST,0];
//AI Units
RESISTANCE setFriend [WEST,0];
RESISTANCE setFriend [EAST,0];
RESISTANCE setFriend [CIVILIAN,0];//AI Units attack zeds

CIVILIAN setFriend [RESISTANCE,0];//Testing Zeds attack AI units, doesn't seem to help..

 

 

- in zombie_generate.sqf past this code:

 

private["_position","_doLoiter","_unitTypes","_isNoone","_loot","_array","_agent","_type","_radius","_method","_nearByPlayer","_attempt","_myDest","_newDest","_lootType"];
_position = 	_this select 0;
_doLoiter = 	_this select 1;
_unitTypes = 	_this select 2;

if (dayz_maxCurrentZeds > dayz_maxZeds) exitwith {};
if (dayz_CurrentZombies > dayz_maxGlobalZombies) exitwith {}; 
if (dayz_spawnZombies > dayz_maxLocalZombies) exitwith {}; 

_isNoone = 	{isPlayer _x} count (_position nearEntities [["AllVehicles","CAManBase"],30]) == 0;
_loot = 	"";
_array = 	[];
_agent = 	objNull;

//Exit if a player is nearby
if (!_isNoone) exitWith {};

if (count _unitTypes == 0) then {
_unitTypes = 	[]+ getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass");
};
_type = _unitTypes call BIS_fnc_selectRandom;

//Create the Group and populate it
//diag_log ("Spawned: " + _type);
_radius = 0;
_method = "CAN_COLLIDE";
if (_doLoiter) then {
_radius = 40;
_method = "NONE";
};
//diag_log ("Spawned: " + str([_type, _position, [], _radius, _method]));
_agent = createAgent [_type, _position, [], _radius, _method];

if (_doLoiter) then {
_agent setPosATL _position;
//_agent setVariable ["doLoiter",true,true];
} else {
_agent setVariable ["doLoiter",false,true];
};
dayz_spawnZombies = dayz_spawnZombies + 1;

//diag_log ("CREATE INFECTED: " + str(_this));

_position = getPosATL _agent;
_nearByPlayer = ({isPlayer _x} count (_position nearEntities [["AllVehicles","CAManBase"],30]) > 0);

if (random 1 > 0.7) then {
_agent setUnitPos "Middle";
};

//diag_log ("CREATED: "  + str(_agent));
if (_nearByPlayer) then {
deleteVehicle _agent;
};
/*
//_agent setVariable["host",player,true];
if (!_doLoiter) then {
_agent setPosATL _position;
_agent setDir round(random 180);
if (_nearByPlayer) then {
	deleteVehicle _agent;
};
} else {
if (_nearByPlayer) then {
	_attempt = 0;
	while {_nearByPlayer} do {
		_position = [_position,0,20,10,0,20,0] call BIS_fnc_findSafePos;
		_agent setPos _position;
		_nearByPlayer = ({isPlayer _x} count (_position nearEntities ["CAManBase",30]) > 0);
		_attempt = _attempt + 1;
		if (_attempt > 10) exitWith {};
	};
	_agent setPos _position;
};
};
*/
if (isNull _agent) exitWith {
dayz_spawnZombies = dayz_spawnZombies - 1;
};

_isAlive = alive _agent;

_myDest = getPosATL _agent;
_newDest = getPosATL _agent;
_agent setVariable ["myDest",_myDest];
_agent setVariable ["newDest",_newDest];

//Add some loot
_rnd = random 1;
if (_rnd > 0.3) then {
_lootType = 		configFile >> "CfgVehicles" >> _type >> "zombieLoot";
if (isText _lootType) then {
	_array = []+ getArray (configFile >> "cfgLoot" >> getText(_lootType));
	if (count _array > 0) then {
		_loot = _array call BIS_fnc_selectRandomWeighted;
		if(!isNil "_array") then {
			_agent addMagazine _loot;
		};
	};
};
};

//Start behavior
_id = [_position,_agent] execFSM "\z\AddOns\dayz_code\system\zombie_agent.fsm";

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

 

 

3-th step

--------------

 

 

in the root of u'r mision.pbo find INIT.sqf open it and find there:

 

//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 "\z\addons\dayz_code\init\compiles.sqf";				//Compile regular functions
progressLoadingScreen 0.5;
call compile preprocessFileLineNumbers "server_traders.sqf";				//Compile trader configs
call compile preprocessFileLineNumbers "custom\compiles.sqf"; //Compile custom compiles
progressLoadingScreen 1.0;

 

below add:

 

 

zombie_generate = compile preprocessFileLineNumbers "Scripts\faction\zombie_generate.sqf";
if (isServer) then {
    _factions = [] execVM "Scripts\faction\set_unit_faction.sqf";
   _aispawn = [[13517.5,12121.2,0],70,8,4,1,0] execVM "Scripts\faction\add_unit_server.sqf";
   _aispawn = [[13401.2,11851.1,0],70,5,3,1,0] execVM "Scripts\faction\add_unit_server.sqf"; 
   _aispawn = [[13166.8,11982.4,0],50,2,3,1,0] execVM "Scripts\faction\add_unit_server.sqf";

};

 

 

-------------------------------------

interpretation code

 

_aispawn = [[13517.5,12121.2,0],70,8,4,1,0] execVM "Scripts\faction\add_unit_server.sqf";

 

 

- [13517.5,12121.2,0] - this is coordinate then they be spawn on map

- 70 - this they walk radius

- 8 - quantity of control points on which they will be late

- 4 - how much AI be in group

- 1 - attack only Zed's or Bandits ( if u past 0 - they be attack all alive)

---------------------------------------

 

In file add_unit_server.sqf find - // Faction 0 settings and // Faction 1 settings

 

- here you can set Skin of AI their weapon and stock contents!

---------------------------------------

 

 

Done!

Puck u'r mission and upload to server!

Share this post


Link to post
Share on other sites

In this Tuto i show u how u may to add the set quantity AI on map (on coordinates to which you will set)

AI - will move according to map, visiting different places (in dependence how many control points you to them will set) their radius of movement will depend as on that as far as you will allow to do them!

AI - Can be aggressive to all without exception! Can be aggressive to bandits and the zombie, to peace survived they are adjusted loyally!

 

U need:

 

1) u'r mission.pbo

2) Notepad++(Notepad)

 

1st step

----------------

 

-Unpack u'r mission.pbo, and in thre root creat folder like "Scripts"

- in folder "Scripts" u need create 2-nd folder likes "faction"

 

In folder "faction" creat three files SQF:

 

1nd - add_unit_server.sqf

2d - set_unit_faction.sqf

3th - zombie_generate.sqf

 

2-nd step

----------------

 

 

- in add_unit_server.sqf past this code:

private["_aiunit","_xpos","_ypos","_unitpos","_aiGroup","_wppos","_wpradius","_wpnum","_numunits","_unitType","_faction","_rndLOut","_ailoadout","_aiwep","_aiammo","_wp","_aispawnpos"];
   _aiunit = objNull;
   _aispawnpos =_this select 0;
   _wpradius = _this select 1;
   _wpnum = _this select 2;
   _numunits = _this select 3;
_unitType = _this select 4;
_faction = _this select 5;
   _xpos = _aispawnpos select 0;
   _ypos = _aispawnpos select 1;

// Faction 0 settings (aka Resistance [locals])
_resistanceRandomSkin = "MVD_Soldier_MG";
_resistanceSniperSkin = "MVD_Soldier_MG";
_resistanceGunnerSkin = "MVD_Soldier_MG";
_resistanceMilitiaSkin = "MVD_Soldier_MG";
_resistanceRandomGear = ["ItemMatchbox","FoodCanBakedBeans","ItemSodaPepsi","GER_Soldier_EP1"];
_resistanceSniperRifle = "AK_107_pso";
_resistanceSniperAmmo = "30Rnd_545x39_AK";
_resistanceSniperGear = ["ItemMatchbox","FoodCanBakedBeans","ItemSodaPepsi","UN_CDF_Soldier_AT_EP1"];
_resistanceGunnerRifle = "SVD_CAMO";
_resistanceGunnerAmmo = "10Rnd_762x54_SVD";
_resistanceGunnerGear = ["ItemMatchbox","FoodCanBakedBeans","ItemSodaPepsi","CZ_Soldier_Light_DES_EP1"];
_resistanceMilitiaRifle = "SVD_CAMO";
_resistanceMilitiaAmmo = "10Rnd_762x54_SVD";
_resistanceMilitiaGear = ["ItemMatchbox","FoodCanBakedBeans","ItemSodaPepsi","Soldier_Sniper_PMC"];

// Faction 1 settings (aka East [Military])
_eastRandomSkin = "MVD_Soldier_MG";
_eastSniperSkin = "MVD_Soldier_MG";
_eastGunnerSkin = "MVD_Soldier_MG";
_eastMilitiaSkin = "MVD_Soldier_MG";
_eastRandomGear = ["ItemGPS","NVGoggles","CZ_Soldier_Light_DES_EP1"];
_eastSniperRifle = "SVD_CAMO";
_eastSniperAmmo = "10Rnd_762x54_SVD";
_eastSniperGear = ["ItemGPS","NVGoggles","Soldier_Sniper_PMC"];
_eastGunnerRifle = "AK_107_pso";
_eastGunnerAmmo = "100Rnd_762x51_M240";
_eastGunnerGear = ["ItemGPS","NVGoggles","CZ_Soldier_Light_DES_EP1"];
_eastMilitiaRifle = "AK_107_pso";
_eastMilitiaAmmo = "30Rnd_556x45_StanagSD";
_eastMilitiaGear = ["ItemGPS","NVGoggles","GER_Soldier_EP1"];

switch (_faction) do {
	case 0 : {_aiGroup = createGroup resistance;			
		for [{ x=1 },{ x < _numunits+1 },{ x = x + 1; }] do {
		_unitpos = [_xpos+x,_ypos+x,0];
			switch (_unitType) do {
				case 0 : {
					_rndLOut=floor(random 3);
					_ailoadout=
					switch (_rndLOut) do {
					  case 0: {[_resistanceSniperRifle,_resistanceSniperAmmo]};
					  case 1: {[_resistanceGunnerRifle,_resistanceGunnerAmmo]};
					  case 2: {[_resistanceMilitiaRifle,_resistanceMilitiaAmmo]};
					};

					_resistanceRandomSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _resistanceRandomGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _resistanceRandomGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];			
				};
				case 1 : {
					_ailoadout=[_resistanceSniperRifle,_resistanceSniperAmmo];

					_resistanceSniperSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _resistanceSniperGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _resistanceSniperGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];					
				};
				case 2 : {
					_ailoadout=[_resistanceGunnerRifle,_resistanceGunnerAmmo];

					_resistanceGunnerSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _resistanceGunnerGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _resistanceGunnerGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];					
				};
				case 3 : {
					_ailoadout=[_resistanceMilitiaRifle,_resistanceMilitiaAmmo];

					_resistanceMilitiaSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _resistanceMilitiaGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _resistanceMilitiaGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];			
				};
				case 4 : {
					for [{y=1},{y<=3},{y=y+1}] do {
						switch (y) do {
							case 1 : {
								_ailoadout=[_resistanceSniperRifle,_resistanceSniperAmmo];

								_resistanceSniperSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

								_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 weapon
								_aiwep = _ailoadout select 0;
								_aiammo = _ailoadout select 1;
								_aiunit addweapon _aiwep;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_gearCount = count _resistanceSniperGear;
								for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
									_currentItem = _resistanceSniperGear select z;
									_aiunit addMagazine _currentItem;
								}; 

								//set skills
								_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
								_aiunit setSkill ["courage",(floor(random 4)+8)/10];
								_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
								_aiunit setSkill ["general",(floor(random 4)+8)/10];				
							};
							case 2 : {
								_ailoadout=[_resistanceGunnerRifle,_resistanceGunnerAmmo];

								_resistanceGunnerSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

								_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 weapon
								_aiwep = _ailoadout select 0;
								_aiammo = _ailoadout select 1;
								_aiunit addweapon _aiwep;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_gearCount = count _resistanceGunnerGear;
								for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
									_currentItem = _resistanceGunnerGear select z;
									_aiunit addMagazine _currentItem;
								}; 

								//set skills
								_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
								_aiunit setSkill ["courage",(floor(random 4)+8)/10];
								_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
								_aiunit setSkill ["general",(floor(random 4)+8)/10];					
							};
							case 3 : {
								_ailoadout=[_resistanceMilitiaRifle,_resistanceMilitiaAmmo];

								_resistanceMilitiaSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

								_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 weapon
								_aiwep = _ailoadout select 0;
								_aiammo = _ailoadout select 1;
								_aiunit addweapon _aiwep;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_gearCount = count _resistanceMilitiaGear;
								for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
									_currentItem = _resistanceMilitiaGear select z;
									_aiunit addMagazine _currentItem;
								}; 

								//set skills
								_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
								_aiunit setSkill ["courage",(floor(random 4)+8)/10];
								_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
								_aiunit setSkill ["general",(floor(random 4)+8)/10];				
							};					
						};
					};
				};
				default {};
			};
		} ;
	};
	case 1 : {_aiGroup = createGroup east;

		for [{ x=1 },{ x < _numunits+1 },{ x = x + 1; }] do {
		_unitpos = [_xpos+x,_ypos+x,0];

			switch (_unitType) do {
				case 0 : {
					_rndLOut=floor(random 3);
					_ailoadout=
					switch (_rndLOut) do {
					  case 0: {[_eastSniperRifle,_eastSniperAmmo]};
					  case 1: {[_eastGunnerRifle,_eastGunnerAmmo]};
					  case 2: {[_eastMilitiaRifle,_eastMilitiaAmmo]};
					};

					_eastRandomSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _eastRandomGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _eastRandomGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];			
				};
				case 1 : {
					_ailoadout=[_eastSniperRifle,_eastSniperAmmo];

					_eastSniperSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _eastSniperGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _eastSniperGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];					
				};
				case 2 : {
					_ailoadout=[_eastGunnerRifle,_eastGunnerAmmo];

					_eastGunnerSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _eastGunnerGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _eastGunnerGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];					
				};
				case 3 : {
					_ailoadout=[_eastMilitiaRifle,_eastMilitiaAmmo];

					_eastMilitiaSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

					_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 weapon
					_aiwep = _ailoadout select 0;
					_aiammo = _ailoadout select 1;
					_aiunit addweapon _aiwep;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_aiunit addMagazine _aiammo;
					_gearCount = count _eastMilitiaGear;
					for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
						_currentItem = _eastMilitiaGear select z;
						_aiunit addMagazine _currentItem;
					}; 

					//set skills
					_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
					_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
					_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
					_aiunit setSkill ["courage",(floor(random 4)+8)/10];
					_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
					_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
					_aiunit setSkill ["general",(floor(random 4)+8)/10];			
				};
				case 4 : {
					for [{y=1},{y<=3},{y=y+1}] do {
						switch (y) do {
							case 1 : {
								_ailoadout=[_eastSniperRifle,_eastSniperAmmo];

								_eastSniperSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

								_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 weapon
								_aiwep = _ailoadout select 0;
								_aiammo = _ailoadout select 1;
								_aiunit addweapon _aiwep;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_gearCount = count _eastSniperGear;
								for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
									_currentItem = _eastSniperGear select z;
									_aiunit addMagazine _currentItem;
								}; 

								//set skills
								_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
								_aiunit setSkill ["courage",(floor(random 4)+8)/10];
								_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
								_aiunit setSkill ["general",(floor(random 4)+8)/10];				
							};
							case 2 : {
								_ailoadout=[_eastGunnerRifle,_eastGunnerAmmo];

								_eastGunnerSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

								_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 weapon
								_aiwep = _ailoadout select 0;
								_aiammo = _ailoadout select 1;
								_aiunit addweapon _aiwep;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_gearCount = count _eastGunnerGear;
								for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
									_currentItem = _eastGunnerGear select z;
									_aiunit addMagazine _currentItem;
								}; 

								//set skills
								_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
								_aiunit setSkill ["courage",(floor(random 4)+8)/10];
								_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
								_aiunit setSkill ["general",(floor(random 4)+8)/10];					
							};
							case 3 : {
								_ailoadout=[_eastMilitiaRifle,_eastMilitiaAmmo];

								_eastMilitiaSkin createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];

								_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 weapon
								_aiwep = _ailoadout select 0;
								_aiammo = _ailoadout select 1;
								_aiunit addweapon _aiwep;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_aiunit addMagazine _aiammo;
								_gearCount = count _eastMilitiaGear;
								for [{z = 0},{z >= _gearCount},{z = z + 1}] do {
									_currentItem = _eastMilitiaGear select z;
									_aiunit addMagazine _currentItem;
								}; 

								//set skills
								_aiunit setSkill ["aimingAccuracy",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingShake",(floor(random 4)+8)/10];
								_aiunit setSkill ["aimingSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["endurance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotDistance",(floor(random 4)+8)/10];
								_aiunit setSkill ["spotTime",(floor(random 4)+8)/10];
								_aiunit setSkill ["courage",(floor(random 4)+8)/10];
								_aiunit setSkill ["reloadSpeed",(floor(random 4)+8)/10];
								_aiunit setSkill ["commanding",(floor(random 4)+8)/10];
								_aiunit setSkill ["general",(floor(random 4)+8)/10];				
							};					
						};
					};
				};
				default {};
			};
		} ;
	};
	default {};
};

   //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";

 

 

- in set_unit_faction.sqf past this code:

 

waitUntil{initialized};
//0Day
createCenter east;
createCenter resistance;
//Survivors
WEST setFriend [RESISTANCE,0];
WEST setFriend [EAST,0];
//Bandits
EAST setFriend [RESISTANCE,0];
EAST setFriend [WEST,0];
//AI Units
RESISTANCE setFriend [WEST,0];
RESISTANCE setFriend [EAST,0];
RESISTANCE setFriend [CIVILIAN,0];//AI Units attack zeds

CIVILIAN setFriend [RESISTANCE,0];//Testing Zeds attack AI units, doesn't seem to help..

 

 

- in zombie_generate.sqf past this code:

 

private["_position","_doLoiter","_unitTypes","_isNoone","_loot","_array","_agent","_type","_radius","_method","_nearByPlayer","_attempt","_myDest","_newDest","_lootType"];
_position = 	_this select 0;
_doLoiter = 	_this select 1;
_unitTypes = 	_this select 2;

if (dayz_maxCurrentZeds > dayz_maxZeds) exitwith {};
if (dayz_CurrentZombies > dayz_maxGlobalZombies) exitwith {}; 
if (dayz_spawnZombies > dayz_maxLocalZombies) exitwith {}; 

_isNoone = 	{isPlayer _x} count (_position nearEntities [["AllVehicles","CAManBase"],30]) == 0;
_loot = 	"";
_array = 	[];
_agent = 	objNull;

//Exit if a player is nearby
if (!_isNoone) exitWith {};

if (count _unitTypes == 0) then {
_unitTypes = 	[]+ getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass");
};
_type = _unitTypes call BIS_fnc_selectRandom;

//Create the Group and populate it
//diag_log ("Spawned: " + _type);
_radius = 0;
_method = "CAN_COLLIDE";
if (_doLoiter) then {
_radius = 40;
_method = "NONE";
};
//diag_log ("Spawned: " + str([_type, _position, [], _radius, _method]));
_agent = createAgent [_type, _position, [], _radius, _method];

if (_doLoiter) then {
_agent setPosATL _position;
//_agent setVariable ["doLoiter",true,true];
} else {
_agent setVariable ["doLoiter",false,true];
};
dayz_spawnZombies = dayz_spawnZombies + 1;

//diag_log ("CREATE INFECTED: " + str(_this));

_position = getPosATL _agent;
_nearByPlayer = ({isPlayer _x} count (_position nearEntities [["AllVehicles","CAManBase"],30]) > 0);

if (random 1 > 0.7) then {
_agent setUnitPos "Middle";
};

//diag_log ("CREATED: "  + str(_agent));
if (_nearByPlayer) then {
deleteVehicle _agent;
};
/*
//_agent setVariable["host",player,true];
if (!_doLoiter) then {
_agent setPosATL _position;
_agent setDir round(random 180);
if (_nearByPlayer) then {
	deleteVehicle _agent;
};
} else {
if (_nearByPlayer) then {
	_attempt = 0;
	while {_nearByPlayer} do {
		_position = [_position,0,20,10,0,20,0] call BIS_fnc_findSafePos;
		_agent setPos _position;
		_nearByPlayer = ({isPlayer _x} count (_position nearEntities ["CAManBase",30]) > 0);
		_attempt = _attempt + 1;
		if (_attempt > 10) exitWith {};
	};
	_agent setPos _position;
};
};
*/
if (isNull _agent) exitWith {
dayz_spawnZombies = dayz_spawnZombies - 1;
};

_isAlive = alive _agent;

_myDest = getPosATL _agent;
_newDest = getPosATL _agent;
_agent setVariable ["myDest",_myDest];
_agent setVariable ["newDest",_newDest];

//Add some loot
_rnd = random 1;
if (_rnd > 0.3) then {
_lootType = 		configFile >> "CfgVehicles" >> _type >> "zombieLoot";
if (isText _lootType) then {
	_array = []+ getArray (configFile >> "cfgLoot" >> getText(_lootType));
	if (count _array > 0) then {
		_loot = _array call BIS_fnc_selectRandomWeighted;
		if(!isNil "_array") then {
			_agent addMagazine _loot;
		};
	};
};
};

//Start behavior
_id = [_position,_agent] execFSM "\z\AddOns\dayz_code\system\zombie_agent.fsm";

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

 

 

3-th step

--------------

 

 

in the root of u'r mision.pbo find INIT.sqf open it and find there:

 

//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 "\z\addons\dayz_code\init\compiles.sqf";				//Compile regular functions
progressLoadingScreen 0.5;
call compile preprocessFileLineNumbers "server_traders.sqf";				//Compile trader configs
call compile preprocessFileLineNumbers "custom\compiles.sqf"; //Compile custom compiles
progressLoadingScreen 1.0;

 

below add:

 

 

zombie_generate = compile preprocessFileLineNumbers "Scripts\faction\zombie_generate.sqf";
if (isServer) then {
    _factions = [] execVM "Scripts\faction\set_unit_faction.sqf";
   _aispawn = [[13517.5,12121.2,0],70,8,4,1,0] execVM "Scripts\faction\add_unit_server.sqf";
   _aispawn = [[13401.2,11851.1,0],70,5,3,1,0] execVM "Scripts\faction\add_unit_server.sqf"; 
   _aispawn = [[13166.8,11982.4,0],50,2,3,1,0] execVM "Scripts\faction\add_unit_server.sqf";

};

 

 

-------------------------------------

interpretation code

 

_aispawn = [[13517.5,12121.2,0],70,8,4,1,0] execVM "Scripts\faction\add_unit_server.sqf";

 

 

- [13517.5,12121.2,0] - this is coordinate then they be spawn on map

- 70 - this they walk radius

- 8 - quantity of control points on which they will be late

- 4 - how much AI be in group

- 1 - attack only Zed's or Bandits ( if u past 0 - they be attack all alive)

---------------------------------------

 

In file add_unit_server.sqf find - // Faction 0 settings and // Faction 1 settings

 

- here you can set Skin of AI their weapon and stock contents!

---------------------------------------

 

 

Done!

Puck u'r mission and upload to server!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...