Jump to content

Ped move from A to B


MasterTobi

Recommended Posts

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 xD

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
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

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...