ID:161247
 
how would i make a weapon (as in an rpg) that can do more or less damage depending upon the weapon?

hers my code im using that doesnt work:

obj
icon = 'sword.dmi' // i defined an object called sword
verb
get() //you need to b able to get it
set scr in usr.loc //it needs to be directly
loc = usr //under you to pick it up
usr << "You pick up sword."
del(src) //deletes sword so u cant pick
//it up more then once

stab(mob/M as mob in oview(1)) //new verb
//called stab
usr << "You stab [M]!"
oview() << "[usr] stabs [M]!"
var/damage = rand(5,15) //damge is random amount
//between 5 and 15
world << "[damage] damage!" //world hears the
//amount of damage dealt
M.HP -= damage //the amount of damage dealt
//is subtracted from mobs current health
M.DeathChack() //deletes corpse if dead

i have already defined deathcheck which is a proc that deletes the corpses of the people i kill so there aren't bodys everywhere. i also already defined hp, or health points. i have already defined damagee too, so thats not my problem. any help?

Do you want every sword to do a different amount of base damage?
if so...
obj
sword
var/dam //This variable will be the base damage which can be modified appropriately
verb/Hit(mob/M in oview(1))
M.hp -= dam+1 //simple hit verb
New() //This is called everytime a new /obj/sword is made
var/dam = rand(1,5)//assigns a random damage variable

If you want completely different swords, just make different objects.....
>           del(src) //deletes sword so u cant pick 
> //it up more then once


I may be wrong, as I haven't coded in quite a while...but I believe that this would delete the sword you just picked up meaning that you couldn't use it to do any damage. I don't think you want that there...
In response to Giantpanda
thanks for the help!
I'll test it out and let you know, Giantpanda.