ID:1331376
 
(See the best response by FIREking.)
Code:
mob/verb/testShock()
if(src.challenge(5,5))
for(var/turf/T in oview(1))
if(!T.density)
var/obj/spells/damage/areashock/A
A.dmg = src.DES.value/2
new A(T.loc)


If necessary, I can also post challenge():

mob/proc/challenge(var/rounds,var/time)
var/yourkey
while(rounds)
new/obj/hudMeters/challenge/key(src.client)
yourkey = pick("up","down","left","right")
for(var/obj/hudMeters/challenge/key in src.client.screen)
key.icon_state = yourkey
sleep(time)
if(src.lastkey == yourkey)
rounds --
else
for(var/obj/hudMeters/challenge/key in src.client.screen)
del key
new/obj/hudMeters/challenge/bad(src.client)
spawn(15)
for(var/obj/hudMeters/challenge/bad in src.client.screen) del bad
rounds = 0
return 0
for(var/obj/hudMeters/challenge/key in src.client.screen) del key
for(var/obj/hudMeters/challenge/key in src.client.screen) del key
new/obj/hudMeters/challenge/good(src.client)
spawn(15)
for(var/obj/hudMeters/challenge/good in src.client.screen) del good
return 1

Problem description:
The challenge proc will run, but when I'm done with it, the objs won't spawn on the turfs.
Best response
Why not just do this?

var/obj/spells/damage/areashock/A = new(T.loc)
A.dmg = src.DES.value/2


Are you sure challenge actually returns?

mob/verb/testshock()
var/result = challenge(5,5)
world << "The result of challenge was: [result]"
It's returning challenge, I tested it with this:

mob/verb/testShock()
world << src.challenge(5,10)
I finally fixed it by applying Fireking's code, but I've run into another problem. The obj will also spawn where the usr is, but I only want it to spawn around the usr. Any solutions? Thank you for your help so far.
You need to pass the "player" whom you don't want the items to spawn around to oview(). If you look in the reference, the oview() proc takes two arguments, a center and a range. If you give oview() the player, it will omit that tile from the return result.