dayZ NPC (AI) Units / Troops | Add to Server.

@BetterDeadThanZed - Yes, the AI's will probably run out of ammo, there is a script about 4 or 5 pages in that tries to deal with this, an eventhandler set to FIRE would do it, checking ammo on this and reloading if required. To get AI units to use a vehicle see @Orcthrashers post after yours then read this:

@Orcthrasher - to get AI units to drive a vehicle do what you have done after creating MOVE waypoints (place a CYCLE waypoint exactly over the first to get them to drive in a loop). The units (possibly the vehicle) and waypoints must be of the same group.. In a chopper they will land at the nearest helipad (within 500m) and move to that waypoint, they should then get back in the chopper and carry on.. Try setting the driver as the leader of the group, might help ?

The AI waypoints and eventhandlers are quite simplistic, do not complicate things. Get some units together, group them, go to some point(s), do something, then.. This is my next step, you can send them off duty (dismiss) and fire up another, re-assign them, whatever..

I have had endless fun trying to get a driver and his mate to drive a bus, when the driver gets killed the mate takes over, simple ? nah, have had all sorts of weird and wonderful stuff going on. I have an eventhandler on the bus that loops after the engine starts, it is designed to beep at survivors within 500m and monitor the drivers seat. Beeping doesn't work until I kill the driver, his mate takes over then kill the drivers mate. The drivers seat is actually empty, then the bus beeps at me . I have EHs on the driver and apply the same one to his mate when he takes over. I need to simplify things !

Set friend values - Make sure you have assigned all of the units to a group that is assigned as east or resistance. Create the group before the units are created and then assign each unit to that group, even then they make their own decisions (and do seem a bit dumb). If you want them to attack a target thoroughly they need a waypoint set to DESTROY attached to that 'vehicle'.

Changing from 0.6 to 1 makes them worse drivers but better at hunting.. That figure is overall 'intelligence' i think. I have the bus spawn in a compound. The bus driver, at 0.6, he ran the gate down, at 1 he did a 36 point turn out of a gap in the fence. Weirdly, since setting it back to 0.6 he now seems to have a 50/50 chance of going for the gap in the fence, never did that before..

I will try and go through the 18 pages and highlight the bits and link from the original post to help. I do have a bus route to finish and would love to get my survivor camps sorted on my server also.
 
hey guys i dont no if this question has been asked and answered if so could someone please point me in right direction but is there any way to add extra units to a group say have a group of 5 instead of just 3 as im wanting them all to have different weapons any ideas anyone?
 
hey guys i dont no if this question has been asked and answered if so could someone please point me in right direction but is there any way to add extra units to a group say have a group of 5 instead of just 3 as im wanting them all to have different weapons any ideas anyone?
Check out the first post, you can change the number of units in the array that calls the ai spawn code. In that you can edit weapons and ammo..
 
Check out the first post, you can change the number of units in the array that calls the ai spawn code. In that you can edit weapons and ammo..
ah you see im using a different one that sycosis uploaded and im guessing he just basically took things from this one and changed a few things about and added a few others sorry mate
 
Thanks for your reply axeman. Just want to re-ask this since it was on the previous page:

I won't answer for axeman, but I added this to Oring yesterday, and had AI take control of the middle island, and added a few small perks to controlling that area (primarily because the AI used elite weapons which you could loot from them), and the people on my server absolutely loved it. There were groups of survivors working together to kill the AI, which is rare from my perspective to see survivors openly working together. My note would be that you need to change their attributes based on the area, because initially I had some sniper AI that were lighting people up from 500 yards in 1 shot.

Code:
    //set skills
    _aiunit setSkill ["aimingAccuracy",.7];
    _aiunit setSkill ["aimingShake",0.9];
    _aiunit setSkill ["aimingSpeed",.6];
    _aiunit setSkill ["endurance",1];
    _aiunit setSkill ["spotDistance",0.6];
    _aiunit setSkill ["spotTime",0.6];
    _aiunit setSkill ["courage",1];
    _aiunit setSkill ["reloadSpeed",1];
    _aiunit setSkill ["commanding",1];
    _aiunit setSkill ["general",1];

