sprucewaine 1 Posted July 15, 2018 How would you go about caching units only to be deleted later, but doing it all locally? Ive set up a nice script that populates towns with random patrols, now i just need a way for the patrols to get deleted once the player leaves the area. Spoiler //config enemyFaction = [ (configfile >> "CfgGroups" >> "Indep" >> "IND_C_F"), 1, false ] call BIS_fnc_returnChildren select {inheritsFrom _x isEqualTo (configFile >> "Man")}; publicVariable "enemyFaction"; //variables centerposition = [worldSize / 2, worldsize / 2, 0]; publicVariable "centerposition"; Locations = nearestLocations [centerposition, ["NameVillage","NameCityCapital","NameCity","NameLocal","Airport"], worldSize / 2]; publicVariable "Locations"; trigArea = 2000; publicVariable "trigArea"; //functions HNK_fnc_createInfPatrols = { params ["_trig","_locName","_activation"]; for "_x" from (floor random 2) to 0 step -1 do { _pos = position _trig; _safePos = [_pos, 0, trigArea] call BIS_fnc_findSafePos; _grp = [_safepos, resistance, selectRandom enemyFaction] call BIS_fnc_spawnGroup; _grp deleteGroupWhenEmpty true; myCurator addCuratorEditableObjects [units _grp,true ]; //debug [_grp, getPos leader _grp, 1000] call bis_fnc_taskPatrol; }; }; HNK_fnc_createVehPatrols = { params ["_trig","_locName","_activation"]; for "_x" from (floor random [0,0,1]) to 0 step -1 do { _pos = position _trig; _safePos = [_pos, 0, trigArea] call BIS_fnc_findSafePos; }; }; HNK_fnc_setupTrigger = { params ["_trig","_locName","_activation"]; if (_activation) then { [_trig,_locName,_activation] spawn HNK_fnc_createInfPatrols; } else { }; }; HNK_fnc_createTrigger = { { _pos = position _x; _trg = createTrigger ["EmptyDetector", _pos]; _trg setTriggerArea [trigArea, trigArea, 0, false]; _trg setTriggerActivation ["ANYPLAYER", "PRESENT", true]; _trg setTriggerStatements ["this", "[thisTrigger,_x,true] call HNK_fnc_setupTrigger", "[thisTrigger,_x,false] call HNK_fnc_setupTrigger"]; _m = createMarker [format ["mrk%1",random 100000],_pos]; //debug 5 V _m setMarkerShape "ELLIPSE"; _m setMarkerSize [trigArea,trigArea]; _m setMarkerBrush "Solid"; _m setMarkerAlpha 0.25; _m setMarkerColor "ColorRed"; } forEach Locations; }; //execute [] spawn HNK_fnc_createTrigger; HNK_fnc_createVehPatrols does nothing, thats for later once i figure out how to delete the spawned units. :P Also i ment to type selectRandom instead of floor random. Share this post Link to post Share on other sites
Spatsiba 89 Posted July 15, 2018 Doesn't ArmA 3 have a default version for this now? https://community.bistudio.com/wiki/Arma_3_Dynamic_Simulation Share this post Link to post Share on other sites
sprucewaine 1 Posted July 15, 2018 2 minutes ago, Spatsiba said: Doesn't ArmA 3 have a default version for this now? https://community.bistudio.com/wiki/Arma_3_Dynamic_Simulation I am pretty sure that there is still a group limit attached to that. Its like 288 or something now, bumped from 144..... Share this post Link to post Share on other sites
Spatsiba 89 Posted July 15, 2018 My group used this at one point, I think Share this post Link to post Share on other sites