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

Gah! I'm trying to spawn two on the tower of the devils castle, but even when i use the exact worldspace (with height variable) , they aren't there when I restart.. Anyone got any tips ?

Are the rest spawning? How are you getting the height? Are you going up there and logging off?
 
I can't figure out how to make players hated by all AI, but you can have AI factions that attack them on sight, see this post:

http://opendayz.net/index.php?threads/dayz-npc-ai-units-troops-add-to-server.8002/page-7#post-21566
They don't differentiate between hero, survivor, and bandit though, which is my goal. I can make all players hated by all AI, but I can't make them differentiate based on costume or humanity. The end goal was a zone where anyone with humanity less than 2500 gets killed on sight, and all the coop guys are free to roam.

By hero and bandit I don't mean AI, i mean players with certain levels of humanity. If I could assign everyone with under 2500 humanity to their own side then I would be set.
 
They don't differentiate between hero, survivor, and bandit though, which is my goal. I can make all players hated by all AI, but I can't make them differentiate based on costume or humanity. The end goal was a zone where anyone with humanity less than 2500 gets killed on sight, and all the coop guys are free to roam.

By hero and bandit I don't mean AI, i mean players with certain levels of humanity. If I could assign everyone with under 2500 humanity to their own side then I would be set.

Yeah, I'd like to do that as well :(
 
