Jump to content
  • 0
Sign in to follow this  

Adding AI Vehicles to Epoch Events?


Hey all,


Any way to add AI with vehicles to Epoch events?


I'm going to have a play with it myself too, just wondered if anyone had done it already to save me some time!


Here is the code I am looking at adding vehicles to


//Created by axeman Edited by TheSzerdi
private ["_aiunit","_xpos","_ypos","_unitpos","_aiGroup","_wppos","_wpradius","_wpnum","_levelnum","_numunits","_rndLOut","_ailoadout","_wp","_aispawnpos","_aiwep1","_aiammo1","_aiwep2","_aiammo2"];
    _aiunit = objNull;
    _aiGroup = createGroup resistance;
    _aispawnpos =_this select 0;
    _wpradius = _this select 1;
    _wpnum = _this select 2;
    _numunits = _this select 3;
    _levelnum = _this select 4;
    _xpos = _aispawnpos select 0;
    _ypos = _aispawnpos select 1;
    diag_log format ["AIUNIT: Spawn initiated: Centre:%1 | Radius in m:%2 | Waypoint number:%3 | WeaponLevel:%4",_aispawnpos,_wpradius,_wpnum,_levelnum];
    for [{ x=1 },{ x < _numunits+1 },{ x = x + 1; }] do
        _unitpos = [_xpos+x,_ypos+x,0];
        if (_levelnum==0) then // in_sityes troops
            if ((x == 1) || (x == 3) || (x == 5)) then //troop soldiers
                "Bandit1_DZ" createUnit [_unitpos, _aiGroup, "_aiunit=this;",1,"PRIVATE"];
                _rndLOut=floor(random 4);
                switch (_rndLOut) do
                  case 0: {["DMR","20Rnd_762x51_DMR","revolver_EP1","6Rnd_45ACP"]};
                  case 1: {["M4A3_CCO_EP1","30Rnd_556x45_Stanag","revolver_EP1","6Rnd_45ACP"]};
                  case 2: {["M249_DZ","200Rnd_556x45_M249","Colt1911","7Rnd_45ACP_1911"]};
                  case 3: {["AKS_GOLD","30Rnd_545x39_AK","Colt1911","7Rnd_45ACP_1911"]};
            if ((x == 2) || (x == 4) || (x >= 6)) then //troops snipers
                "Bandit1_DZ" createUnit [_unitpos, _aiGroup, "_aiunit=this;",1,"PRIVATE"];
                _rndLOut=floor(random 3);
                switch (_rndLOut) do
                  case 0: {["DMR","20Rnd_762x51_DMR","Makarov","8Rnd_9x18_Makarov"]};
                  case 1: {["SVD_CAMO","10Rnd_762x54_SVD","Makarov","8Rnd_9x18_Makarov"]};
                  case 2: {["M14_EP1","20Rnd_762x51_DMR","Makarov","8Rnd_9x18_Makarov"]};
        if (_levelnum==1) then //in_military troops
            if (x == 1) then //one troops comander
                "Bandit1_DZ" createUnit [_unitpos, _aiGroup, "_aiunit=this;",1,"LIEUTENANT"];
                _rndLOut=floor(random 7);
                switch (_rndLOut) do
                  case 0: {["M249_DZ","200Rnd_556x45_M249","MakarovSD","8Rnd_9x18_Makarov"]};
                  case 1: {["M4A1_RCO_GL","30Rnd_762x39_AK47","M9SD","15Rnd_9x19_M9SD"]};
                  case 2: {["Sa58P_EP1","30Rnd_762x39_SA58","MakarovSD","8Rnd_9x18_Makarov"]};
                  case 3: {["Sa58V_CCO_EP1","30Rnd_762x39_SA58","M9SD","15Rnd_9x19_M9SD"]};
                  case 4: {["Sa58V_EP1","30Rnd_762x39_SA58","MakarovSD","8Rnd_9x18_Makarov"]};
                  case 5: {["M4SPR","30Rnd_556x45_Stanag","M9SD","15Rnd_9x19_M9SD"]};
                  case 6: {["M4A1_HWS_GL_SD_Camo","30Rnd_556x45_StanagSD","MakarovSD","8Rnd_9x18_Makarov"]};
            if ((x == 2) || (x == 3)) then //troops sergeant
                "Bandit1_DZ" createUnit [_unitpos, _aiGroup, "_aiunit=this;",1,"SERGEANT"];
                _rndLOut=floor(random 4);
                switch (_rndLOut) do
                  case 0: {["BAF_L85A2_RIS_SUSAT","30Rnd_556x45_Stanag","glock17_EP1","17Rnd_9x19_glock17"]};
                  case 1: {["RPK_74","75Rnd_545x39_RPK","M9","15Rnd_9x19_M9"]};
                  case 2: {["G36A_camo","30Rnd_556x45_G36","MakarovSD","8Rnd_9x18_Makarov"]};
                  case 3: {["M4A1_HWS_GL_SD_Camo","30Rnd_556x45_StanagSD","MakarovSD","8Rnd_9x18_Makarov"]};
            if (x > 3) then //troops soldiers
                "BAF_Soldier_Sniper_MTP" createUnit [_unitpos, _aiGroup, "_aiunit=this;",1,"CORPORAL"];
                _rndLOut=floor(random 5);
                switch (_rndLOut) do
                  case 0: {["SVD_CAMO","10Rnd_762x54_SVD","MakarovSD","8Rnd_9x18_Makarov"]};
                  case 1: {["M24","5Rnd_762x51_M24","MakarovSD","8Rnd_9x18_Makarov"]};
                  case 2: {["M24_des_EP1","5Rnd_762x51_M24","MakarovSD","8Rnd_9x18_Makarov"]};
                  case 3: {["SVD","10Rnd_762x54_SVD","MakarovSD","8Rnd_9x18_Makarov"]};
     case 4: {["AK_107_pso","30Rnd_545x39_AK","M9","15Rnd_9x19_M9"]};
        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 addEventHandler ['killed',{_this execVM "\z\addons\dayz_server\Missions\bodyclean.sqf"}]; //Body disappear time
        _aiunit setCombatMode "RED";
        _aiunit setBehaviour "COMBAT";
        //clear default weapons / ammo
        removeAllWeapons _aiunit;
        //add random selection
        _aiwep1 = _ailoadout select 0;
        _aiammo1 = _ailoadout select 1;
        _aiwep2 = _ailoadout select 2;
        _aiammo2 = _ailoadout select 3;
        _aiunit addweapon _aiwep1;
        _aiunit addMagazine _aiammo1;
        _aiunit addMagazine _aiammo1;
        _aiunit addMagazine _aiammo1;
        _aiunit addweapon _aiwep2;
        _aiunit addMagazine _aiammo2;
        _aiunit addMagazine _aiammo2;
