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

Ok. Thanks i go test this and then try to use this im my files
:)

ok i need to look a the code some time and make the connections i need to understand it some more
so i can use this in a easy way
im not new NEW to scripting
but i learn it from scrap .
and to understand the code is not that simple ::)

Edit
ok so this for "_groupsize" from 0 to 4 do tells the server to create 5 ai soldiers ?
and is there a way to make the static guns always spawn with ai on it
now i use this
_unit_27 = objNull;
if (true) then
{
_this = _group_2 createUnit ["gsc_eco_stalker_mask_fred", [22881.412, 19841.514, 14.264023], [], 0, "CAN_COLLIDE"];
_unit_27 = _this;
_this setDir -153.9915;
_this setVehicleInit "this moveingunner M2";
_this setUnitRank "MAJOR";
_this setUnitAbility 1;
if (true) then {_group_2 selectLeader _this;};
};

_group_5 = createGroup _center_0;

_vehicle_15 = objNull;
if (true) then
{
_this = createVehicle ["M2StaticMG", [22335.965, 19677.496, 23.536039], [], 0, "CAN_COLLIDE"];
_vehicle_15 = _this;
_this setDir 43.467625;
_this setVehicleVarName "M4";
M4 = _this;
_this setPos [22335.965, 19677.496, 23.536039];
};
and not all the time the ai spawn on the guns
most time they drop death behind the gun
and all the ai are the same with the same m2 gun

Thanks
 
Last edited:
for "_groupsize" from 0 to 4 do
{
};
This is an easy way to do a 'loop' a certain number of times. The variable _groupsize does not have to be anything special and it is incremented automatically every time that code block executes.

If the ai are dropping dead, check your RPT log for "killed a hacker". I think you have to add the setvariable ["sarge",1]; to all static guns, just like I had explained for the vehicles.

If your server has already started and the script runs afterwards then those setvehicleinit lines will not be exectuted until you call processinitcommands. When you create a file in the editor, it always includes this command at the bottom.
https://community.bistudio.com/wiki/processInitCommands
https://community.bistudio.com/wiki/setVehicleInit
 
Last edited:
i made a few patrols working like a charm.
is it possible that when i kill a bandit it wil count in the debug ?
and i wonder if i can make the humanity work on the ai
so that friendly ai shoot on bandits
 
Yes. Just add a eventhandler to the group that edits humanity. Look at the dzai or,sarge,scripts and search for,humanity to see how they do it
 
Back
Top