mattxr 9 Posted January 2, 2007 Right, oki someone asked for help and now i got stuck myself so i ask you gurus how is it done? Q: How can i make a ladder appear 2m in front of the player facing his direction, When i Press An Action Called Deploy Ladder? A: Players Init:- Quote[/b] ]player AddAction ["Deploy Ladder","Carry.sqs"] Carry.sqs:- Quote[/b] ][player,lad1] exec "transport.sqs" Transport.sqs:- Quote[/b] ]_carrier = _this select 0 _cargo = _this select 1 endCargoSession = false _x = (getPos _carrier) select 0 _y = (getPos _carrier) select 1 _z = (getPos _carrier) select 2 _dir = getdir _carrier- 160 _posStruct = [(_carrier Select 0) + (sin _dir), (_carrier Select 1) + (cos _dir)] _cargo setPos _posStruct _cargo setdir _dir ? (!endCargoSession) : goto "nochmal" #nochmal exit Now the problem persists in the transport script. and i have a feeling there is some mix up in the code? any help would be great, once i get it so the ladder appears 2m in front of a guy called player i can make it so only he can use the action too. Share this post Link to post Share on other sites
KaRRiLLioN 0 Posted January 2, 2007 The trigonometry looks okay, just from glancing at it, but is it supposed to createVehicle a ladder at some point? And then is the ladder supposed to be static, or will it move around until the player sets it in a spot? Unless I'm missing something, this just does the trig. Share this post Link to post Share on other sites
deanosbeano 0 Posted January 2, 2007 hey matte , try this .should work <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _carrier = _this select 0 _cargo = _this select 1 endCargoSession = false _x = (getpos _carrier select 0) _y = (getpos _carrier select 1) _z = (getpos _carrier select 2) _dir = getdir _carrier _posStruct = [_x + (sin _dir), _y + (cos _dir),0] _cargo setPos _posStruct _cargo setdir _dir ? (!endCargoSession) : goto "nochmal" #nochmal exit your old one set it behind the player too ,,if thats what you intended then add your -160 line. as always i am not into mp scripting , so no gaurantee with using player addaction .and obviously you need a ladder somewhere called lad1 *EDIT i had an age old problem with this when i tested ,because in buildings the bloody roadway/pathway wtv, always returns a height of 0 . anyway i once made a quick fix and it works ok in arma for what i need. i will post here for 2 reasons, one because it may do for someone else and 2 because , theres some clever people out there who may have better solution . <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _carrier = _this select 0 _cargo = _this select 1 endCargoSession = false _x = (getpos _carrier select 0) _y = (getpos _carrier select 1) _z = (getpos _carrier select 2) _dir = getdir _carrier _posStruct = [_x + (sin _dir), _y + (cos _dir),0] _cargo setPos _posStruct _cargo setdir _dir _dist = _carrier distance _cargo ~.1 _dist = _carrier distance _cargo ?(_dist > 1.00117 ) :goto "amend" goto"there" #amend hint "amended" ~.1 _dir = getdir _carrier _posStruct = [_x + (sin _dir), _y + (cos _dir),_dist] _cargo setPos _posStruct _cargo setdir _dir #there ? (!endCargoSession) : goto "nochmal" #nochmal exit basicly although the roadway lod returns an incorrect _z value ,the distance between the 2 objects remains true. so in a test on flat land the object was 1.00116 away from me, so by asking if its greater than 1.00117 (7 to eliminate recuring numbers after 6), we can then get true distance and make that the height to spawn/create the object. it works for me anyway ,lol.the above is not my original script i have merely modded the original one of matts to keep the flow of the topic.remember this is for my object, in order for it to work for yours ,you must find out the magic 1.00116 number on flat ground for your object and then add that to the equation rather than 1.00117 like i have done for mine. Share this post Link to post Share on other sites