ID:173353
 
in my tank game i am making i have the fire command and im trying to add an Explosion when it hits somthink.
obj
density = 1
icon = 'objs.dmi'
icon_state = "bullet"
Bullet
Bump(mob/M)
if(ismob(M))
M.HP -= 10
Explosion()
M.DeathCheck(src)
del(src)

mob
verb
Fire()
if(src.fired == 1)
src << "You already fired WAIT!!!."
return
if(src.Ammo <= 0)
src << "Not enough Ammo to fire."
return
src.Ammo -= 1
src.fired = 1
flick("fire",src)
var/obj/A = new /obj/Bullet (src.loc)
A.dir = src.dir
walk(A,A.dir,1)
sleep(10)
<font color = red>Explosion(A)<font color = black>
src.fired = 0
del(A)
proc
Explosion()
for(var/turf/X in range(src,1))
spawn(9)
X.overlays += /obj/Explosion
spawn(12)
X.overlays.Cut()

obj
Explosion
icon = 'turfs.dmi'
icon_state = "Explosion"
layer = MOB_LAYER + 1


but when it hits somethink the Explosion overlays my icon then goes how can i make it exploed where it got deleted?
CrazyFighter wrote:
but when it hits somethink the Explosion overlays my icon then goes how can i make it exploed where it got deleted?

Three things:

1) Please pick more descriptive topics when you post in the forum. "Help plz" doesn't say much. Making it relevant to the content of your post would be nice.

2) It's a lot better to put <dm> tags around your code than <code>.

3) You forgot to show the code for your Explosion() proc.

Lummox JR
ok fixed now can someone please help me?
Well, look what you're doing. You're passing in the target to Explosion(), but then Explosion() isn't doing anything with it. Instead, you're using src. But it's a global proc, not a mob proc, so using src makes no sense. (It is a global proc, right?)

What you need to do is have Explosion() take the argument it's given, and apply the overlay to that object instead.