ID:169369
 
Heres the deal...

I want to make something so when the world is started up a certain object will get randomly placed throughout the map.

But I don't know how to do this.

PLease give me advice on how to do so. Or point me to a demo of some kind.
world/New()
..()
var/obj/certainobj/O = new
O.loc = locate((rand(1,world.maxx)),(rand(1,world.maxy)),1)


locate() needs an x, y and z variable. We randomly generate x and y by using rand(). 1 to world.maxx and 1 to world.maxy will cover the entire z-axis.
In response to DeathAwaitsU
Or, alternatively:

#define CheeseProb 5

turf/New()
..()
if((!density)&&(prob(CheeseProb))) new /obj/Cheese(src)

obj/Cheese
desc="It's slightly cheesy"
In response to Jp
Crzylme wrote:
Heres the deal...

I want to make something so when the world is started up a certain object will get randomly placed throughout the map.