ID:171956
 
I need help my firing procedure.

I decided to rewrite the section of my game that controls combat so that it's easier to make explosive weaponry. However, I need help getting the game to subtract the "range" variable in such a way that the variable goes down whenever the bullet object moves one tile. Then, I want it to call /obj/projectile/proc/Explosion when the "range" variable reaches zero. Here is what I have at the moment:

The variable definitions:
obj
projectile
var
damage
range
splash


The explosion proc:
proc/Explosion(mob/M as mob in src.splash)
for(M in src.splash)
M.HP -= rand(src.damage - 1, 1)


Note: the explosion proc falls under /obj/projectile, but I didn't feel like adding the atom definition.

And my current firing code:
mob/verb/fire()
if(AmmoCheck()) return 0
else
usr.Ammunition -= 1
var/obj/projectile/arrow/O = new /obj/projectile/arrow(usr.loc)
O.dir = usr.dir
walk(O,O.dir)


EDIT:

The only other section that has anything to do with the firing proc is the object definitions for the projectiles that I want to explode. I'm not sure if I have what I wanted done or not, as I'm not sure if the walk procedure will call Move or not.

        law
icon = 'law.dmi'
damage = 100
range = 6
splash = 5
Move()
if(src.range > 0)
src.range -= 1
..()
else


That's my current explosive projectile coding, and I'm unsure what to add to my else clause as well as I'm not sure if it'll work in conjunction with walk being called.

The fact that arrow is being called by fire only because I didn't code in the LAW firing yet. It will have basically the same prodedure as /mob/verb/fire.
I *think* you should give us some more coding to look at.