MasterTobi Posted January 28, 2010 Share Posted January 28, 2010 hey I would like gladly ped scripting. The Ped have to move from an point A to point B then back or to Point C i have script a ***** function function makePed(source) x,y,z = getElementPosition(source) rz = getPedRotation(source) ped1 = createPed(56, 1481,-1739,13) setPedRotation(ped1, 270) x,y,z = getElementPosition(source) circlearea = createColCircle(1537,-1739,5) circlearea1 = createColCircle(1813,-1821,5) circlearea2 = createColCircle(1813,-1859,5) circlearea3 = createColCircle( 1830, -1859,5) setPedAnimation( ped1, "ped", "WOMAN_walknorm") function move(source) if isElementWithinColShape ( ped1, circlearea )then setPedRotation(ped1, 194) end if isElementWithinColShape ( ped1, circlearea1 )then setPedRotation(ped1, 194) end if isElementWithinColShape ( ped1, circlearea2 )then setPedRotation(ped1, 296) end if isElementWithinColShape ( ped1, circlearea3 )then setPedRotation(ped1, 0) end end setTimer(move,1000,0,source,ped1) end addCommandHandler("ped", makePed) but this is really shit have anybody ideas as I can realize that ? mfg Link to comment
dzek (varez) Posted January 28, 2010 Share Posted January 28, 2010 one function in another? i'm not sure if its possible in lua, but i havent tried it. get an MTA Script Editor - its helpful. and put your code on forum in [lua] [/lua] tags Link to comment
50p Posted January 28, 2010 Share Posted January 28, 2010 one function in another? i'm not sure if its possible in lua, but i havent tried it.get an MTA Script Editor - its helpful. and put your code on forum in tags You can have function inside another function but you don't define it the same way you usually do. You do it this way: local myFunc = function() return 1+99 end myFunc() @MasterTobi, what exactly is your problem? I'd advice you to learn some more maths so that you can calculate the rotation for ped instead of having them hardcoded. Link to comment
MasterTobi Posted January 28, 2010 Author Share Posted January 28, 2010 hm thx my prob is : i would like that the ped walk across LS so i need 10000000000 points . therefore I thought it give such a thing in the kind > i have a startpoint and i say the ped, it is to run to the finalpoint Link to comment
50p Posted January 28, 2010 Share Posted January 28, 2010 Also, you should use https://wiki.multitheftauto.com/wiki/SetControlState to make them walk, run, etc. There was a resource similar to what you want to do but it was never released to public due to some problems, it used animations like what you're trying to do but you should use controls, much easier. It had all paths in a few files (or 1, can't remember now). The paths file was as heavy as 5MB. I'm not sure if you can get that resource from somewhere. Link to comment
DakiLLa Posted January 28, 2010 Share Posted January 28, 2010 hmm, does setControlState works aswell for peds as setPedControlState ? Link to comment
50p Posted January 29, 2010 Share Posted January 29, 2010 hmm, does setControlState works aswell for peds as setPedControlState ? I'm not sure about that. Why don't you check? I just posted it because that's the only setting control server side function. If it doesn't work then there is no way to tell ped to move in server side script. I haven't followed MTA development for pretty long now so it may not work. Link to comment
DakiLLa Posted January 29, 2010 Share Posted January 29, 2010 well, to be honest, i just checked it after ive posted here, and forsure, it doesnt work, lol Link to comment
Slothman Posted February 1, 2010 Share Posted February 1, 2010 setPedControlState only works clientside (don't ask me why) so to sync it you would need to trigger a client event for all clients at the same time. 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