ID:264270
 
Code:
        else if(isturf(O))
O.density = 0
view(src.owner)<<'explosion.wav'
new/obj/Ki_hit(src.loc)
spawn(1)
sleep(100)
O:density = 1


Problem description:

When ever I shoot a beam at turf it changes the density to 0, but I need to it sleep(100) then change back to 1.
Learn how to typecast and don't ever use :, first of all.

My guess is you're deleting the src, right? That ends the proc.

        else if(isturf(O))
var/turf/T = O //typecasting!
T.density = 0
view(src)<<'explosion.wav' //makes more sense to hear the sound where the explosion
//actually was
new/obj/Ki_hit(src.loc)
spawn() T.Density_Timer() //call a proc belonging to T. Because it belongs to T
//it won't end when the src is deleted


turf/proc/Density_Timer(delay=100) //give all turf's a proc with the arg
//delay called Density_Timer()
//delay's default value is 100, so if the arg is left blank
//it will still wait 10 seconds
sleep(delay) //wait whatever the delay is
density = 1 //set the density to 1
return 1 //return a true value
In response to Jeff8500
None of that worked at all, the density of the turf still stay's at 0.
In response to Gizhy Games
It's kind of hard to guess what you're doing outside that tiny snippet, and I can't help without knowing. Try not copying and pasting.
In response to Jeff8500
I didn't copy and paste it...
Plus I figured it out already.
In response to Jeff8500
        else if(isturf(O))
var/turf/T = O //typecasting!
T.density = 0
view(src)<<'explosion.wav'

new/obj/Ki_hit(src.loc)
T.Density_Timer() //This doesn't need the spawn



turf/proc/Density_Timer(delay=100)


sleep(delay)
density = 1
return 1