Static AI is not despawning

Silver85

Member
Hello,

i have installed the newest version of DZAI.
I have some custom static units in Otmel but for some reason the units will not despawn after the despawnwaittime.
I checked it with debug mode and got this:

Code:
21:24:59 "DZAI Extended Debug: Trigger SAR_marker_DEBUG_camp3 Group Array: [O 1-2-H]. isCleaning: false. In static trigger array: false"
21:24:59 "DZAI Extended Debug: Trigger SAR_marker_DEBUG_camp3 has a despawn script already running. Exiting despawn script."
21:24:59 "DZAI Extended Debug: Trigger SAR_marker_DEBUG_camp2 Group Array: [O 1-2-D]. isCleaning: false. In static trigger array: false"
21:24:59 "DZAI Extended Debug: Trigger SAR_marker_DEBUG_camp2 has a despawn script already running. Exiting despawn script."
21:25:02 "DZAI Extended Debug: Trigger SAR_marker_DEBUG_camp1 Group Array: [O 1-2-C]. isCleaning: false. In static trigger array: false"
21:25:02 "DZAI Extended Debug: Trigger SAR_marker_DEBUG_camp1 has a despawn script already running. Exiting despawn script."
21:25:04 "DZAI Extended Debug: Trigger SAR_marker_DEBUG_camp5 Group Array: [O 1-2-F]. isCleaning: false. In static trigger array: false"
21:25:04 "DZAI Extended Debug: Trigger SAR_marker_DEBUG_camp5 has a despawn script already running. Exiting despawn script."
21:25:08 "DZAI Extended Debug: Trigger SAR_marker_DEBUG_camp4 Group Array: [O 1-2-E]. isCleaning: false. In static trigger array: false"
21:25:08 "DZAI Extended Debug: Trigger SAR_marker_DEBUG_camp4 has a despawn script already running. Exiting despawn script."
21:25:08 "DZAI Extended Debug: Trigger SAR_marker_DEBUG_camp4 Group Array: [O 1-2-I]. isCleaning: false. In static trigger array: false"
21:25:08 "DZAI Extended Debug: Trigger SAR_marker_DEBUG_camp4 has a despawn script already running. Exiting despawn script."

The normal static spawn markers are working without any trouble.
Dos anyone has an idea?

Thank you.
 
i commented out this line
Code:
//if (!(_trigger in DZAI_staticTriggerArray) or {_isCleaning}) exitWith {if (DZAI_debugLevel > 1) then {diag_log format ["DZAI Extended Debug: Trigger %1 has a despawn script already running. Exiting despawn script.",triggerText _trigger];};};

It works and i hope this causes no side-effects.
 
That will disable prevention of multiple despawn scripts to run for the same spawn, which can have extremely ugly effects for static/dynamic/custom spawns.

Here is the fixed spawnBandits_customs.sqf:

Code:
/*
    spawnBandits_custom
  
    Usage:
  
    Description: DZAI custom spawn function (DZAI_spawn).
  
    Last updated: 6:00 PM 10/24/2013
*/

private ["_patrolDist","_trigger","_grpArray","_triggerPos","_equipType","_weapongrade","_totalAI","_startTime","_tMarker","_unitGroup","_spawnPos","_totalAI"];
if (!isServer) exitWith {};

_startTime = diag_tickTime;

_totalAI = _this select 0;                                  
//_this select 1;
_patrolDist = _this select 2;                              
_trigger = _this select 3;                                  
_weapongrade = _this select 4;
//_spawnMarker = _this select 5;

_grpArray = _trigger getVariable ["GroupArray",[]];  
if (count _grpArray > 0) exitWith {if (DZAI_debugLevel > 0) then {diag_log format ["DZAI Debug: Active groups found at %1. Exiting spawn script (spawnBandits)",(triggerText _trigger)];};};                      

_trigger setTriggerArea [750,750,0,false];
_triggerPos = ASLtoATL getPosASL _trigger;

if (DZAI_debugLevel > 0) then {diag_log format["DZAI Debug: Processed static trigger spawn data in %1 seconds (spawnBandits).",(diag_tickTime - _startTime)];};

_startTime = diag_tickTime;

if !(_trigger getVariable ["respawn",true]) then {
    _maxUnits = _trigger getVariable ["maxUnits",[0,0]];
    _totalAINew = (_maxUnits select 0);
    if (_totalAINew > 0) then {_totalAI = _totalAINew};    //Retrieve AI amount if it was updated from initial value (for non-respawning custom spawns only)
};
_spawnPos = [(ASLtoATL getPosASL _trigger),random (_patrolDist),random(360),false] call SHK_pos;
_unitGroup = [_totalAI,grpNull,_spawnPos,_trigger,_weapongrade] call DZAI_setup_AI;

//Set group variables
_unitGroup setVariable ["unitType","static"];
_unitGroup allowFleeing 0;

if (DZAI_debugLevel > 1) then {diag_log format ["DZAI Extended Debug: Group %1 has group size %2.",_unitGroup,_totalAI];};

if (_patrolDist > 1) then {
    0 = [_unitGroup,_triggerPos,_patrolDist] spawn DZAI_BIN_taskPatrol;
} else {
    [_unitGroup, 0] setWaypointType "HOLD";
    _unitGroup setFormDir (random 360);
};

