TiTawN Posted May 28, 2022 Share Posted May 28, 2022 Hello, how can a ped drive a car following a car that a player is riding in? Please Fast Answer Me Thanks Link to comment
DiSaMe Posted May 30, 2022 Share Posted May 30, 2022 (edited) You can make the ped perform actions using setPedControlState, with accelerate, vehicle_left and vehicle_right being the most important controls you would want to use for driving. You also need to retrieve the relative placement between ped's and player's cars, using functions such as getElementPosition and getElementRotation and some math. All these things need to be done repeatedly so that the control states would be updated as the elements move. If you also want to make the ped follow the roads (instead of going straight towards the player), then it gets more complicated because the script has to do pathfinding. Edited May 30, 2022 by Reyomin 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