Jump to content
Sign in to follow this  
-TFP- Bridge.J

Not sure if I'm an idiot, but why isn't this working?

Recommended Posts

So basically, I'm trying to spawn some units and load them into a helicopter that is also being spawned.

Here's what I've got:

_requested = _this select 0;
_marker = _this select 1;
_htype = "";

_count = count _requested;

if (_count <= 6) then {

_htype = "B_Heli_Light_01_F";

};

_helicopter = [getMarkerPos _marker, markerDir _marker, _htype, WEST] call bis_fnc_spawnvehicle;

{ 

_temp = createVehicle [_x, getMarkerPos _marker, [], 0, "NONE"];
_temp moveInCargo _helicopter;
sleep 0.5;


} forEach _requested;

So, everyone spawns correctly BUT they refused to moveInCargo. I've tried quite a few different combinations, but nothing seems to work.

Any ideas? I'm probably missing something that I should see. (this is what happens when you script after working all day :( )

EDIT: By the way, this is how the script is called:

nul = [["B_Soldier_F","B_Soldier_F"],"marker1"] execVM "reinforcements.sqf";

Share this post


Link to post
Share on other sites

BIS_fnc_spawnVehicle returns an array:

0: created vehicle (Object), 1: all crew (Array of Objects), 2: vehicle's group (Group)

So try:

_temp moveInCargo (_helicopter select 0);

Share this post


Link to post
Share on other sites

Because a vehicle is just an "empty object" in a way at least, and a unit gets FSMs (how AI stuff works) applied so it's a physical being. What you were trying to do in abstract was like moving an empty tank in the backseat cargo of a chopper :p.

Share this post


Link to post
Share on other sites

Use assignAsCargo first, otherwise they wont get the option to move there.

See the link above, for definition and a bit more of an explanation.

_requested = _this select 0; 
_marker = _this select 1; 
_htype = ""; 

_count = count _requested; 

if (_count <= 6) then { 

   _htype = "B_Heli_Light_01_F"; 

}; 

_helicopter = [getMarkerPos _marker, markerDir _marker, _htype, WEST] call bis_fnc_spawnvehicle; 

{  

   _temp = createVehicle [_x, getMarkerPos _marker, [], 0, "NONE"]; 
   _temp assignAsCargo _helicopter; // <---- This is the line that was missing  :-)
   _temp moveInCargo _helicopter; 
   sleep 0.5; 


} forEach _requested;  

Share this post


Link to post
Share on other sites
Use assignAsCargo first, otherwise they wont get the option to move there.

See the link above, for definition and a bit more of an explanation.

_requested = _this select 0; 
_marker = _this select 1; 
_htype = ""; 

_count = count _requested; 

if (_count <= 6) then { 

   _htype = "B_Heli_Light_01_F"; 

}; 

_helicopter = [getMarkerPos _marker, markerDir _marker, _htype, WEST] call bis_fnc_spawnvehicle; 

{  

   _temp = createVehicle [_x, getMarkerPos _marker, [], 0, "NONE"]; 
   _temp assignAsCargo _helicopter; // <---- This is the line that was missing  :-)
   _temp moveInCargo _helicopter; 
   sleep 0.5; 


} forEach _requested;  

It still won't work as you have it because "_helicopter" is an array of data as I said.

Share this post


Link to post
Share on other sites
It still won't work as you have it because "_helicopter" is an array of data as I said.

You're completely right, I mistakenly overlooked it when I made my post

Share this post


Link to post
Share on other sites

I had this same issue (kind of). I didn't realize I had to send them one at a time... I assumed the game would queue them up automatically. If you tell them all to get in at once, they don't do anything...

+1 on the "createUnit". 100% necessary!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×