Jump to content
cernia68

how i can delete spawned ai

Recommended Posts

i have a trouble

i spawned ai with this in a trigger

call{_infgrp = [getMarkerPos "SpawnINF", east, ["O_Soldier_SL_F", "O_Soldier_LAT_F","O_Soldier_TL_F", "O_Soldier_M_F","O_medic_F", "O_crew_F", "O_engineer_F", "O_Soldier_A_F"],0] call BIS_fnc_spawnGroup};

 

but i can t delete it if i want ..... only find that is working but delete all opfor in map

trigger 2

{if (side _x == opfor) then {deleteVehicle _x}} forEach allUnits;

Share this post


Link to post
Share on other sites

Use setVariable to store the spawned group somewhere, e.g either missionNamespace or on the trigger, so you then have access to it from the other trigger.

Spoiler

//Trigger 1, spawn group
missionNamespace setVariable[ "TrigGroup", [getMarkerPos "SpawnINF", east, ["O_Soldier_SL_F", "O_Soldier_LAT_F","O_Soldier_TL_F", "O_Soldier_M_F","O_medic_F", "O_crew_F", "O_engineer_F", "O_Soldier_A_F"],0] call BIS_fnc_spawnGroup, true ]

//Trigger 2, delete group
if !( isNil "TrigGroup" ) then {
	{
		deleteVehicle _x;
	}forEach units TrigGroup;
	deleteGroup TrigGroup;
	missionNamespace setVariable[ "TrigGroup", nil, true ];
};

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×