ID:173395
 
Could someone plz help me on this i have

obj
density = 1
icon = 'objs.dmi'
icon_state = "bullet"
Bullet
Bump(mob/M)
if(ismob(M))
M.HP -= 10
M.DeathCheck(M)
del(src)

mob
verb
Fire()
set hidden = 1
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)
src.fired = 0
del(A)


if i set bullet to density = 0 so i can go over water it don't hit who you shoot.How can i make it density = 0 and it still his a usr if it hits them>?
Keep the bullet's density at 1, but change the water's density to 0. Then override the water's Enter() proc so you can stop mobs going through it but allow everything else.

<code>turf/water density=0 Enter(atom/movable/A) if (istype(A,/mob)) return 0 //Don't allow mobs through else return ..() //Do allow other stuff through</code>
In response to Crispy
Crispy wrote:
Keep the bullet's density at 1, but change the water's density to 0. Then override the water's Enter() proc so you can stop mobs going through it but allow everything else.

<code>turf/water > density=0 > Enter(atom/movable/A) > if (istype(A,/mob)) return 0 //Don't allow mobs through > else return ..() //Do allow other stuff through</code>

thank you so much
CrazyFighter wrote:
M.DeathCheck(M)

That's a really useless line of code there. When you call DeathCheck(), you should pass along the player who fired the bullet, not the target (M). The bullet needs to be told, when it's created, who fired it, which you've neglected to do.

In fact you've done a lot in the Fire() verb that really is best left to obj/Bullet/New(). You've also messed up the /obj/Bullet declaration:
obj
density = 1
icon = 'objs.dmi'
icon_state = "bullet"
Bullet
That has just defined those properties for all objs, not just /obj/Bullet. The three lines between obj and Bullet should be indented beneath Bullet.

if i set bullet to density = 0 so i can go over water it don't hit who you shoot.How can i make it density = 0 and it still his a usr if it hits them?

There's no such thing as "a usr". Stop using that phrase. You mean "a player". A player may be a user, but "user" is not the same thing as "usr". This is a horrible linguistic mistake to make, as it means you're probably making the same mistake everywhere in your code and assuming usr is "the player". This would explain your DeathCheck() proc, in fact, where I'm certain you're misusing usr as well.

Lummox JR