ID:271949
 
does any one no the code that goes in this for damage say 20 damage




client/Center() //which macro to set, in this case it is 5 on numberpad
mob.shoot() //when 5 is press, it goes to the mob proc shoot
mob/verb/Shoot() //also a verb for Shoot
shoot() //goes to the shoot proc
mob
proc
shoot() //name of proc
if(!src.fired) //if the usred fired is 0 (keeps the usr from holding down 5 for lots of shots)
src.fired = 1 //makes fired equal 1
spawn(15) //waits 1.5 seconds before going to the code underneath it
src.fired = 0 //makes the player's fired 0 so the player can shoot again
var/obj/H = new/obj/bullet //set the bullet to H (H is the bullet)
H.dir = src.dir //the bullets(H) direction equals the player's direction
H.loc = src.loc //the bullets(H) location equals the player's location
while(H) //while the bullet is still "alive"
var nextLocation = get_step(H,H.dir) //grabs the location of H's next move
var/turf/T = nextLocation //for the turf that is in H's next location
for(var/mob/M as mob in T) //for and M in that turf
if(M == src) //if that M is the person who fired, it continues as if nothing was there
continue
src<<"You shot [M]!" //says you shot M

//Here is where you would want to add damage or such ect..
del(H) //deletes the bullet
if(T.density == 1) //if that turfs density = 1 (ex: a wall)
del(H) //deletes the bullet
if(H) //if H exists
step(H,H.dir)//H steps towards H's direction
sleep(1) //sleeps 1/10th of second before re-doing the loop

It says on the coding itself in comments =\

Also, don't copy demos directly

Secondly, There is no "The Code" just "A Code"
In response to Iuss
ok added this it does damage but person doesnt die if i and a death proc i get loads of errors







M.hp -= usr.str - M.def
In response to GDavidson-sc1
"doesnt die if i" what?

Oh, and for the code, you really should look here.
In response to Kaiochao2536
i fixed it the person dies now but is there any demos for weapons where u have to equip a weapon to fire a bullet like u equip hand gun and then u can fire a 9mm bullet ect

cause right now i can fire without a wep equiped