Lloyd Logan Posted February 15, 2013 Posted February 15, 2013 Hey, the errors of this code are; Attemp to call global findRotation 'a nil value'? local xa, ya, za = getElementPosition(marker1) local xb, yb, zb = getElementPosition(marker2) function walking(walking) setElementRotation(johnny, findRotation(xa, ya, xb, ya)) setPedAnimation( johnny, "ped", "WOMAN_walknorm") end If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
manve1 Posted February 15, 2013 Posted February 15, 2013 you haven't defined findRotation function in first place as my friend used it, he first needed to define it fully like by getting rotation and calculating it Looking for tutorials or information? check out: www.simpleask.co.uk
Lloyd Logan Posted February 15, 2013 Author Posted February 15, 2013 you haven't defined findRotation function in first placeas my friend used it, he first needed to define it fully like by getting rotation and calculating it Define it where? If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
iPrestege Posted February 15, 2013 Posted February 15, 2013 What you mean with "findRotation" you mean getElementRotation ??
Lloyd Logan Posted February 15, 2013 Author Posted February 15, 2013 What you mean with "findRotation" you mean getElementRotation ?? That was mental Castillo that told me that! =D If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
Lloyd Logan Posted February 15, 2013 Author Posted February 15, 2013 I really did not see this . Castillo was right, I need to use findRotation, because i have to find the rotation between to markers! Any suggestions? If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
DNL291 Posted February 15, 2013 Posted February 15, 2013 Where is the findRotation function? Please do not PM me with scripting related question nor support, use the forums instead.
Lloyd Logan Posted February 15, 2013 Author Posted February 15, 2013 Where is the findRotation function? In my script? If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
TAPL Posted February 15, 2013 Posted February 15, 2013 https://wiki.multitheftauto.com/wiki/FindRotation findRotation (Function source) must be inside your script.
Lloyd Logan Posted February 15, 2013 Author Posted February 15, 2013 findRotation (Function source) must be inside your script. What do you mean, is that what i have done in the OP? If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
manve1 Posted February 15, 2013 Posted February 15, 2013 it's a useful function only, so u are missing out this: function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end Looking for tutorials or information? check out: www.simpleask.co.uk
TAPL Posted February 15, 2013 Posted February 15, 2013 function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end local xa, ya, za = getElementPosition(marker1) local xb, yb, zb = getElementPosition(marker2) function walking(walking) setElementRotation(johnny, findRotation(xa, ya, xb, ya)) setPedAnimation( johnny, "ped", "WOMAN_walknorm") end How difficult it is to understand this? Edit: Also setElementRotation required 3 arguments, while findRotation return one argument only.
Castillo Posted February 15, 2013 Posted February 15, 2013 He can just use setPedRotation, which is for this kind of thing. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Lloyd Logan Posted February 15, 2013 Author Posted February 15, 2013 Sorry for my ignorance, but the player is now going in a different direction between the two markers? If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
Castillo Posted February 15, 2013 Posted February 15, 2013 Try setting just the rotation, to see if it rotates right. If that doesn't work, try adding -90 on the rotation. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Lloyd Logan Posted February 15, 2013 Author Posted February 15, 2013 Try setting just the rotation, to see if it rotates right.If that doesn't work, try adding -90 on the rotation. Thanks Castillo! I had to +90 on the rotation! -Lloyd If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
Castillo Posted February 15, 2013 Posted February 15, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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