Simple AI Tutorial (no rMod or DayZ_Factions)

If you link me your current add_unit_server.sqf I will edit it for you.

if possible, i'd like the option of choosing either :
friendly - well armed
friendly - low armed
bandit - well armed
bandit - low armed

if its only possible to add another one instead of two, that's fine :)

EDIT-
Just realised that sqf file is the one i tested out doing the other faction on :/ hope thats still ok to look thru
 

Attachments

  • add_unit_server.sqf
    39.5 KB · Views: 13
if possible, i'd like the option of choosing either :
friendly - well armed
friendly - low armed
bandit - well armed
bandit - low armed

if its only possible to add another one instead of two, that's fine :)

EDIT-
Just realised that sqf file is the one i tested out doing the other faction on :/ hope thats still ok to look thru
I was thinking of adding that as well.. it's really just a matter of adding another parameter and creating additional variables.. i can't do to much editing now though because I don't have a server to test it on.

I included your modified file. Now at the end of your _aispawns in your init, after the faction variable, add a 0 or 1 for gear set.. you can do as many as you want.
 

Attachments

  • add_unit_server.sqf
    41.7 KB · Views: 28
I was thinking of adding that as well.. it's really just a matter of adding another parameter and creating additional variables.. i can't do to much editing now though because I don't have a server to test it on.

well these are the two files i have, i just dont know if the faction names are right. can i use stuff like opfor/blufor/enemy or will it not allow them to be used?
 

Attachments

  • add_unit_server.sqf
    39.5 KB · Views: 7
  • set_unit_faction.sqf
    555 bytes · Views: 11
well these are the two files i have, i just dont know if the faction names are right. can i use stuff like opfor/blufor/enemy or will it not allow them to be used?
You can only user east/west/resistance in terms of what you want, and west is what you are, so be careful what you do with the factions for west. See my above post for the changes to your file in regards to sets of gear.
 
You can only user east/west/resistance in terms of what you want, and west is what you are, so be careful what you do with the factions for west. See my above post for the changes to your file in regards to sets of gear.

ah sweet. so basically i can now choose between friendly/bandit and as many gearsets as i want? just make sure the case refers to the number in the last variable?

EDIT-
Can I also include the ai skill in those? i was hoping that with high level loadouts i could have higher skill levels, and with basic loadouts for new spawn type AI they would have worse accuracy and more shake to simulate fresh spawn players
 
If you link me your current add_unit_server.sqf I will edit it for you.
Uploaded my add_unit_server.sqf :) I'm still not following where i need to edit and what files.
Thank you for taking the time to help.
 

Attachments

  • add_unit_server.sqf
    25.8 KB · Views: 6
ugh, just cant get that add_unit.sqf to work. its something to do with the switch (_gearset) part. if i remove it again, the AI spawns, if i add the skin and loadouts in the switch/case it doesn't spawn.

this is my init.sqf line :
Code:
 _aispawn = [[3750.1064, 1030.8136, -10.711449],15,5,3,0,0,0] execVM "scripts\add_unit_server.sqf";
and this is the add_unit.sqf snippet. the rest of it is the same as before. i added "_gearset" to the top private line too, as it was missing from there, assuming it needed to be declared there too?

