Forum Jump :

Author Message


Posts: 131
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 25
In-game name: Joshua

 
#1 Posted at 2015-03-07 06:05        
     
I have a mission where I want a random amount of FIA to spawn in random locations in a building. Each location has a unitPos ("UP","MIDDLE","DOWN") and direction associated with it in an array. Segment from array:
[
   [[14599.5,16767.7,5.12644],"UP",134.014],
   [[14602.3,16771.5,5.12644],"UP",127.904],
   [[14598.2,16777.9,5.12644],"MIDDLE",222.565],
   [[14599.7,16773.4,5.12644],"MIDDLE",262.311],
   [[14595.5,16769.1,5.12644],"MIDDLE",314.406],
   [[14593.3,16775.1,5.12644],"UP",45.3134],
   [[14597,16778.9,2.52644],"MIDDLE",228.042]
]

So I use the location and direction in my BIS_fnc_spawnGroup call.
_unit = [_temp select 0, WEST, ["B_G_Soldier_lite_F"],[],[],[],[],[],(_temp select 2)] call BIS_fnc_spawnGroup;
with _temp being my temporary variable for the data (location, stance, direction).
Then I have to do this, which isn't working:

{
   _x setUnitPos str(_temp select 1);
   hint str(unitPos _x);
}forEach units _unit;
The hint returns "AUTO" which is the default setting if you haven't setUnitPos.
When I manually tell it a stance (i.e. "MIDDLE") it works properly, but I need the different stances for each location, so I can do it dynamically.
I have also tested with:
hint str(_temp select 1);
And it returns the proper stance.

I think there is some sort of type issue going on, but I can't seem to figure it out.

Let me know if you need any more information.


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 61
In-game name: Kobayashi Maru

 
#2 Posted at 2015-03-07 08:04        
     
Why did you add str? {_x setUnitPos (_temp select 1)} foreach units _unit should work.
By the way your hint will return the last one. You need to add an array if you want all the stances. something like _array = [] (initial variable)
then _array pushback (unitpos _x) in your each loop,
and finally: hint format ["all guys pos: %1", _array]; after the loop.

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Advertisement


Author Message


Posts: 131
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 25
In-game name: Joshua

 
#3 Posted at 2015-03-07 13:49        
     
Wow, that was simple. I was pretty sure I had already tried that earlier, but I gave it a shot just to double check and that did the trick. I bet it was the parenthesis. I am pretty sure I didn't have them before.

Thanks for the help once again Pierre MGI!