_aiunit removeWeapon "ItemRadio";
      //add some garbage
        if (x == 1) then {
        _aiunit addMagazine "SmokeShellGreen";
        _aiunit addMagazine "HandGrenade_West";
        _aiunit addMagazine "FoodCanBakedBeans";
        _aiunit addMagazine "ItemSodaCoke";
        _aiunit addMagazine "ItemPainkiller";
        _aiunit addMagazine "ItemHeatPack";
        _aiunit addMagazine "ItemEpinephrine";
        _aiunit addMagazine "ItemMorphine";
        if (x == 2) then {
        _aiunit addMagazine "ItemHeatPack";
        _aiunit addMagazine "ItemPainkiller";
        _aiunit addMagazine "ItemEpinephrine";
        _aiunit addMagazine "ItemMorphine";
        if (x >= 3) then {
        _aiunit addMagazine "ItemHeatPack";
        _aiunit addMagazine "ItemBandage";
        //set skills
        _aiunit setSkill ["aimingAccuracy",0.8];
        _aiunit setSkill ["aimingShake",0.7];
        _aiunit setSkill ["aimingSpeed",0.8];
        _aiunit setSkill ["endurance",0.9];
        _aiunit setSkill ["spotDistance",0.8];
        _aiunit setSkill ["spotTime",0.7];
        _aiunit setSkill ["courage",0.9];
        _aiunit setSkill ["reloadSpeed",0.8];
        _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];


Cheers :D

Share this post

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

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

Answer this question...

×   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.

Sign in to follow this  

  • Similar Content

    • By Harkness
      DayZ Expansion Namalsk Mods/Features;
      ATM Banking
      More Weapons
      More Cars
      More Loot
      Namalsk Igloo
      Light Saber Mod
      Trader Wallet - Money/Item Storage
      Custom Namalsk Spawn Selection
      Custom Trader City at Sebjan Factory
      All items added to traders
      Namalsk Airdrops
      Notification System
      Territories System
      Auto-run System
      No Stamina System
      Safezone System
      Mission System
      Skin System
      Map UI and 2D/3D Markers System
      KillFeed System
      Towing System
      Player Attachement
      Custom lighting
      Custom interiors
      Custom ocean
      Working Street lights
      No stamina
      Street lights
      Car Keys
      Map UI and 2D/3D Markers
      Global/Transport/Party Chat
      Book (Server Info, Rules, player stats, party management , territory management) System
      Address: Port: 2402
      Discord Invite Link
    • By Ghostrider-GRG
      Originally concieved by Blckeagls and supported here with permission
      Completely rewritten  to remove bugs and add functionallity.
      Current Version: Version 7.06
      Current Build: 239
      Built-in support for Epoch or Exile.
      Updated: Built in Headless client support.
      New: includes tools to export missions from A3EDEN Editor - minimal editing/scripting required to generate new missions once the design is completed in the editr.
      A complete static and dynamic mission system rolled into one.
      Many new Missions (Thanks to Thomas_TKO)
      CHANGES:   https://github.com/Ghostrider-DbD-/blckeagles-revisited-RC/blob/master/changeLog.sqf To download go to: https://github.com/Ghostrider-DbD-/blckeagles-revisited-RC
      For installation see: https://github.com/Ghostrider-DbD-/blckeagles-revisited-RC/blob/master/INSTALLATION.txt
      For a complete changelog see: https://github.com/Ghostrider-DbD-/blckeagles-revisited-RC/blob/master/changeLog.sqf
          Epoch Mod developer team, and in particular AWOL whose code has provided many lessons in scripting.
        blckeagls - Original developer of mission system 2.0.2   Narines - bug fixes and improvements.   Bill (DBD Clan) example compositions.   cyncrwler for help with troubleshooting and testing   Brian Soanes for helpful changes and performance tweaks.   Grahame for many rounds of testing, feedback and suggestions regarding features.   zxbutchxz for extensive testing of AI behavior. MGTDB for the fix for an issue with interacting with captives/targets on Exile servers. Porkeld for the CBA compatability fixes and debugging. Thomas_TKO for debugging and many new missions. * Additional Credits include authors of other missions systems and scripts who's work influenced this release:
         Halve and He-Man.     Face (A3EAI)     KiloSwiss (SEM)     Hogscrapper (HC missions for A3)     the Vampire (DZMS and VEMF)     The FUCHS (EMS)     lazylink (early A2 Epoch mission system)     Matt11 (Wicked AI) Updates: License
      This Mission System is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.

    • By Pickle Rick
      ip -
      NEW SERVER UP AND RUNNING.. FULL OF AI, PVP HELL...  Stop in and ask Pickle Rick or OTROD for a free tank

    • By 2DayZ2Retirement
      G'day, Survivors.
      I am having an issue on my server where vehicles which spawn randomly around the map repair themselves upon server restart.
      I use this config in my init.sqf which successfully spawns the vehicles in damaged and with low fuel...
      DynamicVehicleDamageLow = 75;
      DynamicVehicleDamageHigh = 100;
      DynamicVehicleFuelLow = 0;
      DynamicVehicleFuelHigh = 25;
      ...However upon each server restart the vehicles repair themselves (the fuel remains low however) and for the life of me I can't figure out why this is happening. 
      DayZ Version -DayZ Epoch
      Scripts Used -DZAI | -DZMS | -Right Click Actions (Suicide, Smoke Drugs, GPS Scan)
      AntiHack - InfiSTAR
      Server Host - GTXGaming
      My HiveEXT.log and arma2oaserver.RPT logs are not showing anything out of the ordinary.
      I'm not sure if it matter, but all Planes/Helicopters and Boats have been removed from the server via the dynamic_vehicle.sqf.
      In addition, all of the traders and trader cities being removed by removing the call for the CfgServerTrader.hpp in the description.ext.
      If there is any other info I can show to assist in fixing this problem please let me know, any help would be greatly appreciated.
    • By FG_Trap
      Made a quick static ai mission that spawns on restart. 
      12 ai patrol the compound 
      4 Static m2's
      1 Heli Patrolling the compound 
      Crate for who ever clears all the ai.
      Some screenshots of the compound 

  • Advertisement
  • Supporters
  • Discord

  • Create New...