Jump to content

Walking Peds


Lloyd Logan

Recommended Posts

Posted

Not really. Xa and Ya would be the x and y position of the peds, and Xb and Yb would be the x and y position of the marker. Store it as a local variable and use that in setPedRotation.

Posted
Not really. Xa and Ya would be the x and y position of the peds, and Xb and Yb would be the x and y position of the marker. Store it as a local variable and use that in setPedRotation.

How would i do that i'm confused?

Posted

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.

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

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

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

Posted

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.

Posted
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)?

Posted
local ped = createPed( modelid, x, y, z ) 
setElementInterior( ped, 10 ) 
  

But on the INTERIOR ID list there is multiple interiors for 10? Just with different positions?

EDIT : Nevermind I got it! Thanks for your help!

Posted
There are different positions for different buildings inside of the interiors.

You are welcome.

Sorry, everytime the player enters the marker he is spawned in the middle of nothing? I set the position correct and set the dimension to 0, is that all i need to do?

-Lloyd

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