simicsko 4 Posted January 31, 2022 Hi guys! I spawned infantry group with Spawn_RedSquad1.sqf script: _REDSquad1 = [getMarkerPos _spawnMarker,East, (ConfigFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad")] call BIS_fnc_spawnGroup; How can i set the VariableName of this group in the script that will make it identifiable in a trigger? Share this post Link to post Share on other sites
Harzach 2518 Posted January 31, 2022 Use a global variable: REDSquad1 = [getMarkerPos _spawnMarker, East, (ConfigFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad")] call BIS_fnc_spawnGroup; 2 Share this post Link to post Share on other sites
_foley 192 Posted January 31, 2022 As Harzach pointed out, you need to use a global variable (without the _). Be careful when using it in trigger, as it will throw an error if the trigger is created before the variable is defined. If that's the case, you'll need to first check if the variable is defined (isNil). 2 Share this post Link to post Share on other sites
simicsko 4 Posted January 31, 2022 43 minutes ago, Harzach said: Use a global variable: REDSquad1 = [getMarkerPos _spawnMarker, East, (ConfigFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad")] call BIS_fnc_spawnGroup; Thanks bro. Its work. Another question is: how can I detect this group when it enters a trigger zone? Share this post Link to post Share on other sites
simicsko 4 Posted January 31, 2022 40 minutes ago, _foley said: As Harzach pointed out, you need to use a global variable (without the _). Be careful when using it in trigger, as it will throw an error if the trigger is created before the variable is defined. If that's the case, you'll need to first check if the variable is defined (isNil). Thank you. The triggers are currently static, the group is coming to play during the game. i don't judge yet how can I detect this group when it enters a trigger zone? Share this post Link to post Share on other sites
_foley 192 Posted January 31, 2022 One way to achieve this is to give the trigger a global variable name instead. Then you can do this in your spawn script (assuming that your trigger is assigned to myAreaTrigger) _REDSquad1 = [getMarkerPos _spawnMarker,East, (ConfigFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad")] call BIS_fnc_spawnGroup; _REDSquad1 spawn { waitUntil { sleep 1; (leader _this) inArea myAreaTrigger; }; // Your "on activation" code goes here // _this refers to the spawned group }; 2 Share this post Link to post Share on other sites
simicsko 4 Posted January 31, 2022 1 hour ago, _foley said: One way to achieve this is to give the trigger a global variable name instead. Then you can do this in your spawn script (assuming that your trigger is assigned to myAreaTrigger) _REDSquad1 = [getMarkerPos _spawnMarker,East, (ConfigFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad")] call BIS_fnc_spawnGroup; _REDSquad1 spawn { waitUntil { sleep 1; (leader _this) inArea myAreaTrigger; }; // Your "on activation" code goes here // _this refers to the spawned group }; How to define this group leader for a trigger condition in the editor? Update: Found it: leader REDSquad1 inArea thisTrigger Harzach and Foley, thank you very much for your help! 😉 2 Share this post Link to post Share on other sites