Lucky44 13 Posted December 2, 2012 I'm trying to name a vehicle that I'm creating with BIS_fnc_SpawnVehicle, and it's not working. Can anyone improve on this (non-working) approach? _TestHelo1 = [getMarkerPos "mrk_WP1", 20, "LIN_UH1", _airSquad1] call BIS_fnc_spawnvehicle; Share this post Link to post Share on other sites
buliwyf 4 Posted December 2, 2012 _TestHelo1 = [getMarkerPos "mrk_WP1", 20, "LIN_UH1", _airSquad1] call BIS_fnc_spawnvehicle; _TestHelo1 setVehicleVarName "YourVehicleName"; ;) Share this post Link to post Share on other sites
cuel 25 Posted December 2, 2012 BIS_fnc_spawnVehicle returns an array :) Array - 0: created vehicle (Object), 1: all crew (Array of Objects), 2: vehicle's group (Group) So; _TestHelo1 = [getMarkerPos "mrk_WP1", 20, "LIN_UH1", _airSquad1] call BIS_fnc_spawnvehicle; (_TestHelo1 select 0) setVehicleVarName "YourVehicleName"; Share this post Link to post Share on other sites
Lucky44 13 Posted December 2, 2012 Thanks, Buliwyf. I tried it like this: _testHelo1 = [getMarkerPos "mrk_WPtest0", 20, "LIN_UH1", _airSquad1] call bis_fnc_spawnvehicle; _testHelo1 setVehicleVarName "Helo98"; And got an error about "type array, expected object". -I don't see what is coming up as an array there. Share this post Link to post Share on other sites
Lucky44 13 Posted December 2, 2012 Thanks, Cuel. But I'm still getting a (different) problem. Here's my code now: _testHelo1 = [getMarkerPos "mrk_WPtest0", 10, "LIN_UH1", _airSquad1] call bis_fnc_spawnvehicle; (_testHelo1 select 0) setVehicleVarName "Helo98"; . . . //move each group member into Helo for "_x" from 0 to 4 do { sleep 0.2; (units _heloTroop1 select _x) moveInCargo Helo98; }; The problem comes when I try to refer to helo98. I get a "undefined variable" error. Why would that be??? Share this post Link to post Share on other sites
nimrod_z 8 Posted December 2, 2012 how about _ch select 0 setVehicleInit "transporthelo = this; this setVehicleVarName ""transporthelo"""; processInitCommands; and here is a link to a helo transport script script with that in it for u to check out. should take care of your issue. http://www.kylania.com/ex/?p=47 Share this post Link to post Share on other sites
Lucky44 13 Posted December 2, 2012 I found a little more info, but it's even more confusing now! If I output the value of Helo98 (like Hint Format ["Helo98 is now %1",Helo98] ), it shows up as having a value of "to Helo98". -Yes, with the "to" in there! I've never seen anything like that! Now I'm really confused! Share this post Link to post Share on other sites
twirly 11 Posted December 2, 2012 (edited) Try it like this....no need for setvehiclevarname! ... also don't use "_x" in a for statement it's reserved for the foreach statement. Use "_i", "_j", "_k" etc. instead (standard programming practice). //create the helo _testHelo1 = [getMarkerPos "mrk_WPtest0", 10, "LIN_UH1", west] call bis_fnc_spawnvehicle; Helo98 = _testHelo1 select 0; //move each group member into Helo for "_i" from 0 to (count units _heloTroop1)-1 do { _unit = (units _heloTroop1) select _i; _unit assignasCargo Helo98; _unit moveInCargo Helo98; sleep 0.2; }; ... another way of moving in the troops using foreach... {_x assignascargo Helo98; _x moveincargo Helo98} foreach units _heloTroop1; Edited December 2, 2012 by twirly Clarity & Correction Share this post Link to post Share on other sites
Lucky44 13 Posted December 2, 2012 Sigh. -Thanks, twirly. That's awesome. I am such a hack programmer. But I keep learning by doing ;) Share this post Link to post Share on other sites
twirly 11 Posted December 2, 2012 No worries man... I had a little error with the _heloTroop1 variable... calling it _helogroup in one line! It's been fixed. Share this post Link to post Share on other sites