if (DZAI_debugLevel > 0) then {diag_log format["DZAI Debug: Spawned a group of %1 units in %2 seconds at %3 (spawnBandits).",_totalAI,(diag_tickTime - _startTime),(triggerText _trigger)];};

_equipType = if (_weapongrade in DZAI_weaponGrades) then {(_weapongrade max 0)} else {3};

_triggerStatements = (triggerStatements _trigger);
if (!(_trigger getVariable ["initialized",false])) then {
    0 = [_trigger,[_unitGroup],_patrolDist,_equipType,[],[_totalAI,0]] call DZAI_setTrigVars;
    _trigger setVariable ["triggerStatements",+_triggerStatements];
} else {
    _trigger setVariable ["isCleaning",false];
    _trigger setVariable ["maxUnits",[_totalAI,0]];
    if (DZAI_debugLevel > 1) then {diag_log format ["DZAI Extended Debug: Trigger group array updated to: %1.",_grpArray]};
};
_triggerStatements set [1,""];
_trigger setTriggerStatements _triggerStatements;
_trigger call DZAI_updStaticSpawnCount;

if ((!isNil "DZAI_debugMarkersEnabled") && {DZAI_debugMarkersEnabled}) then {
    _nul = [_trigger] spawn DZAI_updateSpawnMarker;
};

_unitGroup
 
Thank you Buttface, but there is still the same problem. Additionally to this

Code:
 0:22:23 Error in expression <ariable ["bandageAmount",((_weapongrade + 1) min 3)];
_x setVariable ["lastBanda>
0:22:23   Error position: <+ 1) min 3)];
_x setVariable ["lastBanda>
0:22:23   Error Generic error in expression
0:22:23 File z\addons\dayz_server\DZAI\compile\group_manager.sqf, line 32
 
Last edited:
I can't replicate your issue. I've created a custom spawn of my own based on the example spawn in the config files, and this is my log sample:

Code:
19:56:22 "DZAI Debug: Created custom spawn area DZAI_TinCanCustom at 063046 with 2 AI units, weapongrade 1, respawn true."
//Time skip to custom spawn triggering...
20:11:21 "DZAI Debug: Processed static trigger spawn data in 0 seconds (spawnBandits)."
20:11:21 "DZAI Extended Debug: Found spawn position at 14.9066 meters away at position [6403.5,3550.5,0] after 0 retries."
20:11:21 "DZAI Extended Debug: Created loadout for unit O 1-1-G:1 (weapongrade: 1): [G36C_camo,30Rnd_556x45_G36,DZ_British_ACU]."
20:11:21 "DZAI Extended Debug: Spawned AI Type Soldier1_DZ with weapongrade 1 for group O 1-1-G (fnc_createGroup)."
20:11:21 "DZAI Extended Debug: Created loadout for unit O 1-1-G:2 (weapongrade: 1): [M249_m145_EP1_DZE,100Rnd_556x45_M249,DZ_Czech_Vest_Puch]."
20:11:21 "DZAI Extended Debug: Spawned AI Type BanditW2_DZ with weapongrade 1 for group O 1-1-G (fnc_createGroup)."
20:11:21 "DZAI Extended Debug: Group O 1-1-G has group size 2."
20:11:21 "DZAI Debug: Spawned a group of 2 units in 0.0180054 seconds at DZAI_TinCanCustom (spawnBandits)."
20:11:21 "DZAI Extended Debug: Initialized static trigger at DZAI_TinCanCustom. GroupArray: [O 1-1-G], PatrolDist: 100. equipType: 1. LocationArray 0 positions, MaxUnits [2,0]."
20:11:21 "DZAI Debug: Unit O 1-1-G:1 loadout: [["G36C_camo","Strela"],["30Rnd_556x45_G36","Strela"]]. Weapongrade 1. Blood: 10433.2."
20:11:21 "DZAI Debug: Unit O 1-1-G:2 loadout: [["M249_m145_EP1_DZE"],["100Rnd_556x45_M249"]]. Weapongrade 1. Blood: 11844.3."
20:11:37 "DZAI Extended Debug: Trigger DZAI_TinCanCustom Group Array: [O 1-1-G]. isCleaning: false. In static trigger array: true"
20:11:37 "DZAI Extended Debug: No players remain in trigger area at DZAI_TinCanCustom. Deleting 1 AI groups in 120 seconds."
//Time skip to despawn...
20:13:37 "DZAI Extended Debug: Despawned group O 1-1-G with 2 active units."
20:13:37 "DZAI Debug: Despawned AI units at DZAI_TinCanCustom. Reset trigger's group array to: []."

You may want to try a complete re-install of DZAI using the most recent files on Github if you've installed any of the pre-release builds or a previous installation, look over your custom spawn entries, or look earlier in the RPT log if there's another DZAI-related error.

Something else that may cause a similar issue (but is not an actual problem) would be if you've killed off all spawned units and triggered a despawn while the group is still queued for respawning. DZAI won't despawn groups that are waiting to be respawned and will not spawn more groups for that spawn location until the group is despawned, but when the respawn timer is up and DZAI finds that the spawn area is inactive (no players around) then it cancels the respawn and clears the group from the spawn trigger's GroupArray variable. I don't know if this is similar to your situation.
 
My bad buttface,
i replaced spawnbandits.sqf instead of spawnbandits_custom.sqf. Next time i better go to bed when i m tired. All is working great now..thank you very much!
 
Back
Top