We finished with this, which ended up being just right for a group of 4 to take them out. I spawn 35 troops over 7 locations inside of an semi-small area (roughly the size of a small town) and it took 4 of us with snipers from a vantage point about 15 minutes to kill them all, and they still killed 2 of us.

Just a couple questions - still reading through 18 pages of this thread... what file does the above code go in and how did you get the AI to engage you? Were you bandits when you engaged them or suvivors?

Then, you can either modify your add_unit_server to accept a bandit/hero parameter to change the center, or just (like I did for testing) duplicate it.

Do you add the code to the add_unit_server.sqf or do you overwrite what is in there with the code you provided?
 
Man, I'd love to turn my greasy eyes to that script.

I'm also still wrestling with

Code:
"DEBUG: Deleting object UH1H_DZ with invalid ID at [33.5224,1590.66,0.000714302]"\

killing my scripted vehicles. I found the location in my fsm file and did this:

Code:
name = "check_for_hacker";
      init = /*%FSM<STATEINIT""">*/"//Check for hackers" \n
      " {" \n
      "//if(vehicle _x != _x) then {" \n
      "//if  (!(vehicle _x in _safety) && ((typeOf vehicle _x) != ""ParachuteWest"")) then {" \n
      "//diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
      "//(vehicle _x) setDamage 1;" \n
      "//_x setDamage 1;" \n
      "//};" \n
      "//};" \n
      " } forEach allUnits;" \n
      ""/*%FSM</STATEINIT""">*/;

I THINK that fixes the hacker vehicle xplosion (though maybe I'll put it back in! Only NPCs should be driving it).

I also found this in my server_objectupdate.sqf

Code:
if (!_parachuteWest) then {
if (_objectID == "0" && _uid == "0") then {
_object_position = getPosATL _object;
//    diag_log format ["DEBUG: Deleting object %1 with invalid ID at [%2,%3,%4]", typeOf _object, _object_position select 0, _object_position select 1, _object_position select 2];
//_isNotOk = true;
_isNotOk = false;
};
};
 
if (_isNotOk) exitWith { deleteVehicle _object; };

Which is the only sqf file that I can find that contains "DEBUG: Deleting Object", but it still does it :(

Don't do that. If you comment out that block, anybody can spawn in vehicles and drive away unharmed.

I sorted that in my scripts, will upload a bit later a first beta version.

cheers

Sarge
 
Don't do that. If you comment out that block, anybody can spawn in vehicles and drive away unharmed.

I sorted that in my scripts, will upload a bit later a first beta version.

cheers

Sarge

I am really looking forward to seeing your method of stopping the server from destroying vehicles that aren't allowed. Generally I know this method it is a bad idea but am hoping the BattleEye will deal with any hacked items.

I have in admin in-game menu to spawn new vehicles and add them to the database, partly to give newbies a helping hand with a motorbike or car, and to help keep the server populated with vehicles.. And for Apache dog-fighting when the server is empty :)

Am currently stuck with the editing out of the clean up code.
 
I am really looking forward to seeing your method of stopping the server from destroying vehicles that aren't allowed. Generally I know this method it is a bad idea but am hoping the BattleEye will deal with any hacked items.

I have in admin in-game menu to spawn new vehicles and add them to the database, partly to give newbies a helping hand with a motorbike or car, and to help keep the server populated with vehicles.. And for Apache dog-fighting when the server is empty :)

Am currently stuck with the editing out of the clean up code.


Do you basically have hacker like stuff in your mission but only accessible by your uid or something? - I'd be interested in something like that. Would make admining so much easier, and way more fun.
 
Unit Skill: Currently the units' skill is set to 1 for everything, these should probably be edited, try these
Code:
 _aiunit setSkill ["aimingAccuracy",1];
    _aiunit setSkill ["aimingShake",0.9];
    _aiunit setSkill ["aimingSpeed",1];
    _aiunit setSkill ["endurance",1];
    _aiunit setSkill ["spotDistance",0.6];
    _aiunit setSkill ["spotTime",0.8];
    _aiunit setSkill ["courage",0.9];
    _aiunit setSkill ["reloadSpeed",1];
    _aiunit setSkill ["commanding",1];
    _aiunit setSkill ["general",1];
