dreadedentity 278 Posted August 29, 2014 (edited) Hello all, I am beginning to experiment with more high-level scripting commands, to make the missions I create for my group much better, but I've hit a snag while trying to spawn some units after certain conditions have been met by one of my players. Here are the documentation's for call, compile, and format. I feel that the explanations are more convoluted than they need to be. Anyway, I'm just wondering if this code: { call compile format["group%1 = createGroup west;", (_x + 1)] } forEach [1, 2, 3, 4, 5] will create 5 empty BLUFOR groups, named, group1, group2, group3, group4, and group5. Thanks. EDIT: And can also be used for variables. So if I changed that to be something like: { call compile format["var%1 = (_x + 1);", (_x + 1)] } forEach [1, 2, 3, 4, 5] Then will I now have 5 variables named var1, var2, var3, var4, and var5 that I can use in other code? Thanks again. Edited August 29, 2014 by DreadedEntity Share this post Link to post Share on other sites
Larrow 2822 Posted August 30, 2014 As you have written it there you will get Group2 to Group6 as you are taking the value of _x and adding 1 to it. Otherwise yes you are correct. But using MissionNameSpace is a better option to Call Compile and is less resource heavy (As you are not making the engine compile and then call code, you are just injecting the value straight into the global variable ). As you are basically filling in global variables these are kept in the mission namespace so... { missionNamespace setVariable [ format["group%1",_x], createGroup west]; } forEach [1, 2, 3, 4, 5]; and { missionNamespace setVariable [ format["var%1", _x], (_x + 1)]; } forEach [1, 2, 3, 4, 5]; Share this post Link to post Share on other sites
dreadedentity 278 Posted August 30, 2014 (edited) Thanks for the reply As you have written it there you will get Group2 to Group6 Haha thanks, not sure what was going through my mind. I thought I had to use the array index for some reason, so that's why I added 1 to it. I'm having a little trouble with a mission I'm making using call compile format (will change it to missionNamespace setVariable in a bit), but I don't want to start a new thread for it. { call compile format["[[15500 + (_x * 100), 14000 + (_x * 100), 100], 315, ""B_Heli_Attack_01_F"", aiHeli%1] call bis_fnc_spawnvehicle;", _x]; } forEach [1, 2, 3, 4, 5, 6]; { call compile format ["aiHeli%1 move (getPos OPtank%1);", _x]; } forEach [1, 2, 3, 4]; aiHeli5 move (getPos OPheli1); aiHeli6 move (getPos OPheli1); The Blackfoot's spawn fine, but they don't move to the enemy units! They prefer to stay right where they spawned and fire guided rockets from there. It's just not going to be a proper invasion if blufor doesn't flex their muscles a bit. How can I force them to move closer to their targets before firing? Edited August 30, 2014 by DreadedEntity Share this post Link to post Share on other sites