ID:266414
 
obj
sword
icon='items.dmi'
verb
Get()
set src in oview(1)
usr.contents += src
view() << "[usr] picks up \a [src]"
Drop()
new/obj/sword(usr.loc)
view() << "[usr] drops \a [src]"
del(src)
Equip()
if(usr.weapon_equipped == 0)
usr.weapon_equipped=1
view() << "[usr] equips a sword."
usr.overlays+='items.dmi'
usr.verbs+=/mob/attack/verb/Slash()
else
usr << "You are already wielding something."
Unequip()
if(usr.weapon_equipped == 1)
usr.weapon_equipped=0
view() << "[usr] unequips a sword."
usr.overlays-='items.dmi'
usr.verbs-=/mob/attack/verb/Slash()
else
usr << "You aren't wielding this."




Thats my item code i want the usr to be added the verb Slash when they equip and then lose it when they unequip
plz help
do this, instead of using + and - for the verbs, use Add() and Remove()
(btw, tabs are not in place as Tab changes the selected items when not used in a word processor)
Equip()
if(usr.weapon_equipped == 0)
usr.weapon_equipped=1
view() << "[usr] equips a sword."
usr.overlays+='items.dmi'
usr.verbs.Add(/mob/attack/verb/Slash())
else
usr << "You are already wielding something."
Unequip()
if(usr.weapon_equipped == 1)
usr.weapon_equipped=0
view() << "[usr] unequips a sword."
usr.overlays-='items.dmi'
usr.verbs.Remove(/mob/attack/verb/Slash())
else
usr << "You aren't wielding this."
In response to Strange Kidd
you can do it both the way you had it and the way that one dude had it but you have to remove the "()" from behind the verb or else it will think you are trying to call it.
In response to BobJr
that didnt work i get
runtime error: Cannot read null.HP
proc name: Slash (/mob/attack/verb/Slash)
source file: aoftmsf.dm,207
usr: DBZFreak (/mob/man)
src: null
call stack:
Slash(null)
the sword (/obj/sword): Equip()
runtime error: wrong type of value for list
proc name: Equip (/obj/sword/verb/Equip)
source file: aoftmsf.dm,174
usr: DBZFreak (/mob/man)
src: the sword (/obj/sword)
call stack:
the sword (/obj/sword): Equip()
In response to Canar
WOW I THANK YE OL' CHAP!
In response to Strange Kidd
That is an error with your Slash verb, not the Add and Remove procs
-Bob