Chance536 3 Posted November 27, 2022 So I have a trigger down in a captured village I'm spawning several groups of infantry and 1 mech inf group. I have it set that upon deactivation it will delete the units as the player leaves the area. It only deletes the units as expected after reading my own code. My issue is that I don't know how to tell it to delete the actual BTR that spawns with them. So whenever they respawn if you reenter the area the old BTR is still sitting empty where the new one spawns resulting in a large explosion and cook off. I'm thinking I just need to tell it to delete the BTR that spawns with it but don't know how. My brain says there should be a thing like forEach vehicle or something. //activation skalkaD1 = [getPosATL stage1marker1, west, (configfile >> "CfgGroups" >> "West" >> "b_afougf" >> "Infantry" >> "b_bafougf_infantry_fireteam")] call BIS_fnc_spawnGroup; [skalkaD1, position leader skalkaD1, 150] call BIS_fnc_taskPatrol; //deactivation { deleteVehicle _x }forEach units skalkaD1; Share this post Link to post Share on other sites
Harzach 2507 Posted November 27, 2022 //deactivation { deleteVehicle vehicle _x } forEach units skalkaD1; { deleteVehicle _x } forEach units skalkaD1; Might be a better way, not sure. 1 Share this post Link to post Share on other sites
Chance536 3 Posted November 28, 2022 So I found a roundabout way of doing what I was trying to do. I dug into the biki and found out that groups don't include vehicles and using my caveman level scripting knowledge I came up with this. {deleteVehicle _x} forEach nearestObjects [position leader skalkaD2, ["all"], 3]; { deleteVehicle _x }forEach units skalkaD2; This could probably be done better but this is what I pieced together using my library of things I've been able to make work in the past. I do need to change the "all" to "car" or "tank" after I figure out what a btr is considered. otherwise it'll probably wander next to some important thing and delete it knowing my luck and arma. Share this post Link to post Share on other sites
Harzach 2507 Posted November 28, 2022 ...or you could just delete the vehicles owned by the group, as I did above. Share this post Link to post Share on other sites
Larrow 2800 Posted November 28, 2022 24 minutes ago, Harzach said: or you could just delete the vehicles owned by the group, As of A3 2.12 you should be able to find this definitively by assignedVehicles. Rather than just vehicles units are in. Also, don't forget to delete the actual group as well. 2 Share this post Link to post Share on other sites
Harzach 2507 Posted November 28, 2022 26 minutes ago, Larrow said: Also, don't forget to delete the actual group as well. Ah, good point. BIS_fnc_spawnGroup (see last comment) doesn't set the autodelete flag. As for assignedVehicles: Quote Description: Returns all vehicles added to the given Group with addVehicle. Will this also include groups spawned by config via BIS_fnc_spawnGroup or similar? I don't currently have the dev build installed, so can't test. Assuming all is well, when 2.12 drops this should work: //activation skalkaD1 = [getPosATL stage1marker1, west, (configfile >> "CfgGroups" >> "West" >> "b_afougf" >> "Infantry" >> "b_bafougf_infantry_fireteam")] call BIS_fnc_spawnGroup; skalkaD1 deleteGroupWhenEmpty true; [skalkaD1, position leader skalkaD1, 150] call BIS_fnc_taskPatrol; //deactivation _vehicles = assignedVehicles skalkaD1; { deleteVehicle _x } forEach _vehicles; { deleteVehicle _x } forEach units skalkaD1; In the meantime, my original suggestion has served me well for about 10 years now. 1 Share this post Link to post Share on other sites
Chance536 3 Posted November 28, 2022 8 hours ago, Harzach said: ...or you could just delete the vehicles owned by the group, as I did above. Thankyou I did get this to work. I tried it last night didn't work, tried again this morning worked great. Was giving me expected type array is type of group last night. Which prompted me to research things and understand them incorrectly. I did learn some new functions and a better understanding of groups and arrays during my research though so it worked out! Share this post Link to post Share on other sites
Harzach 2507 Posted November 28, 2022 49 minutes ago, Chance536 said: expected type array is type of group If you forgot "units" in either line, you would get that error, as the forEach would be trying to iterate through a group instead of the expected array. Share this post Link to post Share on other sites
Larrow 2800 Posted November 29, 2022 21 hours ago, Harzach said: Will this also include groups spawned by config via BIS_fnc_spawnGroup or similar? Hopefully, I have put a comment in the tracker on the assignedVehicles request pointing out that BIS_fnc_spawnGroup needs changes. I also don't have dev installed atm so not sure if they have already fixed it. 1 Share this post Link to post Share on other sites