kvntvan 13 Posted August 13, 2020 Hello, I'm using a script to give my players an addaction that builds a small camp, however I'm having trouble with the objects spawning in the ground instead of at terrain height. I figured out how to make it conform to the terrains slope yet have not been able to figure out how to spawn it matching the terrains height. I've used several combinations of several commands like setposatl/getposatl/getterrainheightasl/setposworld/getposworld etc etc but have failed to produce anything that works. private["_objType","_objName","_unit","_unitName","_unitDir","_unitPos","_spawnTime","_spawnDistance","_action"]; _unit = _this select 0; _action = _this select 2; _unit removeAction _action; _objType = "Land_TentA_F"; _unitName = name _unit; _unitDir = direction _unit; _unitPos = position _unit; //Wait time till object is spawned, set 0 for instant _spawnTime = 5; _spawnDist = 6; obj1 = _objType createVehicle [0,0,0]; _unit playMove "AinvPknlMstpSnonWnonDnon_medicUp3"; sleep _spawnTime; obj1 setpos (_unit modelToWorld [0,_SpawnDist,0]); obj1 setdir (getdir player); obj1 setPosATL (getPosATL obj1); camp1 = obj1 addAction ["<t color=""#F8FF24"">" +format["Pack Up Camp"],"Camp_Script\pack.sqf"]; Theres part of the code I'm using, it all works perfectly until that second to last line where I try to set the object to terrain height. Does anyone know the proper scripting command I should be using to pull this off? Share this post Link to post Share on other sites
Joe98 91 Posted August 13, 2020 Click on the item and drag the item up or down. OR: Click on the item and note the properties. An item is placed in 3 dimensions: North-South East-West Up-Down. Change the number in the Up-Down dimension. Share this post Link to post Share on other sites
Sgt. Dennenboom 98 Posted August 13, 2020 Maybe try replacing this: obj1 setpos (_unit modelToWorld [0,_SpawnDist,0]); obj1 setdir (getdir player); obj1 setPosATL (getPosATL obj1); With this: obj1 setDir getDir player; obj1 setPos (player getRelPos [_SpawnDist,0]); Share this post Link to post Share on other sites
pierremgi 4822 Posted August 14, 2020 obj1 = _objType createVehicle [0,0,0]; _unit playMove "AinvPknlMstpSnonWnonDnon_medicUp3"; sleep _spawnTime; obj1 setpos (_unit getpos [_SpawnDist,getdir player]); obj1 setVehiclePosition [getpos obj1,[],0,"none"]; obj1 setdir getdir player; obj1 setVectorUp surfaceNormal getpos obj1; 1 Share this post Link to post Share on other sites
kvntvan 13 Posted August 14, 2020 1 hour ago, pierremgi said: obj1 = _objType createVehicle [0,0,0]; _unit playMove "AinvPknlMstpSnonWnonDnon_medicUp3"; sleep _spawnTime; obj1 setpos (_unit getpos [_SpawnDist,getdir player]); obj1 setVehiclePosition [getpos obj1,[],0,"none"]; obj1 setdir getdir player; obj1 setVectorUp surfaceNormal getpos obj1; thank you! obj1 setVehiclePosition [getpos obj1,[],0,"none"]; did the trick but i had to change none to "Can_Collide" 1 Share this post Link to post Share on other sites