Here is my code:
mob/proc/Overlay_Refresh()
src.overlays = src.Overlays
obj
var
slot
skill=0
equipped=0
Shinigami_Items
Sword
icon='Icons/Items.dmi'
IS="sword"
name="Asauchi"
Click()
if(src in usr)
if(!src.equipped && !(usr.Equipped[SWORD]))
src.equipped=1
usr.equipment+=src
usr.Equipped[SWORD]=1
var/obj/O = /obj/Shinigami_Items/Asauchi
usr.Overlays["Sword"]=O
usr.Overlay_Refresh()
src.suffix = "Equipped"
//usr.UpdateEquipment()
//usr.UpdateInventory()
else if(src.equipped&&usr.Equipped[SWORD])
src.equipped=0
usr.equipment-=src
usr.Equipped[SWORD]=0
usr.Overlays["Sword"]=null
usr.Overlay_Refresh()
src.suffix=""
//usr.UpdateEquipment()
//usr.UpdateInventory()
Asauchi
icon='Icons/Sword.dmi'
layer=MOB_LAYER+1
And I get this error message in-game:
runtime error: bad index
proc name: Click (/obj/Shinigami_Items/Sword/Click)
usr: Chris (/mob/player)
src: Asauchi (/obj/Shinigami_Items/Sword)
call stack:
Asauchi (/obj/Shinigami_Items/Sword): Click("Inv", "statspane.info1", "icon-x=69;icon-y=17;left=1")
Can anyone help me? I am just trying to simply overlay a sword. But I am trying to use an associative list so I can manage my overlays later.(Saw this multiple times in my search)
then you do a common mistake by making equipped in the actual item itself
i dont know if this will help you at all or not but ill give you a direct rip from my game and see if that helps you at all.