Forum Jump :

Author Message

Posts: 48

Level: Member

Country: fr
In-game name:

#145502 Posted at 2013-06-15 10:11        
Do you call this script in a single file or is it split into two?
First the errors I can see :
forEach allUnits misses its opening "{"
There is an infinite loop (while{true}) which, in this case, is not what you'd like I guess.
Even if this loop weren't infinite you'd be setting (_bomberGroup = [];) to an empty array each times, you'd better do it only once (before entering the loop).

Now I can think of an easier way to do that just see if it suits your style :)
What I would do is to give a name (in the editor) to each unit that might be a bomber.
Then you'd simply select one of them and give him the package.
Could look like that:
_bomberGroup = [myBomber1, myBomber2, ..., myBomberN];
_rnd = floor(random(count _bomberGroup));
bomber = _bomberGroup select _rnd;
bomber addBackpack "B_AssaultPack_khk";
bomber addMagazine  "DemoCharge_Remote_Mag";
Where myBomberi are the names you gave to your bombers. Of course you'd have to make sure to call this only once (call it only on the server maybe).