spamurai 3 Posted April 10, 2008 I have discovered the createVehicle command. However, I have some question about whats going on. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">unitName = createVehicle ["Type", "Position", "Marker", "Placement Radius", "Special"]; After experimenting a bit, I've figured out what's mostly going on inside the command, but... inside the arrary is the "Position" detailed in [x,y,z] form... however, no matter what I set the height too (z), the new vehicle is always on the ground at 0m. Is "z" redundent? If I fail to include Z element in the array, a script error complains of the array expecting 3 elements, but found only 2. If I set the "Special" to FLY for a helicopter (for example), it starts in the air, with engine running, but not at the specified height. The second mystery, is "Marker"... I could not figure out what significance this has... it has to be a string, but if I enter in a Marker name... no errors are reported, but the vehicle does not appear...? If I leave it at [] the vehicle appears in it's "Position" and adjusted by it's "Placement Radius". Share this post Link to post Share on other sites
poweruser 10 Posted April 10, 2008 Quote[/b] ]I have discovered the createVehicle command. Congrats! Great command, isnt it? Â Quote[/b] ]however, no matter what I set the height too (z), the new vehicle is always on the ground at 0m. simply run a setPos command after creating the object: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _myunit = createVehicle ["M1Abrams", getPos player, [], 0, "NONE"]; _myunit setPos ((getPos _myunit) set [2, 100]); Â Â // second value in the array is the height Quote[/b] ]If I set the "Special" to FLY for a helicopter (for example), it starts in the air, with engine running, but not at the specified height. run a flyInHeight after creating the chopper Btw, check this link: The OFPEC COMREF Share this post Link to post Share on other sites
spamurai 3 Posted April 10, 2008 The, <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _myunit setPos ((getPos _myunit) set [2, 300]); doesn't work. However, <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_myUnit setPos [_spawnX, _spawnY, 300]; works great Thanks I still do not know the significance of the "Marker" element in the array though :/ Also... I seem to be having trouble spawning crew into the newly created vehicle... I spawn crew... but not in the vehicle. Share this post Link to post Share on other sites
poweruser 10 Posted April 10, 2008 Quote[/b] ]Also... I seem to be having trouble spawning crew into the newly created vehicle... I spawn crew... but not in the vehicle. That's what the moveInDriver, moveInGunner, moveInCommander, moveInCargo and moveInTurret commands are for. Once again run them after creating the crew unit. Share this post Link to post Share on other sites
spamurai 3 Posted April 10, 2008 Quote[/b] ]Also... I seem to be having trouble spawning crew into the newly created vehicle... I spawn crew... but not in the vehicle. That's what the moveInDriver, moveInGunner, moveInCommander, moveInCargo and moveInTurret commands are for. Once again run them after creating the crew unit. I'm trying too, and the pilot spawns in... but he's outside the helicopter... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_pilot = objNull; _helo = objNull; _target = getMarkerPos "helotarget"; _spawnpoint = getMarkerPos "helospawn"; _spawnX = getMarkerPos "helospawn" select 0; _spawnY = getMarkerPos "helospawn" select 1; _westGroup = createGroup West; _helo = createVehicle ["UH60MG",_spawnpoint,[], 0, "FLY"]; _helo setPos [_spawnX, _spawnY, 150]; _pilot = "SoldierWPilot" createUnit [_spawnpoint, _westGroup]; _pilot assignAsDriver _helo; _pilot moveInDriver _helo; Share this post Link to post Share on other sites
spamurai 3 Posted April 10, 2008 I did it! YAHOO! <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_target = getMarkerPos "helotarget"; _spawnpoint = getMarkerPos "helospawn"; _spawnX = getMarkerPos "helospawn" select 0; _spawnY = getMarkerPos "helospawn" select 1; _westGroup = createGroup West; _helo = createVehicle ["UH60MG",_spawnpoint,[], 0, "FLY"]; _helo setPos [_spawnX, _spawnY, 150]; _pilot = _westGroup createUnit ["SoldierWPilot",_spawnpoint,[], 0, "NONE"]; _pilot moveInDriver _helo; _pilot assignAsdriver _helo; Share this post Link to post Share on other sites