obj
Zombie1
icon = 'zombie1.dmi'
density = 1
verb
Shoot()
set src in oview(5)
for(var/obj/Ammo/a in usr.contents) //cycle through the contents
if(istype(a)) //if the obj in contents is the type /obj/Ammo, lets reload
del a //delete the ammo
world << "You have Fired at the Zombie!" //tell the user
. = 1 //return a 1
break //break (or return)
if(!.)//if it wasn't found
world << "Your gun is not loaded!"
Decap()
set src in oview(2)
world << "You attacked a Zombie with a Shovel!"
for(var/obj/Shovel/a in usr.contents) //cycle through the contents
if(istype(a)) //if the obj in contents is the type /obj/Ammo, lets reload
. = 1 //return a 1
break //break (or return)
if(!.)//if it wasn't found
world << "You were hit by Zombie!"
src.Health-= 25
Hey guys, again, lol. I would like my code to remove 25 Health from Player when he attacks without shovel. How? Thanks guys!
Knowing that, when you put the line of code src.Health -= 25, you are actually trying to remove 25 from a variable belonging to the zombie, not the player calling the verb.
What it all boils down to is clearly understanding who is doing what to whom? Who is the src (who does the verb/proc belong to), and who is the usr? (if they aren't the same).