In Search of Anti-Zombie, and Car God Mode at Trader Zones.. using AGN

sweet little add on thanks works great for me ... anyway you could add the option for it to delete DZAI units that enter any traders? really annoying hearing all the shooting when one creeps into there lol
 
sweet little add on thanks works great for me ... anyway you could add the option for it to delete DZAI units that enter any traders? really annoying hearing all the shooting when one creeps into there lol
I feel like there should be a way in the DZAI configuration to prevent them from going into trader zones, or specific coordinates.
 
there is only distance they don't spawn from those areas , they will still wander into traders, if not they hang outside the distance then they might as well be campers and its hard for players to leave the safezones..

regardless id much rather them be deleted like the zeds in this script seems to be perfect for what i want. it gets rid of ai near traders and doesn't get players killed or give them a chance to amass loot via ai groups and then ambushing them just at the safezone border, gathering the loot and selling it and repeating the process . seems to cover all bases and not have that big a drawback.

the obvious drawback is players can lure ai to the delete zone to not fight them but at least no loot so its a big effort and waste of time for just avoiding a fight, which they can do anyways by running.
 
there is only distance they don't spawn from those areas , they will still wander into traders, if not they hang outside the distance then they might as well be campers and its hard for players to leave the safezones..

regardless id much rather them be deleted like the zeds in this script seems to be perfect for what i want. it gets rid of ai near traders and doesn't get players killed or give them a chance to amass loot via ai groups and then ambushing them just at the safezone border, gathering the loot and selling it and repeating the process . seems to cover all bases and not have that big a drawback.

the obvious drawback is players can lure ai to the delete zone to not fight them but at least no loot so its a big effort and waste of time for just avoiding a fight, which they can do anyways by running.
I assume a variable would be added to the AI unique to them so maybe you could do something like this:
Code:
 ..._entity_array = (getPos player) nearEntities ["CAManBase",110];
            {
                if (_x getVariable "AIVariable") then {
                    deletevehicle _x;
                };
            } forEach _entity_array;...
or just go in and add a variable to them. Something along these lines to point ya in the right direction
 
The problem with adding god mode to vehicles at traders is it's buggy at best and involves players to get in and out of vehicle once, it can also leave the god mode on the vehicle/player when it's left the trader.
 
Yea that's why I just added god mode to locked vehicles. Players just need to remember to lock their vehicles after they get out
 
im dont really know how to script for this stuff but i figured most of it out i think not sure how to set the variable to tell it what are , if they already have one can i just use that ? anyways what i have so far...

i added in private at the top
Code:
private ......  ,"AGN_safeZone_Players_RemoveAIunits"];
added to script settings
Code:
AGN_safeZone_Players_RemoveAIunits= true;
NOT SURE WHAT TO DO HERE to change this into AI(this is obviously the zed portion i assume i need to change to set an ai variable)
Code:
        _zombies = _basis nearEntities ["zZombie_Base",50];
        _count = count _zombies;
        for "_i" from 0 to (_count -1) do
        {
            _zombie = _zombies select _i;
            deletevehicle _zombie;
    };

and finally i added the part you provided above (i just named them AI_units for now)
Code:
    AGN_safeZone_Players_RemoveAIunits ) then
   {
     while {!canBuild} do
     {
       _entity_array = (getPos player) nearEntities ["CAManBase",110];
       {
         if (_x isKindof "AI_unit") then {
           deletevehicle _x;
         };
       } forEach _entity_array;
       sleep 4;
     };
   };
i think thats it anything else i need to add after that or forgot ?
any help on the variable part would be awsome thanks guys!
 
im dont really know how to script for this stuff but i figured most of it out i think not sure how to set the variable to tell it what are , if they already have one can i just use that ? anyways what i have so far...

i added in private at the top
Code:
private ......  ,"AGN_safeZone_Players_RemoveAIunits"];
added to script settings
Code:
AGN_safeZone_Players_RemoveAIunits= true;
NOT SURE WHAT TO DO HERE to change this into AI(this is obviously the zed portion i assume i need to change to set an ai variable)
Code:
        _zombies = _basis nearEntities ["zZombie_Base",50];
        _count = count _zombies;
        for "_i" from 0 to (_count -1) do
        {
            _zombie = _zombies select _i;
            deletevehicle _zombie;
    };

