equip()
switch(alert("Would you like to eguip this to your Main Hand or Off Hand?","Equip","Main Hand","Off Hand"))
if("Main Hand")
if(usr.armr!=0)
usr << "You cannot equip this to this arm."
else if(suffix=="Equipped")
usr << "This is already equipped."
else
suffix = "Equipped"
usr.overlays += /obj/sr
usr.armr = 1
usr.armrn = src.name
if("Off Hand")
if(usr.arml!=0)
usr << "You cannot equip this to this arm."
else if(suffix=="Equipped")
usr << "This is already equipped."
else
suffix = "Equipped"
usr.overlays += /obj/sl
usr.arml = 1
usr.armln = src.name
unequip()
if(usr.armrn!=src.name)
if(usr.armln!=src.name)
usr << "You do not have this equipped."
else
suffix = null
usr.overlays -= /obj/sl
usr.arml = 0
usr.armln = ""
else
suffix = null
usr.overlays -= /obj/sr
usr.armr = 0
usr.armrn = ""
axe
icon = 'Weapons.dmi'
icon_state = "Axe1"
name = "Starter Axe"
sr
icon = 'Weapons.dmi'
icon_state = "Axe2"
layer = MOB_LAYER + 20
sl
icon = 'Weapons.dmi'
icon_state = "Axe3"
layer = MOB_LAYER + 20
shield
icon = 'Weapons.dmi'
icon_state = "9"
mob
var
armr = 0
armrn = ""
arml = 0
armln = ""
Problem description: Very odd glitch/bug... When unequipping the item that is in the offhand while both axes are equipped, it removes the main hand axe. Then, to more extent, when I unequip the same axe again... it removes the off hand axe. So basically here's what it looks like... (All Messages in parentheses are not what they look like ingame, they are purely for informational purposes)
Axe > Equipped (Mainhand)
Axe > Equipped (Offhand)
USER --> Unequip Axe (Offhand)
(Ingame, Mainhand becomes unequipped)
Axe > Equipped (Mainhand)
Axe > (Offhand)
USER -- Unequip Axe (Again) (Offhand)
(Ingame, Offhand becomes unequipped)
Axe > Equipped (Mainhand)
Axe > (Offhand)
(Notice also that the Mainhand axe doesn't remove the suffix either.)
Thanks so much if you can help me.
The correct way to implement an equipment system is for the mob to have a var pointing to the object itself, or null if none is equipped. Hence, usr.armor=src to equip.
Lummox JR