sakura_chan 9 Posted August 29, 2007 How the heck can you create a unit in a script and move it into a vehicle that is defined by a local variable? this doesn't work: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _chopper = chopper _pos = getpos _chopper _gear = "sakumh60laddon" createunit [_pos, group player, "this moveincargo [_chopper, 12]"] createvehicle only works if the object being created is a game logic. Any thing else I've tried has failed. If I try this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _chopper = chopper _pos = getpos _chopper _gear = "sakumh60laddon" createunit [_pos, group player, "this moveincargo [chopper, 12]"] it works, but I need to be able to have each chopper execute the script, I can't have each unit using a specific name. This seems like a huge bug to me. Any help? This is the last hurdle I need to overcome before my MH-60L is done. Share this post Link to post Share on other sites
malick 0 Posted August 29, 2007 I think that the init field of a unit is global space and does not take local variable (_chopper). It should work with this (untested) : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_chopper = chopper _pos = getpos _chopper _gear = "sakumh60laddon" createunit [_pos, group player, ""] _gear moveincargo [_chopper, 12] Tell me ! Hope this helps. Malick Share this post Link to post Share on other sites
weedomatic 0 Posted August 29, 2007 a) Why not pass the vehicle as an arg to the script? b) Did you declare chopper, i.e. in the init.sqf|-s if you're within a mission-context? Edit: Meant declared, not initialized. Share this post Link to post Share on other sites
sakura_chan 9 Posted August 30, 2007 Thanks guys, I got something to work.The problem seems to be that when you createunit a unit: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_gear = "sakumh60laddon" createunit [_pos, group player, ""]; when you call _gear again later on, it doesn't really call the unit, its some wierd shit where you can only do certain things with it. I don't know. This is what I had to do to get it to work: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_chopper = _this; _pos = getpos _chopper; _mh60group = createGroup west; _gear = "sakumh60laddon" createunit [_pos, _mh60group, ""]; ((units _mh60group) select 0) moveincargo [_chopper, 12]; exit; Share this post Link to post Share on other sites