and experiment. Also the setBehaviour will be important, have been considering setting that to CARELESS info combatModes and setBehaviour

Is this added to "add_unit_server.sqf"?
 
@Manatee, No hacker stuff, I check for our UIDs and then add the spawn vehicle code to the menu options. The Apache I delete as the player disembarks or it causes strange issues. Like re-appearing, on fire, at the spawn point if crashed..

The others are just added the normal way and added to the database with Xyberviri's vehicle update code..

@BetterDeadThanZed, yep, edit those values in the file. I have found combatMode best set to COMBAT for them to attack.
 
I am really looking forward to seeing your method of stopping the server from destroying vehicles that aren't allowed. Generally I know this method it is a bad idea but am hoping the BattleEye will deal with any hacked items.

I have in admin in-game menu to spawn new vehicles and add them to the database, partly to give newbies a helping hand with a motorbike or car, and to help keep the server populated with vehicles.. And for Apache dog-fighting when the server is empty :)

Am currently stuck with the editing out of the clean up code.

To explain the logic:

All Dayz spawned vehicles are held in a huge array as well as in the database. When your server starts, the vehicles from the DB are written into that nested array. The cleanup fsm checks if all vehicles on the map are in that array. If not, it will blow it up.

What i did is to add an objectvariable to my vehicles when they get created, and adjust the cleanup fsm to in addition check for that objectvariable.

cheers

Sarge
 
Do you basically have hacker like stuff in your mission but only accessible by your uid or something? - I'd be interested in something like that. Would make admining so much easier, and way more fun.

check out the proving grounds addon. You will need to adjust it a bit, but that's what i use.
 
Hi Everyone,

Before I say anything - I am slightly horrible when it comes to programming things - I am one of those people that know my limitation and gladly support others in the coding and development.

This and other threads in this forum section are amazin in the tidbits I learn - but there is one thing I still dont know if anyone have thought of and therefore created a script that will perform something like this:

When AI detects a player:
  • Check if player is Admin
    • If Yes = Set player to a positive rating enough to be friendly
    • If No = Set player to a negative rating, enough to be RED and COMBAT mode hostile
The idea I was having was to build up small Admin/VIP only bases where Admins/VIP could store things that could be helpful for others in the server (admin handouts without scripting). It not only gives the Admin team a purpose to play the game as well (to get the stuff to hand out), but can be an incentive for bandit groups to try and target and clean out.

I was hoping of being able to set up Admin groups with little Admin access, but where the recognition script for AI would be able to determine if a player is an Admin or not, but I cannot find any way to do it (Me = _iscodingnoob) or find any info about this at BI or Battleye.

Chances are the answer to the above "Is it possible?" question is "No", but maybe there is a super simple way to do it that I am not thinking of?
 
How do I set it so my AI soldiers or bandits won't spawn with prohibited items? One of my players apparently killed an AI soldier and took his radio, which TSW anticheat detects as a cheat.
 
Getting AI units to return fire I think is to do with setCombatMode, have been messing with this to try and get my bus driver and drivers mate to retaliate if attacked, so far no luck, they just die:(. But in most cases it looks like the leader of the group needs to initiate the attack, see combatMode. This is going to require a trigger to trigger the group to attack, a command seems to be required.

So I am testing this with an ingame ability to take command of any AI unit wandering about, with this:

I am using this to get a unit group to join my player group:

lead_units.sqf
Code:
    _array = _this select 3;
    _aigroup = _array select 0;
    _aiunits= units _aigroup;
    _aiunits join (group player);
    (group player) selectLeader player;
    diag_log format ["Player is leader of %1",_aigroup];

Where does this go in the init file?
I tried both

["","","",[false,objNull]] execVM "units\lead_units.sqf";
[] execVM "units\lead_units.sqf";

but with no luck.
 
Where does this go in the init file?
I tried both

["","","",[false,objNull]] execVM "units\lead_units.sqf";
[] execVM "units\lead_units.sqf";

but with no luck.
You are missing the init_aicontrol.sqf file from the units folder. That is the one that is called from the mission folder init.sqf. See here
 
Back
Top