Lloyd Logan Posted February 6, 2013 Share Posted February 6, 2013 If i have created peds, got marker points and set the peds to walking, how would i get the peds to walk in a speficic path, such as markers laid out? -Lloyd Link to comment
Castillo Posted February 6, 2013 Share Posted February 6, 2013 setPedControlState https://wiki.multitheftauto.com/wiki/FindRotation setPedRotation onClientPreRender Link to comment
Lloyd Logan Posted February 6, 2013 Author Share Posted February 6, 2013 setPedControlState https://wiki.multitheftauto.com/wiki/FindRotation setPedRotation onClientPreRender Wow, that findRotation is confusing! Link to comment
J.S. Posted February 7, 2013 Share Posted February 7, 2013 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. Link to comment
Lloyd Logan Posted February 11, 2013 Author Share Posted February 11, 2013 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? Link to comment
csiguusz Posted February 11, 2013 Share Posted February 11, 2013 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
Lloyd Logan Posted February 11, 2013 Author Share Posted February 11, 2013 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
csiguusz Posted February 11, 2013 Share Posted February 11, 2013 -- 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
Lloyd Logan Posted February 11, 2013 Author Share Posted February 11, 2013 -- 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
csiguusz Posted February 11, 2013 Share Posted February 11, 2013 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
Lloyd Logan Posted February 11, 2013 Author Share Posted February 11, 2013 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
csiguusz Posted February 11, 2013 Share Posted February 11, 2013 local ped = createPed( modelid, x, y, z ) setElementInterior( ped, 10 ) Link to comment
Lloyd Logan Posted February 11, 2013 Author Share Posted February 11, 2013 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! Link to comment
csiguusz Posted February 11, 2013 Share Posted February 11, 2013 There are different positions for different buildings inside of the interiors. You are welcome. Link to comment
Lloyd Logan Posted February 11, 2013 Author Share Posted February 11, 2013 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 Link to comment
Lloyd Logan Posted February 11, 2013 Author Share Posted February 11, 2013 EDIT : I got it! Thanks Castillo 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