herecomestheking Posted June 4, 2014 Share Posted June 4, 2014 Hi. My lua knowledge is very limited so please bare with me. I've been trying to get the "moveObject" function to work but so far I have not been successful. I've read this but no matter what I try it just won't work. This is how it looks at the moment. road1 = createObject (3458, 3543.55078125, -1537.4228515625, 498.25500488281, 0, 0, 255) bool moveObject ( object road1, int 2000, float 3543.55078125, float -1537.4228515625, float 502, ) end Basically I want it to create an object at an exact position and then move it to another exact position. Thanks for the help. Link to comment
manve1 Posted June 4, 2014 Share Posted June 4, 2014 road1 = createObject (3458, 3543.55078125, -1537.4228515625, 498.25500488281, 0, 0, 255) moveObject ( road1, 2000, 3543.55078125, -1537.4228515625, 502, ) ^ this would fix your code. road1 = createObject (3458, 3543.55078125, -1537.4228515625, 498.25500488281, 0, 0, 255) setTimer(function moveObject ( road1, 2000, 3543.55078125, -1537.4228515625, 502, ) end, 5000, 1) setTimer(function() local ox,oy,oz = getElementPosition(road1) if ox == 3543.55078125 and oy == -1537.4228515625 and oz == 502 then moveObject(road1, X, Y, Z ) -- replace X,Y,Z end end, 30000, 1 ) ^ this is a rough code, but it would move the object after 5000 mili-seconds to the position you set, and after 30000 mili-seconds the code would see if it is in the place that you put it at and if it returns true then it would move to another place (X,Y,Z) Link to comment
herecomestheking Posted June 4, 2014 Author Share Posted June 4, 2014 Thank you for your reply. I tried that last script but it did not work. I don't believe there is something wrong with the script but when I try this one alone road1 = createObject (3458, 3543.55078125, -1537.4228515625, 498.25500488281, 0, 0, 255) nothing happens. No object was created when I ran my map. I did save the script in the correct folder so I don't know what's wrong. Link to comment
manve1 Posted June 4, 2014 Share Posted June 4, 2014 Can you post your meta.xml file? Link to comment
herecomestheking Posted June 4, 2014 Author Share Posted June 4, 2014 Okay. I fixed my meta.xml file. If I only use the createObject line, the object loads just fine. If I add that script you wrote no object loads. I tried both. The one I wrote that you fixed and then the one you wrote. If you're still interested in my meta.xml file, you can find it here. The name of the script is road1 so that's correct. Link to comment
herecomestheking Posted June 5, 2014 Author Share Posted June 5, 2014 2 errors. http://pastebin.com/TKV3niXa Link to comment
Max+ Posted June 5, 2014 Share Posted June 5, 2014 manve1 Your Code Has , Errors [ Use , mta script editor to See Them , ] herecomestheking - Check this, road1 = createObject (3458, 3543.55078125, -1537.4228515625, 498.25500488281, 0, 0, 255) -- your gate addCommandHandler('close', -- type close to move it , function() -- function moveObject (road1, 2000, 3543.55078125, -1537.4228515625, 502) --- move it end -- close ) -- close Link to comment
herecomestheking Posted June 5, 2014 Author Share Posted June 5, 2014 Max helped me solved this. Thanks. No more input needed. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now