and finally i added the part you provided above (i just named them AI_units for now)
Code:
    AGN_safeZone_Players_RemoveAIunits ) then
   {
     while {!canBuild} do
     {
       _entity_array = (getPos player) nearEntities ["CAManBase",110];
       {
         if (_x isKindof "AI_unit") then {
           deletevehicle _x;
         };
       } forEach _entity_array;
       sleep 4;
     };
   };
i think thats it anything else i need to add after that or forgot ?
any help on the variable part would be awsome thanks guys!
Like with Sarge AI, if I'm remembering correctly I believe it would be if (_x getVariable "Sarge" == 1) then { deletevehicle _x;}...
 
nah that didnt work ... would the despawn.sqf have the info needed?

Code:
/*
    despawnBandits
   
    Description: Deletes all AI units spawned by a trigger once all players leave the trigger area. Basic script concept adapted from Sarge AI.
   
    Usage: Called by a static trigger when all players have left the trigger area.
   
    Last updated: 12:53 AM 2/17/2014
   
*/
private ["_trigger","_grpArray","_isCleaning","_grpCount"];
if (!isServer) exitWith {};                            //Execute script only on server.

_trigger = _this select 0;                            //Get the trigger object

_grpArray = _trigger getVariable ["GroupArray",[]];    //Find the groups spawned by the trigger.
_isCleaning = _trigger getVariable ["isCleaning",false];    //Find whether or not the trigger has been marked for cleanup, otherwise assume a cleanup has already happened.

_grpCount = count _grpArray;

if (DZAI_debugLevel > 1) then {diag_log format ["DZAI Extended Debug: _grpArray is %1. _isCleaning is %2.",_grpArray,_isCleaning];};
if ((_grpCount == 0) or {_isCleaning}) exitWith {if (DZAI_debugLevel > 1) then {diag_log "DZAI Extended Debug: Trigger's group array is empty, or a despawn script is already running. Exiting despawn script.";};};   

_trigger setVariable["isCleaning",true];        //Mark the trigger as being in a cleanup state so that subsequent requests to despawn for the same trigger will not run.
if (DZAI_debugLevel > 1) then {diag_log format["DZAI Extended Debug: No players remain in trigger area at %3. Deleting %1 AI groups in %2 seconds.",_grpCount, DZAI_despawnWait,(triggerText _trigger)];};

if ((!isNil "DZAI_debugMarkersEnabled") && {DZAI_debugMarkersEnabled}) then {
    private["_tMarker"];
    _tMarker = str (_trigger);
    _tMarker setMarkerText "STATIC TRIGGER (DESPAWNING)";
    _tMarker setMarkerColor "ColorOrange";
};

sleep DZAI_despawnWait;                                //Wait some time before deleting units. (amount of time to allow units to exist when the trigger area has no players)

if (triggerActivated _trigger) exitWith {            //Exit script if trigger has been reactivated since DZAI_despawnWait seconds has passed.
    if (DZAI_debugLevel > 1) then {diag_log format ["DZAI Extended Debug: A player has entered the trigger area at %1. Cancelling despawn script.",(triggerText _trigger)];};
    if ((!isNil "DZAI_debugMarkersEnabled") && {DZAI_debugMarkersEnabled}) then {
    private["_tMarker"];
        _tMarker = str (_trigger);
        _tMarker setMarkerText "STATIC TRIGGER (ACTIVE)";
        _tMarker setMarkerColor "ColorRed";
    };
    _trigger setVariable ["isCleaning",false];    //Allow next despawn request.
};           

