ID:144482
 
Code:
if(usr.equipped==0) 
usr.equipped = 1
var/obj/weapon_overlays/WO
usr.overlays += WO
if(src.equipped==1)
usr.equipped = 1
var/obj/weapon_overlays/WO
usr.overlays -= WO


Problem description:

Well next time the player logs in and they unequip the equipment the overlay still on them is there another way I can remove overlays, not including ( WO.overlays.Cut() ) I tired whatever is possible nothing working.
Youre using boolean. so dont do if(src.variable==1). Use if(src.variable) or if(!src.variable)

Show me the entire verb. Apart from the above problems everything is in order.
In response to CuriousNeptune
Actually in verbs src is safe, since src == usr. Only in pseudo verbs like Click where usr is the clicker and src is the object clicked.
In response to Xx Dark Wizard xX
AH hokai. ~:| ++ to neptune's DM knowledge
In response to Xx Dark Wizard xX
I SEE THE PROBLEM! I missed it first time, hahah

for both equip and unequip, usr.equip is set to 1
In response to CuriousNeptune
No its not about the vars its about deleting the overlays.
In response to Kasaki
I think Curious is right about the vars. They are both set to 1 after equiping and unequiping. You shouldn't have to delete the overlay since your removing it. I could be wrong but I always just remove it in my game not delete a overlay.
In response to Kasaki
urgh. Im right.

For both equip and unequip it makes the eqipped var =1.

And since there're if(src.equipped) thingies, it only every reads the equip one, and ignores the unequip.
Plus what I said about usr and src was wrong since i just realised its from an obj verb.
In response to CuriousNeptune
I did the vars on my own im not worried about the vars I worried about the overlays like using usr.overlays.Cut() without cutting out the other overlaying objects.
if(src.equipped)    //because this is set to one by both IFs, the top one will NEVER be called
src.equipped = 1 //unless you change the 1 to 0
var/obj/weapon_overlays/WO
usr.overlays += WO
if(!src.equipped)
src.equipped = 1
var/obj/weapon_overlays/WO
usr.overlays -= WO

Fixed code.
In response to CuriousNeptune
Lol dude its not the equipment vars its the overlays, I need a var the removes var/obj/weapon/WO like WO.overlays.Cut() or usr.WO.Remove(src,null) something like that.
In response to Kasaki
O.o
You're not making sense.
To question was asking how to fix the fact that overlays dont go away.
I have fixed that.
In response to Kasaki
O.o I dont follow you.
you want the overlay to appear when equipped and disappear when unequipped, right???
GemStar wrote:
Code:
if(usr.equipped==0) 
> usr.equipped = 1
> var/obj/weapon_overlays/WO
> usr.overlays += WO
> if(src.equipped==1)
> usr.equipped = 1
> var/obj/weapon_overlays/WO
> usr.overlays -= WO
>

Problem description:

Well next time the player logs in and they unequip the equipment the overlay still on them is there another way I can remove overlays, not including ( WO.overlays.Cut() ) I tired whatever is possible nothing working.

Your problem is your equipment system. You should be using a list of all objects equipped. Another thing, you shouldn't be saving icons in a savefile - that creates huge, unwanted files which quickly grow to unwanted sizes. Here's what you do:
1. Everything that you want to be equipped, add it to an "equipped" list & then add all the overlays & crap associated with it.
2. After you do the inventory, you need to make a proc that makes it so no icons of any type are saved in savefiles. Not only does it make huge files, it also is part of your not being able to remove overlays/underlays individually after relog. You need to develop a proc that deletes all overlays/underlays & then reapplies them as needed when removing items, putting items on, logging in, etc...because, color modified objects will NOT be able to be removed after relog unless you delete all overlas.
In response to Teh Governator
Oh, how about is their a code that when a player relogs it removes all their equipments, including the equipment suffix?
In response to Kasaki
Kasaki wrote:
Oh, how about is their a code that when a player relogs it removes all their equipments, including the equipment suffix?

There are no "codes". There's only what you program your self. And, honestly - that'd get aggravating to have all equipped items removed on logout & have to re-equip them everytime on login. Try my inventory system, it'll point you in the correct direction:
http://developer.byond.com/hub/Goku72/ EquipmentInventory_System