Posts: 540
Threads: 107
Joined: Sep 2014
Reputation:
0
Hello!
It's possible to create objects on random map?
For example, I have object 3026. I want to create this object 3026 on random positions?
Is there any way to do this?
Thanks!
Posts: 460
Threads: 42
Joined: Nov 2009
Reputation:
0
Just create an array which contains the coordinates that you want the object to spawn randomly on and use the random function to get a random position in the array.
Posts: 470
Threads: 7
Joined: Nov 2013
Reputation:
0
Hi, yes thats possible and do such stuff in my gamemode. All you have to do is to fetch the Z pos. For this you need Kalcor's MapAndreas. You can randomize the X and Y coords (random function) and insert them to find the Z coord using the above MapAndreas plugin. Use the three coords to create the object.
NOTE THAT:
- The object might be created anywhere i.e you might need to add limits.
- Make sure that the randomized X, Y are within SA-MP's boundaries.
Posts: 253
Threads: 17
Joined: Jan 2014
Reputation:
0
new rand[4];
rand[0] = random(3000);
rand[1] = random(3000);
rand[2] = random(300);
( rand[3] add random(2) if it's 1 => multiply rand[0] by 1 , if 0 multiply it by -1 )
SetObjectPos(theobject you created, rand[0], rand[1], rand[2]);
Send message to admins : format(string, 128, " Item spawned in %f, %f, %f coords.", rand[0], rand[1], rand[2]);
Good luck finding it, that's what you asked for ( random ) because you said you don't wanna make array that contains different ( real random position ) because random can spawn the object in the air, in buildings, in mountains ..
MapAndreas uses a lot of RAM, it's efficient, accurate, but too heavy.