{
    if ((!isNil "DZAI_debugMarkersEnabled") && {DZAI_debugMarkersEnabled}) then {
        {
            deleteMarker (str _x);
        } forEach (waypoints _x);
        sleep 0.1;
    };
    //DZAI_numAIUnits = DZAI_numAIUnits - (_x getVariable ["groupSize",0]); //Update active AI count
    (DZAI_numAIUnits - (_x getVariable ["groupSize",0])) call DZAI_updateUnitCount;
    {deleteVehicle _x} forEach (units _x); //Delete live units
    if (DZAI_debugLevel > 1) then {diag_log format ["DZAI Extended Debug: Group %1 has group size %2.",_x,(_x getVariable ["groupSize",0])];};
    sleep 0.5;
    deleteGroup _x;                                    //Delete the group after its units are deleted.
} forEach _grpArray;

if (DZAI_debugLevel > 0) then {diag_log format ["DZAI Debug: Despawned AI units at %1. Resetting trigger's group array.",(triggerText _trigger)];};

if !(_trigger getVariable ["permadelete",false]) then {
    //Cleanup variables attached to trigger
    _trigger setVariable ["GroupArray",[]];
    _trigger setVariable ["isCleaning",nil];

    if ((!isNil "DZAI_debugMarkersEnabled") && {DZAI_debugMarkersEnabled}) then {
        private["_tMarker"];
        _tMarker = str (_trigger);
        _tMarker setMarkerText "STATIC TRIGGER (INACTIVE)";
        _tMarker setMarkerColor "ColorGreen";
    };
} else {
    if ((!isNil "DZAI_debugMarkersEnabled") && {DZAI_debugMarkersEnabled}) then {
        deleteMarker (str (_trigger));
    };
    deleteMarker (_trigger getVariable ["spawnmarker",""]);
    deleteVehicle _trigger;
};

DZAI_actTrigs = (DZAI_actTrigs - 1);

true
 
nah that didnt work ... would the despawn.sqf have the info needed?

Code:
/*
    despawnBandits
  
    Description: Deletes all AI units spawned by a trigger once all players leave the trigger area. Basic script concept adapted from Sarge AI.
  
    Usage: Called by a static trigger when all players have left the trigger area.
  
    Last updated: 12:53 AM 2/17/2014
  
*/
private ["_trigger","_grpArray","_isCleaning","_grpCount"];
if (!isServer) exitWith {};                            //Execute script only on server.

_trigger = _this select 0;                            //Get the trigger object

_grpArray = _trigger getVariable ["GroupArray",[]];    //Find the groups spawned by the trigger.
_isCleaning = _trigger getVariable ["isCleaning",false];    //Find whether or not the trigger has been marked for cleanup, otherwise assume a cleanup has already happened.

_grpCount = count _grpArray;

if (DZAI_debugLevel > 1) then {diag_log format ["DZAI Extended Debug: _grpArray is %1. _isCleaning is %2.",_grpArray,_isCleaning];};
if ((_grpCount == 0) or {_isCleaning}) exitWith {if (DZAI_debugLevel > 1) then {diag_log "DZAI Extended Debug: Trigger's group array is empty, or a despawn script is already running. Exiting despawn script.";};};  

_trigger setVariable["isCleaning",true];        //Mark the trigger as being in a cleanup state so that subsequent requests to despawn for the same trigger will not run.
if (DZAI_debugLevel > 1) then {diag_log format["DZAI Extended Debug: No players remain in trigger area at %3. Deleting %1 AI groups in %2 seconds.",_grpCount, DZAI_despawnWait,(triggerText _trigger)];};

if ((!isNil "DZAI_debugMarkersEnabled") && {DZAI_debugMarkersEnabled}) then {
    private["_tMarker"];
    _tMarker = str (_trigger);
    _tMarker setMarkerText "STATIC TRIGGER (DESPAWNING)";
    _tMarker setMarkerColor "ColorOrange";
};

sleep DZAI_despawnWait;                                //Wait some time before deleting units. (amount of time to allow units to exist when the trigger area has no players)

