ID:143270
 
Code: I am using 4.0
        Spawn_soccer_balls()
if(spawnwarning==0)
src<<"You start spawning <b>Soccer</b> balls around you."
spawnwarning=1
if(spawning==0)
new/obj/balls/soccerb/(locate (rand(x+2,x-4),rand(y+2,y-4),(usr.z)))
// Need the check if turf is dense, or contains a dense obj, and then delete original and respawn another immidiately
sleep(2)
Spawn_soccer_balls()


Problem description: I have looked through the forums for similar situations and I found one that was a little to complicated for me, and the rest that weren't similar enough for me to draw parallels with. I have the request in the code. This is simply a "mini project" for me to add into a bigger project I am working on. I keep track of who helps me so I can list all credit (<- this was edited do to a misunderstanding).

Also, if you could help me write that part as a proc, that would be a litle more helpful XD.
its been 10 hours roughly just wanted to post a follow up. Kai, cmon man you know me XD.
In response to Arcangelbjr
You should choose random location, and check if its dense or not before spawning. Then don't have to be deleting things everywhere.
In response to Dever
OK Point me in the right location to checking if a turf is dense, or if it contains dense objects.
In response to Arcangelbjr
Fine. Basically all you do is exactly what you said. Except you have to make a new one before you delete it, or else it will just stop.
By the way, you don't need to create it in the first place if you're just gonna delete it anyways.
Oh, and use boolean stuff. somevar==0 is the same as !somevar, and somevar==1 is the same as somevar alone.

        Spawn_soccer_balls()
if(!spawnwarning)
src<<"You start spawning <b>Soccer</b> balls around you."
spawnwarning=1
if(!spawning)
for(var/turf/T in view(4,src))
if(!T.density)new/obj/balls/soccerb(T)
sleep(2)
Spawn_soccer_balls()

That will make soccer balls all around you in a 4-tile radius, ignoring dense turfs.
In response to Kaiochao2536
Thank you very much.
In response to Arcangelbjr
No problem.