-TFP- Bridge.J 18 Posted January 21, 2015 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
jshock 513 Posted January 21, 2015 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
-TFP- Bridge.J 18 Posted January 21, 2015 Nope, still not loading into the helo Share this post Link to post Share on other sites
jshock 513 Posted January 21, 2015 I would try createUnit instead of createVehicle on this line. _temp = createVehicle [_x, getMarkerPos _marker, [], 0, "NONE"]; https://community.bistudio.com/wiki/createUnit_array Share this post Link to post Share on other sites
-TFP- Bridge.J 18 Posted January 21, 2015 Aha, that works! :) So why would createUnit work while createVehicle doesn't? Share this post Link to post Share on other sites
jshock 513 Posted January 21, 2015 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
-TFP- Bridge.J 18 Posted January 21, 2015 Got it, thanks :) Share this post Link to post Share on other sites
zakiechan 11 Posted January 21, 2015 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
jshock 513 Posted January 21, 2015 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
zakiechan 11 Posted January 22, 2015 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
blackout_sti 10 Posted March 13, 2015 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