if (triggerActivated _trigger) exitWith {            //Exit script if trigger has been reactivated since DZAI_despawnWait seconds has passed.
    if (DZAI_debugLevel > 1) then {diag_log format ["DZAI Extended Debug: A player has entered the trigger area at %1. Cancelling despawn script.",(triggerText _trigger)];};
    if ((!isNil "DZAI_debugMarkersEnabled") && {DZAI_debugMarkersEnabled}) then {
    private["_tMarker"];
        _tMarker = str (_trigger);
        _tMarker setMarkerText "STATIC TRIGGER (ACTIVE)";
        _tMarker setMarkerColor "ColorRed";
    };
    _trigger setVariable ["isCleaning",false];    //Allow next despawn request.
};          

{
    if ((!isNil "DZAI_debugMarkersEnabled") && {DZAI_debugMarkersEnabled}) then {
        {
            deleteMarker (str _x);
        } forEach (waypoints _x);
        sleep 0.1;
    };
    //DZAI_numAIUnits = DZAI_numAIUnits - (_x getVariable ["groupSize",0]); //Update active AI count
    (DZAI_numAIUnits - (_x getVariable ["groupSize",0])) call DZAI_updateUnitCount;
    {deleteVehicle _x} forEach (units _x); //Delete live units
    if (DZAI_debugLevel > 1) then {diag_log format ["DZAI Extended Debug: Group %1 has group size %2.",_x,(_x getVariable ["groupSize",0])];};
    sleep 0.5;
    deleteGroup _x;                                    //Delete the group after its units are deleted.
} forEach _grpArray;

if (DZAI_debugLevel > 0) then {diag_log format ["DZAI Debug: Despawned AI units at %1. Resetting trigger's group array.",(triggerText _trigger)];};

if !(_trigger getVariable ["permadelete",false]) then {
    //Cleanup variables attached to trigger
    _trigger setVariable ["GroupArray",[]];
    _trigger setVariable ["isCleaning",nil];

    if ((!isNil "DZAI_debugMarkersEnabled") && {DZAI_debugMarkersEnabled}) then {
        private["_tMarker"];
        _tMarker = str (_trigger);
        _tMarker setMarkerText "STATIC TRIGGER (INACTIVE)";
        _tMarker setMarkerColor "ColorGreen";
    };
} else {
    if ((!isNil "DZAI_debugMarkersEnabled") && {DZAI_debugMarkersEnabled}) then {
        deleteMarker (str (_trigger));
    };
    deleteMarker (_trigger getVariable ["spawnmarker",""]);
    deleteVehicle _trigger;
};

DZAI_actTrigs = (DZAI_actTrigs - 1);

true
That wouldn't work because like he said it was for SARGE, not DZAI.
You need to find out what the variable for the DZAI is.
You might be better off trying to get help in the DZAI section. I wish I knew the answer for ya.
 
hermmm well i did specifically say for dzai in my first post when asking for the help lol..
but doesnt the ai spawn in groups so it would be the group array variable ? .. sometimes this stuff confuses the hell outta me
 
Yes you did, he was just giving you an example. Neither of us are sure. You could try and PM butthead, I don't know how often he responds. He's the creator of DZAI.
 
hmm not working didnt break anything but just doesnt delete them ... would i need to modify the delete line to match the way ai despawns ?

{deleteVehicle _x} forEach (units _x);
(do i need to remove the { } around the delete vehicle will this matter?)
im going to try this whats the worst that can happen lol will report back
 
Last edited:
Oh BTW I just noticed that I am able to shoot vehicle weapons and access players backpacks in trader zones. I believe the zombie addition broke the rest of the script. Can anyone verify?
 
Oh BTW I just noticed that I am able to shoot vehicle weapons and access players backpacks in trader zones. I believe the zombie addition broke the rest of the script. Can anyone verify?
I actually might know whats causing that, I think its the placement of the zombie statement thats holding up the script from not completing. I'll try moving it near the end to see if it fixes it.
 
wow fast response time ! :) thanks all works fine for me again weapons cant fire zeds delete no one else on for me to test backpacks
.. still cant get rid of those damn ai tho lol tried that earlier post still not working ...wait was it not working for the same reason the rest wasnt i had it after the zed part ... i have no idea where to put this in to make it work and not break stuff again either.. blaa
 
Back
Top