Code:
23:41:49 Error in expression <_aiunit addMagazine _aiammo;
_gearCount _resistanceRandomGear = count;
for [{z =>
23:41:49  Error position: <_resistanceRandomGear = count;
for [{z =>
23:41:49  Error Missing ;
Code:
_aiunit addMagazine _aiammo;
_gearCount = count _resistanceRandomGear;
for [{z = 0},{z = (_gearCount - 1)},{z = z + 1}] do {

Someone please point out the obvious mistake i've made here. I've been going back and forth on this one error for 20 minutes. I'm sure it's right in my face.
 
I'm putting a player up there, saving the map and opening the mission file , getting the player worldspace that way.. and yep, the others are spawning :)
Check your rpt log file and see if it says anything. If the others are spawning then it's gotta be a world space issue.
 
Code:
23:41:49 Error in expression <_aiunit addMagazine _aiammo;
_gearCount _resistanceRandomGear = count;
for [{z =>
23:41:49  Error position: <_resistanceRandomGear = count;
for [{z =>
23:41:49  Error Missing ;
Code:
_aiunit addMagazine _aiammo;
_gearCount = count _resistanceRandomGear;
for [{z = 0},{z = (_gearCount - 1)},{z = z + 1}] do {

Someone please point out the obvious mistake i've made here. I've been going back and forth on this one error for 20 minutes. I'm sure it's right in my face.

Where is the rest of your code?

{ brackets are for opening statements. }; is closing brackets.
 
Where is the rest of your code?

{ brackets are for opening statements. }; is closing brackets.
I was only including what was in the error. Here is the rest of the loop.
Code:
                        _aiunit addMagazine _aiammo;
                        _gearCount = count _resistanceGunnerGear;
                        for [{z = 0},{z = (_gearCount - 1)},{z = z + 1}] do {
                            _currentItem = _resistanceGunnerGear select z;
                            _aiunit addMagazine _currentItem;
                        };
 
I was only including what was in the error. Here is the rest of the loop.
Code:
                        _aiunit addMagazine _aiammo;
                        _gearCount = count _resistanceGunnerGear;
                        for [{z = 0},{z = (_gearCount - 1)},{z = z + 1}] do {
                            _currentItem = _resistanceGunnerGear select z;
                            _aiunit addMagazine _currentItem;
                        };
Well, it says you're missing a ; so I'd load it into notepad++, set the language to C and make sure all of your open brackets have corresponding }; brackets
 
Check your rpt log file and see if it says anything. If the others are spawning then it's gotta be a world space issue.

Actually saw an AI on the roof, but 4 minutes later it was gone.. I went hunting and found he had thrown himself off the roof.. even though I set the radius to 5 meters.. lol! As for the other guy, still can't figure out why he's not up where he should be... oh well :)
 
I was only including what was in the error. Here is the rest of the loop.
Code:
for [{z = 0},{z = (_gearCount - 1)},{z = z + 1}] do {
_aiunit addMagazine _aiammo;
                        _gearCount = count _resistanceGunnerGear;
                        for [{z = 0},{z = (_gearCount - 1)},{z = z + 1}] do {
                            _currentItem = _resistanceGunnerGear select z;
                            _aiunit addMagazine _currentItem;
                        };

You have an open bracket. after do { you have no closing brackets for it

for [{z = 0},{z = (_gearCount - 1)},{z = z + 1}] do {

You need a closing bracket.
 
Here are some coords, if anyone else wants to use them:
Balotta Airstrip [4829.9868, 2450.1104, 0]
Berenzino [12954.624, 9783.1533, 0]
Bereznio 2 [12043.963, 9091.3477, 0]
Black Mountain [10276.416, 12049.664, 0]
Bor [3320.1643, 3938.3496, 0]
Cherno [6743.8853, 2581.1865]
Devils Castle [6891.9189, 11438.73, 0]
Don's Camp [7788.2856, 12613.048, 0]
Drozhino [3442.2849, 4955.7129, 0]
Dubrovka [10445.011, 9868.9912, 0]
Electro [10480.69, 2217.8027, 0]
Factory [13060.078, 7094.0596, 0]
Gorka [9659.084, 8795.334, 0]
Grishno [5979.6953, 10343.341, 0]
Guglovo [8517.8682, 6676.3276, 0]
Gvozdno [8614.4316, 11868.967, 0]
Kabanino [5318.8369, 8602.6328, 0]
Kamyshovo [12127.406, 3496.2185, 0]
Khelm [12290.833, 10904.328, 0]
Komarovo [3654.0908, 2475.9468, 0]
Kozlovka [4483.6777, 4616.1675, 0]
Krastonav [11212.624, 12256.609, 0]
Lopatino [2780.3135, 10018.82, 0]
Moglievka [7544.5845, 5148.7822, 0]
Msta [11275.323, 5495.4053, 0]
Myshkino [2019.2487, 7327.7178, 0]
Nadezhdino [5846.4434, 4706.708, 0]
NEAF [12073.906, 12724.305, 0]
Nizhnoye [13002.393, 8285.8574, 0]
Novy Sobor [7074.4854, 7683.4883, 0]
NWAF [4480.0781, 10375.544, 0]
Orlovets [12146.174, 7266.5801, 0]
Pavlovo [1693.9392, 3845.0657, 0]
Petrovka [5014.1143, 12493.039, 0]
Pogorevka [4473.5957, 6411.3198, 0]
Polana [10753.393, 8132.6606, 0]
Prigorodki [7976.5557, 3299.5386, 0]
Pulkovo [4915.0903, 5605.6401, 0]
Pusta [9156.2549, 3897.7598, 0]
Pustoshka [3072.9629, 7945.4404, 0]
Rogovo [4808.0024, 6805.0518, 0]
Shakhovka [9654.5244, 6555.2583, 0]
Solnichny [13454.279, 6233.647, 0]
Soosnovka [2528.7561, 6354.9839, 0]
Staroye [10140.659, 5434.4302, 0]
Stary Sobor [6143.6167, 7721.5176, 0]
Tulga [12803.296, 4450.7466, 0]
Vybor [3815.0635, 8865.0938, 0]
Vyshnoye [6590.3159, 6029.1128, 0]
Zelenogorsk [2758.7144, 5304.3457, 0]
 
Just wanted to say @orchthrasher that your edited scripts, worked great. I now have good guys at my base and bad guys at the airfield. A couple of questions though , that I can't answer on my own because I've not had chance to test it properly..

1. If I'm the in presence of the Survivors (good guys) and another player shoots me, will the Survivors turn on them? or do they only turn on you if you killed another AI in their group (I've set the SetFriend to 0.6)..

2. Do Survivors AI attack the Bandits AI, because I went to the airfield and found dead bandits everywhere , but no other player on the server yet. I also had 4 Survivor AI's on the airfield at the time..

And once again to everyone getting involved with making this script what it is, thanks a million. I can't tell you how long I've waited for this on my server :)

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];

to initiate this I am using the wheel mouse, ingame menu by calling this (previous _array comes from this addAction)

init_aicontrol.sqf
Code:
private ["_mActive", "_array","_playerpos","_isNear"];
 
//_myUId = _this select 2;
_array = _this select 3;
_mActive = _array select 1;
//aigroup= this select 4 select 0;
 
while {true}
do
{
    if (!isNull player) then
    {
        _playerpos = getPos player;
        _nUnit = getPos player nearestObject "BAF_Soldier_L_DDPM";
 
        if(player distance _nUnit < 20)then
        {
        _isNear=true;
        }
        else
        {
        _isNear=false;
        };
 
        if (_mActive != player &&  _isNear) then
        {
            _mActive = player;
            _aigroup = group _nUnit;
            //hint format ["Nearest Group:%1",_aigroup];
            addunit = player addAction ["<t color=""#00ff33"">" + ("Lead Units") + "</t>", "units\lead_units.sqf",[_aigroup],-26,true,true];
            sleep 0.5;
        } ;
 
        if(!_isNear && _mActive == player) then
        {
        _mActive=objNull;
        player removeAction addunit;
        };
 
    };
 
};

I am initiating this from my mission init.sqf with

Put this in <mission folder>\init.sqf within a:

if (!isDedicated)then{
Code:
    //Control AI
    ["","","",[false,objNull]] execVM "units\init_aicontrol.sqf";
};

Basically, call the AI control init file which adds a wheel mouse menu item if within 20 metres of a group of AI units. then you have the standard Arma controls to order them about. Try F1 for the first guy, F2 for the second etc. then press one of your 1-0 number keys for different options. Go to a map and order them to go somewhere and hold shift(or ctrl) and click on the map to send them. This is organising and waypointing your troops ingame..

Gives a good idea of what is going on in the code when you can see it in the game ;)

NB. If you are wondering why, when I call my init_whatevercode.sqf from the first init.sqf I have an array with three empty items. It is to make sure the #3 item is first real value (in this case an array). This is because when using sub menus I recall the same .sqf from itself, and when doing that you are forced to reference the third array element as the others are already occupied with addaction :)

I have found, in testing, that the group behaviour seems to change once you take control as they kind of follow you about, they definitely shoot the 'defined' enemy. Waypoint behaviour is excellent, point one a t a chopper and tell him to fly somewhere and disembark, he will do it, though may look for the nearest helipad..

I would seriously setup some diag_log logging to return unit behaviour, skills etc., whatever is readable and put it to the .rpt file to gain an understanding as you order them around the map in realtime.
 
Actually saw an AI on the roof, but 4 minutes later it was gone.. I went hunting and found he had thrown himself off the roof.. even though I set the radius to 5 meters.. lol! As for the other guy, still can't figure out why he's not up where he should be... oh well :)
Spawned in a building, we killed a load before we realised where they were... splattered on the floor !?!
 
I would be having to much fun with that bus. Set the init for the driver to spawn like 26 passengers with guns on death. lol.. oh the possibilities.
 
I would be having to much fun with that bus. Set the init for the driver to spawn like 26 passengers with guns on death. lol.. oh the possibilities.

Lol it would be really funny if that bus full of ai with guns stops to let a survivor in then could stand up in the bus as he boards and lights him up
 
Back
Top