Jump to content

Walking Peds


Lloyd Logan

Recommended Posts

It's peretty easy, you should just understand it once, what the function does.

Give the funtion your ped's x and y coordinate, then the point's x and y coordinate, where you want your ped look at. It will return a number, which you can use for setPedRotation, to make the ped face the given point.

Link to comment
It's peretty easy, you should just understand it once, what the function does.

Give the funtion your ped's x and y coordinate, then the point's x and y coordinate, where you want your ped look at. It will return a number, which you can use for setPedRotation, to make the ped face the given point.

I'm sorry, but i don't understand in the slightest i have the peds starting position (x, y, z), and i have 4 marker positions. How do i make it walk to each of the Markers?

Link to comment
  -- you have some markers: 
local marker = createMarker ( arguments_here ) 
  
-- and you have a ped: 
local ped = createPed( args ) 
  
-- to make the ped walk to the right direction, you have to turn the ped to the right direction 
local markerX, markerY, markerZ = getElementPosition( marker ) 
local pedX, pedY, pedZ = getElementPosition( ped ) 
  
-- to get the 'right direction' use the findRotation (wich you must include in the script ) function. Z coordinates are not needed. 
local rotation = findRotation( pedX, pedY, markerX, markerY ) 
  
-- then make the ped face the marker: 
setPedRotation( ped, rotation) 
  
-- then make the ped walk like you want with setPedControlState or even with setPedAnimation functions.  

Link to comment
  -- you have some markers: 
local marker = createMarker ( arguments_here ) 
  
-- and you have a ped: 
local ped = createPed( args ) 
  
-- to make the ped walk to the right direction, you have to turn the ped to the right direction 
local markerX, markerY, markerZ = getElementPosition( marker ) 
local pedX, pedY, pedZ = getElementPosition( ped ) 
  
-- to get the 'right direction' use the findRotation (wich you must include in the script ) function. Z coordinates are not needed. 
local rotation = findRotation( pedX, pedY, markerX, markerY ) 
  
-- then make the ped face the marker: 
setPedRotation( ped, rotation) 
  
-- then make the ped walk like you want with setPedControlState or even with setPedAnimation functions.  

I'll try that then get back to you! Will the ped and marker i create be spawned in all interiors?

Link to comment

No. Peds and markers will be created only in one dimension (default 0). You can set their dimension with the setElementDimension, but if you want peds and markers in more dims. then you must create them separately in every single dimension, where you want them to be.

Ohh sorry, you asked about interiors not dimensions... I'm a bit tired now.

Just like at dimensions a ped can be only in one interior. You can set its interior with setElementInterior. As far as i know, if you make a marker itt will be present in all interiors.

Link to comment
No. Peds and markers will be created only in one dimension (default 0). You can set their dimension with the setElementDimension, but if you want peds and markers in more dims. then you must create them separately in every single dimension, where you want them to be.

Ohh sorry, you asked about interiors not dimensions... I'm a bit tired now.

Just like at dimensions a ped can be only in one interior. You can set its interior with setElementInterior. As far as i know, if you make a marker itt will be present in all interiors.

So, how would i create a ped in Interior 10 (burger shot)?

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