TheBOOMStick 0 Posted December 22, 2017 I'm currently tring to set up a mission where a player activates an action witch activates a trigger that spawns units in a group. I have done the addAction and it looks like this: this addAction ["Spawn INF", {(_this select 0) setVariable ["GERinf", 2, true];}]; and the condition of the trigger: ((InfTrigGER getVariable ["GERinf", 0]) == 2) But i have trouble with spawning the units. So far i have done this: _group105=createGroup west; _unit2=_group105 createUnit ["fow_s_ger_heer_rifleman", getMarkerPos "GERinfspawn", [], 4, "FORM"]; I'm trying not to use an outside script and basicly only do it from the ingame init. If someone can help that would be awesome :) Share this post Link to post Share on other sites
AZCoder 921 Posted December 22, 2017 Is that last part inside the trigger? If so you need to spawn it because _group105 is a local var, or you can use global vars instead. [] spawn { _group105=createGroup west; _unit2=_group105 createUnit ["fow_s_ger_heer_rifleman", getMarkerPos "GERinfspawn", [], 4, "FORM"]; }; Share this post Link to post Share on other sites
Larrow 2801 Posted December 23, 2017 19 hours ago, TheBOOMStick said: player activates an action witch activates a trigger that spawns units in a group Is there any reason you are using a trigger? Just cut out the middle man and use the action to spawn the units. this addAction ["Spawn INF", { _unit2 = createGroup west createUnit ["fow_s_ger_heer_rifleman", getMarkerPos "GERinfspawn", [], 4, "FORM"]; }]; 8 hours ago, AZCoder said: Is that last part inside the trigger? If so you need to spawn it because _group105 is a local var, or you can use global vars instead. This makes no sense, local vars are allowed inside the code of a trigger, as long as the reference to the group/unit is not needed else where everything would be fine. Share this post Link to post Share on other sites
code34 248 Posted December 23, 2017 Hi, Don't forget to manage locality with your trigger in MP, if you dont want to have an army of clone. Share this post Link to post Share on other sites
AZCoder 921 Posted December 23, 2017 @Larrow Local variables were never able to function within triggers ... until recently it appears. They used to always pop up the error "Local Variable in Global Space". The fix has been to spawn the code. I can now test and verify spawning is longer required in Arma 3 triggers, but it had been. I wonder when this changed. I can see a post just 11 months ago with the problem described. 1 Share this post Link to post Share on other sites