mattxr 9 Posted May 15, 2005 script help ok there something wrong in this part om my script could anyone tell me what it is? _pos = _this _x = _pos select 0 _y = _pos select 1 ~1 _land = "HeliHEmpty" createvehicle [_x,_y] Share this post Link to post Share on other sites
xela89 0 Posted May 15, 2005 _land = "HeliHEmpty" createvehicle [_x,_y,0] ? Share this post Link to post Share on other sites
mattxr 9 Posted May 15, 2005 na never worked lol Also does anyone know where i can get a script which causes 0.4 dammage for 500m for a bomb script? Share this post Link to post Share on other sites
Jimboob 0 Posted May 15, 2005 Try asking at ofpec.com im sure someone will know there. Share this post Link to post Share on other sites
DBR_ONIX 0 Posted May 15, 2005 Yeh,you need the last array bit <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _object = _this select 0 _pos = getpos _object _x = _pos select 0 _y = _pos select 1 _z = _pos select 2 ~1 _land = "HeliHEmpty" createvehicle [_x,_y,_z] That will make a heli at the position of the object that's called at.. (like a game logic) - Ben Share this post Link to post Share on other sites
sanctuary 19 Posted May 15, 2005 And how do you call this script ? It can be an error of synthax in the way you exec the script too. Share this post Link to post Share on other sites
hardrock 1 Posted May 16, 2005 The last example would be called with <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[object] exec "script.sqs" (note the "_this select 0" -> gotta be an array) Share this post Link to post Share on other sites
mattxr 9 Posted May 16, 2005 thx.. also is this script right? _w="M60" createvehicle getpos player _drv="SoldierWCrew" createunit getpos _w _drv2="SoldierWCrew" createunit getpos _w _drv3="SoldierWCrew" createunit getpos _w _drv moveindriver _w _drv2 moveinGunner _w _drv3 moveinCommander _w _w domove setpos base1 Share this post Link to post Share on other sites
hardrock 1 Posted May 16, 2005 Replace createUnit with createVehicle as well as setPos with getPos (in the last line) and it should work. Share this post Link to post Share on other sites
klavan 0 Posted May 16, 2005 First off the move command is wrong: change <<_X domove setpos base1>> to <<_X domove getmarkerpos "base1">> (if base1 is a marker) or <<_X domove getpos base1>> (if base1 it's an object). Secondary: you cannot issue a domove command to an empty object: change _w with _drv and maybe change the domove command with commandmove. Hope this help. Share this post Link to post Share on other sites
klavan 0 Posted May 16, 2005 Extracted from OFPEC dungeons about createunit: The Group parameter MUST be an existing group or the unit won't be created. Another example: "SoldierWB" createUnit [getMarkerPos "marker_1", groupAlpha, "loon1 = this; this addweapon {binocular}", 0.6, "corporal"] If you use createUnit to create too many units at once, they may stand frozen in place for a while regardless of commands. Put a delay between createUnit commands; try ~1 for starters. Share this post Link to post Share on other sites
Big Dawg KS 6 Posted May 17, 2005 thx..also is this script right? _w="M60" createvehicle getpos player _drv="SoldierWCrew" createunit getpos _w _drv2="SoldierWCrew" createunit getpos _w _drv3="SoldierWCrew" createunit getpos _w _drv moveindriver _w _drv2 moveinGunner _w _drv3 moveinCommander _w _w domove setpos base1 Also, you cannot assign a local variable to a unit while it is being created. Share this post Link to post Share on other sites
mattxr 9 Posted May 17, 2005 ok i now have 2 scripts.. Quote[/b] ]_w="M60" createVehicle getpos player~1 _drv="SoldierWCrew" createVehicle getpos _w ~1 _drv2="SoldierWCrew" createVehicle getpos _w ~1 _drv3="SoldierWCrew" createVehicle getpos _w ~1 _drv moveindriver _w ~1 _drv2 moveinGunner _w ~1 _drv3 moveinCommander _w ~2 this exec "DoMove.sqs" exit Quote[/b] ]_X domove getmarkerpos "East Base" ~1 _w domove getmarkerpos "East Base" exit ^ that i did not no so i put the 2 in. well the M60 respawns then the men respawn then they are moved somewhere.. i think in the tank.. but the tank still doesnt move? Share this post Link to post Share on other sites
klavan 0 Posted May 17, 2005 Createvehicke command is usefull only for empty vehicles. If you want to create a soldier you must use createunit. In addiction to this: 1) Change the variables from local to global, deleting the <<_>> placed before 'em. 2) Issue the domove command to the driver not to the tank. Share this post Link to post Share on other sites
hardrock 1 Posted May 17, 2005 Also, you cannot assign a local variable to a unit while it is being created. Of course you can. Why don't you do just what I wrote above? May I quote myself: Quote[/b] ]Replace createUnit with createVehicle as well as setPos with getPos (in the last line) and it should work. And if you'd done that, you'd come to that script: Quote[/b] ]_w="M60" createVehicle getPos player_drv="SoldierWCrew" createVehicle getPos _w _drv2="SoldierWCrew" createVehicle getPos _w _drv3="SoldierWCrew" createVehicle getPos _w _drv moveIndriver _w _drv2 moveInGunner _w _drv3 moveInCommander _w _w doMove getPos base1 which should work Share this post Link to post Share on other sites
klavan 0 Posted May 17, 2005 @hardrock Maybe i'm completly wrong, but how can you issue a move command to the "_w" variable (the M60)??? It's only an empty shell the moment it's created.... The driver sholud be the only one who can move the tank after receiving the proper order.... @Matt Rochelle I'm curious to know if you can saw the soldiers you've created with createvehicle.... Edit: Nevermind about createvehicle doubts, it's my fault... Now I know the difference.... Share this post Link to post Share on other sites
Big Dawg KS 6 Posted May 17, 2005 Also, you cannot assign a local variable to a unit while it is being created. Of course you can. Why don't you do just what I wrote above? May I quote myself: Quote[/b] ]Replace createUnit with createVehicle as well as setPos with getPos (in the last line) and it should work. And if you'd done that, you'd come to that script: Quote[/b] ]_w="M60" createVehicle getPos player_drv="SoldierWCrew" createVehicle getPos _w _drv2="SoldierWCrew" createVehicle getPos _w _drv3="SoldierWCrew" createVehicle getPos _w _drv moveIndriver _w _drv2 moveInGunner _w _drv3 moveInCommander _w _w doMove getPos base1 which should work CreatUnit is needed to make AI troops, and I have no idea what CreateVehicle would do if you tried to create a soldier with it . And CreateUnit cannot be "==" ("=") to anything. Try this for best results: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_w="M60" createVehicle (getPos player) ~1 @! Isnull _w "SoldierWCrew" createUnit [(getpos _w),TempGroup, "this moveindriver (nearestobject [this,{M60}]", 0.2, "corporal"] ~0.5 _drv = TempGroup select 1 [_drv] join objnull _drv assignasdriver _w _drv moveindriver _w "SoldierWCrew" createUnit [(getpos _w),TempGroup, "this moveingunner (nearestobject [this,{M60}]", 0.2, "corporal"] ~0.5 _drv2 = TempGroup select 1 [_drv2] join objnull _drv2 assignasgunner _w _drv2 moveingunner _w "SoldierWCrew" createUnit [(getpos _w),TempGroup, "this moveincommander (nearestobject [this,{M60}]", 0.6, "corporal"] ~0.5 _drv3 = TempGroup select 1 [_drv3] join objnull _drv3 assignascommander _w _drv3 moveincommander _w ~0.5 [_drv,_drv2] join _drv3 group _drv3 move (getpos base1) exit Not tested, but should work, and I highly RECOMMEND that you use this, but also, for it to work right, add a unit somewhere stranded on an island or anywhere away from the fighting where he will STAY ALIVE, and add the following line to his init: TempGroup = group this *Note: If this unit dies, the script will not work... Share this post Link to post Share on other sites
hardrock 1 Posted May 17, 2005 And CreateUnit cannot be "==" ("=") to anything. That's correct, there was a misunderstanding at this point. But dammit, you're right, I forgot that createUnit is used to create living men, not createVehicle my bad... But there are still some errors in you're script, I fixed it a bit <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_w="M60" createVehicle (getPos player) ~.2 @! Isnull _w "SoldierWCrew" createUnit [(getpos _w),TempGroup, "this moveindriver (nearestobject [this,{M60}])", 0.2, "corporal"] hint format ["%1",TempGroup] ~.2 _drv = (units TempGroup) select 1 [_drv] join objnull _drv assignasdriver _w _drv moveindriver _w "SoldierWCrew" createUnit [(getpos _w),TempGroup, "this moveingunner (nearestobject [this,{M60}])", 0.2, "corporal"] ~.2 _drv2 = (units TempGroup) select 1 [_drv2] join objnull _drv2 assignasgunner _w _drv2 moveingunner _w "SoldierWCrew" createUnit [(getpos _w),TempGroup, "this moveincommander (nearestobject [this,{M60}])", 0.6, "corporal"] ~.2 _drv3 = (units TempGroup) select 1 [_drv3] join objnull _drv3 assignascommander _w _drv3 moveincommander _w ~.2 [_drv,_drv2] join _drv3 group _drv3 move (getpos base1) exit Works now. Share this post Link to post Share on other sites
mattxr 9 Posted May 17, 2005 thanks guys ill test asap.. Share this post Link to post Share on other sites
honchoblack 2 Posted May 17, 2005 KyleSarnik - may i propose a little addition to what you wrote, since the player will get in trouble if the unit that defines the "TempGroup" will die, the unit only has to be present on the map at the start of the mission, then it can be deleted, sparing the player/mission maker the trouble of keeping the unit alive at the stranded units init field at this additional to what your wrote (the unit doesnt have to have a name) TempGroup = group this;deletevehicle this Share this post Link to post Share on other sites