obj
weapons
icon = 'weapons.dmi'
Sword
icon_state = "sword"
layer = 8
item = 1
verb
Equip()
src << "<b>You equip a sword.</b>"
src.wpndmg += 1000
src.overlays += /obj/weapons/Sword
Unequip()
src << "<b>You unequip a sword.</b>"
src.wpndmg -= 1000
src.overlays += /obj/weapons/Sword
Problem description:
When I use that code, it says src.wpndmg is undefined. Yet in the attack command, when src.wpndmg is used, it works fine. What is wrong with the code?
In this case, the issue is that the attack command belongs to the mob, not the weapon. src is the weapon, and usr is the mob who called this verb, so that should be usr.wpndmb and usr.overlays.
Don't forget, you'll also need to keep track of which weapon is equipped, so you'll need to set usr.weapon=src when equipping, and usr.weapon=null when unequipping, plus check for cases where another weapon is already equipped (in Equip()), or the current weapon is not equipped (in Unequip()).
Lummox JR