Code:
private["_aiunit","_xpos","_ypos","_unitpos","_aiGroup","_wppos","_wpradius","_wpnum","_numunits","_unitType","_faction","_gearset","_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;
    _gearset = _this select 6;
    _xpos = _aispawnpos select 0;
    _ypos = _aispawnpos select 1;
 
 
 
    switch (_gearset) do {
        case 0 : {
         
                    // Faction 0 settings (aka Resistance [locals])
                    _resistanceRandomSkin = "Survivor2_DZ";
                    _resistanceSniperSkin = "Survivor1_DZ";
                    _resistanceGunnerSkin = "Camo_1_DZ";
                    _resistanceMilitiaSkin = "Survivor3_DZ";
                    _resistanceRandomGear = ["ItemBandage","ItemBandage","ItemPainkiller","HandRoadFlare","ItemSodaPepsi","ItemSodaPepsi","FoodCanBakedBeans"];
                    _resistanceSniperRifle = "M14_EP1";
                    _resistanceSniperAmmo = "20Rnd_762x51_DMR";
                    _resistanceSniperGear = [["ItemKnife"],["ItemBloodbag"]];
                    _resistanceGunnerRifle = "AK_47_M";
                    _resistanceGunnerAmmo = "30Rnd_762x39_AK47";
                    _resistanceGunnerGear = [["ItemHatchet"],["ItemBloodbag"]];
                    _resistanceMilitiaRifle = "MP5A5";
                    _resistanceMilitiaAmmo = "30Rnd_9x19_MP5";
                    _resistanceMilitiaGear = [["ItemMatchbox"],["ItemBloodbag"]];
             
                    // Faction 1 settings (aka East [Military])
                    _eastRandomSkin = "Bandit1_DZ";
                    _eastSniperSkin = "Bandit1_DZ";
                    _eastGunnerSkin = "Bandit1_DZ";
                    _eastMilitiaSkin = "Bandit1_DZ";
                    _eastRandomGear = ["HandGrenade_west","HandGrenade_west","NVGoggles"];
                    _eastSniperRifle = "SVD_CAMO";
                    _eastSniperAmmo = "10Rnd_762x54_SVD";
                    _eastSniperGear = ["ItemGPS","NVGoggles","Binocular_Vector"];
                    _eastGunnerRifle = "MP5SD";
                    _eastGunnerAmmo = "30Rnd_9x19_MP5SD";
                    _eastGunnerGear = ["ItemGPS","NVGoggles"];
                    _eastMilitiaRifle = "M4A1_AIM_SD_camo";
                    _eastMilitiaAmmo = "30Rnd_556x45_StanagSD";
                    _eastMilitiaGear = ["ItemGPS","NVGoggles"];
        };
    default {};
    };

i even tried adding another switch/case inside the gearset one, based on faction, so if gearset 0 and faction 0, add resistance stuff, if gearset 0 and faction 1 add west stuff. still the same result
 
ugh, just cant get that add_unit.sqf to work. its something to do with the switch (_gearset) part. if i remove it again, the AI spawns, if i add the skin and loadouts in the switch/case it doesn't spawn.

this is my init.sqf line :
Code:
 _aispawn = [[3750.1064, 1030.8136, -10.711449],15,5,3,0,0,0] execVM "scripts\add_unit_server.sqf";
and this is the add_unit.sqf snippet. the rest of it is the same as before. i added "_gearset" to the top private line too, as it was missing from there, assuming it needed to be declared there too?

Code:
private["_aiunit","_xpos","_ypos","_unitpos","_aiGroup","_wppos","_wpradius","_wpnum","_numunits","_unitType","_faction","_gearset","_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;
    _gearset = _this select 6;
    _xpos = _aispawnpos select 0;
    _ypos = _aispawnpos select 1;
 
 
 
    switch (_gearset) do {
        case 0 : {
       
                    // Faction 0 settings (aka Resistance [locals])
                    _resistanceRandomSkin = "Survivor2_DZ";
                    _resistanceSniperSkin = "Survivor1_DZ";
                    _resistanceGunnerSkin = "Camo_1_DZ";
                    _resistanceMilitiaSkin = "Survivor3_DZ";
                    _resistanceRandomGear = ["ItemBandage","ItemBandage","ItemPainkiller","HandRoadFlare","ItemSodaPepsi","ItemSodaPepsi","FoodCanBakedBeans"];
                    _resistanceSniperRifle = "M14_EP1";
                    _resistanceSniperAmmo = "20Rnd_762x51_DMR";
                    _resistanceSniperGear = [["ItemKnife"],["ItemBloodbag"]];
                    _resistanceGunnerRifle = "AK_47_M";
                    _resistanceGunnerAmmo = "30Rnd_762x39_AK47";
                    _resistanceGunnerGear = [["ItemHatchet"],["ItemBloodbag"]];
                    _resistanceMilitiaRifle = "MP5A5";
                    _resistanceMilitiaAmmo = "30Rnd_9x19_MP5";
                    _resistanceMilitiaGear = [["ItemMatchbox"],["ItemBloodbag"]];
           
                    // Faction 1 settings (aka East [Military])
                    _eastRandomSkin = "Bandit1_DZ";
                    _eastSniperSkin = "Bandit1_DZ";
                    _eastGunnerSkin = "Bandit1_DZ";
                    _eastMilitiaSkin = "Bandit1_DZ";
                    _eastRandomGear = ["HandGrenade_west","HandGrenade_west","NVGoggles"];
                    _eastSniperRifle = "SVD_CAMO";
                    _eastSniperAmmo = "10Rnd_762x54_SVD";
                    _eastSniperGear = ["ItemGPS","NVGoggles","Binocular_Vector"];
                    _eastGunnerRifle = "MP5SD";
                    _eastGunnerAmmo = "30Rnd_9x19_MP5SD";
                    _eastGunnerGear = ["ItemGPS","NVGoggles"];
                    _eastMilitiaRifle = "M4A1_AIM_SD_camo";
                    _eastMilitiaAmmo = "30Rnd_556x45_StanagSD";
                    _eastMilitiaGear = ["ItemGPS","NVGoggles"];
        };
    default {};
    };

i even tried adding another switch/case inside the gearset one, based on faction, so if gearset 0 and faction 0, add resistance stuff, if gearset 0 and faction 1 add west stuff. still the same result
Hmm.. This is why I don't want to edit much. I can't test it first..

Inside of the Gear arrays, you can't add weapons or tools.. That will be an issue.. I don't see any other issues though.. If you can show me any errors in your report file, then I can debug..
 
Tell you guys what.. My server expires tonight.. Give me a quick list of stuff you want, and I will try to get it all done before tonight for you.. I will start working on respawns and multiple gear sets right now.
 
Hmm.. This is why I don't want to edit much. I can't test it first..

Inside of the Gear arrays, you can't add weapons or tools.. That will be an issue.. I don't see any other issues though.. If you can show me any errors in your report file, then I can debug..
ah, did not know that, sorry :p

this is the only thing repeated constantly in my rpt file until i disconnect:
0:36:58 Warning: z\addons\dayz_communityassets\models\soda_drwaste_clean_full.p3d:0 Error while trying to generate ST for points: 109, 111, 159
 
Tell you guys what.. My server expires tonight.. Give me a quick list of stuff you want, and I will try to get it all done before tonight for you.. I will start working on respawns and multiple gear sets right now.
erm, i dont really know tbh. respawns and multi gear definitely. also if possible the ability to add varying skill levels too. so low end loadout gets lower accuracy and higher shake, higher loadout gets higher accuracy etc.

cant think of much past this :/
 
Tell you guys what.. My server expires tonight.. Give me a quick list of stuff you want, and I will try to get it all done before tonight for you.. I will start working on respawns and multiple gear sets right now.

If i can figure out respawning i'd be a happy man :)
Extra groups would be great, 3 types is fine for most but more would always come in handy.
Giving them a vehicle to use (Helicopter,Humvee, etc) would be amazing, but that would take time ?

If my server had more resources i'd be happy to offer you access.
 
I've added:
Respawning (based on variable)
Gearsets (dynamic'ish)
Fixed the gear (so you can add tools and additional weapons)
Added the WEST factions (but beware, because they will share your loyalties in terms of who they will/will not attack)
and severely reduced the size of the mission folder (had a brain fart this whole time about logical processing)
AI loads in with magazines already loaded (no wasted time loading their guns at the start)

Testing the stuff now.

As for vehicles. It's not a terribly difficult thing to do, but as you said, it takes a little bit of time, and the waypoints aren't nearly the same, so there would be a lot more time required than what I have available unfortunately.
 
So the problem that i'm getting right now is that it's not letting me pass additional parameters through the event handler, so I can't respawn the same unit with the same values. I'm looking at what values I can retrieve from the corpse, but I definitely won't be able to retrieve the waypoints or radius for sure.

I'm going to see if I can at the very least pull gear skins and skill and maybe set a general radius and waypoints.
 
I've gotten a few offers of people wanting me to continue my project on their server. These are very gracious offers, but I don't think you understand what that means. Basically you would have to give me your admin username and password. If you're ok with that, then I will continue this project and do my testing on your server when there aren't people online, but I want you to be mindful that you're giving a complete stranger administrative privileges to your server. If you're still ok with that, then send me the info in a private message, but don't take that lightly. I wouldn't give anyone that I don't know personally that sort of trust. lol
 
So what are you up to now? Kinda lost what you were talking about.. Should I wait before I DL what you have up on the first page for the changes you're currently working on?
 
I'm 1 tiny issue away with adding a shitload of stuff for a possibly final release. I'm debating doing 1 more month of my server just so I can get the vehicle portion of this addon up and running.
 
Back
Top