ID:172409
 
Ok, I am working on a shooter, and I am doing ok, but I have a major problem, and I have tried everything but what I need to do. When the user shoots, no special weopons, just makes a bullet icon move in the direction user was facing. When the bullet hits another player, how do I do dmg to them. I use hp for my health variable. I have tried many things, what do I need to do. Thanks to all that help ^_^ !
this is from one of my games you will need to edit it alot because i have removed just about everything that helped control it.
obj/bullet
icon = 'items.dmi' //set an icon for the bullet so it can be seen in the game
icon_state = "bullet"
density = 1 //this have to be set to 1 so the bullet can hit people
Bump(mob/M)
istype(M,/mob/) // check to see if it hit a mob
M.hp = M.hp - 5

mob
proc
Fire()//The name is self explanitory
set category = "Guns"
name = "Fire"

var/mob/p = src
if(p.ammo <= 0)//this makes sure you have ammo
p << "You need more ammo!"
if(p.ammo > 0)
var/obj/bullet/O = new /obj/bullet(src.loc)
walk(O,p.dir,1)
p.ammo -= 1//this minuss one bullet from the ammo
spawn(30) del(O) // wait a bit and if its still going remove it.
if(p.ammo == 0)
p << "you run out of ammo!"
sleep(3)


In response to Madpeter
Your bump proc looks fine to me.
So amkes me wonder if your bullet even bumps.
And that why you sould look if the walk proc is the right way to get a OBJ to bump into a other one.

As i see it now (not sure of this) i would say this walk proc will stop when it encounters a dense onject.
You sould use step_to (think that one WILL bump if a object is dense)

Again, not sure of this all and I can't check because i'm on a PC without BYOND, but check urself =P.

Good Luck, Greetz Fint