ID:144973
 
Code:
obj/equipment
Chain_Mail
name = "Chain Mail"
icon = 'chain mail.dmi'
layer=MOB_LAYER+1
verb
Get()
set src in oview(1)
src.Move(usr)
Drop()
if(src.suffix == "chest")
usr << "First un-equip your armor!"
return
else
src.Move(usr.loc)
Equip()
if(usr.chest == 1)
usr << "You already have armor on!"
return
if(usr.chest == 0)
usr << "You put [src] on!"
src.suffix = "chest"
usr.chest = 1
usr.overlays +=/obj/equipment/Chain_Mail
usr.Armor +=5
return
UnEquip()
if(usr.chest == 1)
usr << "You take off [src]!"
src.suffix = null
usr.chest = 0
usr.Armor -=5
usr.overlays -=/obj/equipment/Chain_Mail
return
if(usr.chest == 0)
return


Problem description:
Everything works fine, except i noticed a small flaw. When i equip an armor and log out it saves the overlay on me so when I log back in and un-equip it doesnt take away the overlay. anyone know why this is?
drak.


It does this because overlays is a special list. When you save your game, the overlays are merged into the saved icon. You can fix this by removing all overlays when the player logs out before they save their game, and readding the overlays when the player logs in.

Also, your equipment system is done incorrectly. Instead of setting a variable to 1 to check whether something is equipped in one body area, you should be setting a reference of the equipment to a variable.

~~> Unknown Person
In response to Unknown Person
Plus (if it works in your game) you can just add the object into the overlays