HisShadowONE
Well-Known Member
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
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I feel like there should be a way in the DZAI configuration to prevent them from going into trader zones, or specific coordinates.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 assume a variable would be added to the AI unique to them so maybe you could do something like this: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.
..._entity_array = (getPos player) nearEntities ["CAManBase",110];
{
if (_x getVariable "AIVariable") then {
deletevehicle _x;
};
} forEach _entity_array;...
private ...... ,"AGN_safeZone_Players_RemoveAIunits"];
AGN_safeZone_Players_RemoveAIunits= true;
_zombies = _basis nearEntities ["zZombie_Base",50];
_count = count _zombies;
for "_i" from 0 to (_count -1) do
{
_zombie = _zombies select _i;
deletevehicle _zombie;
};
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;
};
};
Like with Sarge AI, if I'm remembering correctly I believe it would be if (_x getVariable "Sarge" == 1) then { deletevehicle _x;}...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
added to script settingsCode:private ...... ,"AGN_safeZone_Players_RemoveAIunits"];
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:AGN_safeZone_Players_RemoveAIunits= true;
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)
i think thats it anything else i need to add after that or forgot ?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; }; };
any help on the variable part would be awsome thanks guys!
/*
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.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
Yea I know but he might still check his inbox once in awhile. Worth a shot!hes not supporting it anymore (dzai) but il cross check there if anyone knows i suppose
Maybe try this?hes not supporting it anymore (dzai) but il cross check there if anyone knows i suppose
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.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?