Domingos MTA Posted December 1, 2017 Posted December 1, 2017 (edited) I am making a script to spawn objects in random places on the map, but I have a question, is there a function that does this automatically or do I need to manually add the locations? Edited December 1, 2017 by Domingos MTA
Miika Posted December 2, 2017 Posted December 2, 2017 (edited) function random() local x, y = math.random(-2000, 2000), math.random(-2000, 2000) local z = getGroundPosition(x, y, 200) createObject(9000, x, y, z) --Replace object id with your own end Edited December 2, 2017 by Miika
Storm-Hanma Posted December 2, 2017 Posted December 2, 2017 Simple way is go to gamemode /play folder open it look for file some like bou...I forget the name check them by editing u will see all local spawns with. Vehicles spawn too edit the local spawn to ur required spawn ! This will only work on play mode(free roam)
Fist Posted December 2, 2017 Posted December 2, 2017 5 hours ago, Miika said: function random() local x, y = math.random(-2000, 2000), math.random(-2000, 2000) local z = getGroundPosition(x, y, 200) createObject(9000, x, y, z) --Replace object id with your own end getGroundPosition It is required that the point is near enough to the local player so that it's within the area where collision data is loaded. If this is not the case, an incorrect position will be returned
Mr.Loki Posted December 2, 2017 Posted December 2, 2017 Create a table with with spawn points then just spawn the forms randomly with it.
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