ID:138886
 
Code:
//Login/Logout
mob/proc
Save()
if(src.z==2) return
var/savefile/F = new("Players/[src.key].sav")
F["LastX"]<<src.x
F["LastY"]<<src.y
F["LastZ"]<<src.z
F["dir"]<<src.dir
F["name"]<<src.name
F["icon_state"]<<src.icon_state
F["Level"]<<src.Level
F["Str"]<<src.Str
F["Def"]<<src.Def
F["Speed"]<<src.Speed
F["MaxHP"]<<src.MaxHP
F["MaxMP"]<<src.MaxMP
F["Exp"]<<src.Exp
F["Nexp"]<<src.Nexp
F["Gold"]<<src.Gold
F["BankedGold"]<<src.BankedGold
F["StrNum"]<<src.StrNum
F["DefNum"]<<src.DefNum
F["SpeedNum"]<<src.SpeedNum
F["NDef"]<<src.NDef
F["NStr"]<<src.NStr
F["NSpeed"]<<src.NSpeed
F["W"]<<src.W
F["H"]<<src.H
F["Class"]<<src.Class
F["Gender"]<<src.Gender
F["Quest"]<<src.Quest
F["QuestMonster"]<<src.QuestMonster
F["QuestKills"]<<src.QuestKills
F["QuestObjectives"]<<src.QuestObjectives
F["contents"]<<src.contents
F["Items"]<<src.Items
for(var/obj/Skills/O in SkillList)
if(O.Learned==1)
F["[O]Learned"]<<O.Learned
for(var/Over in src.overlays)
if(Over) if(Over:name=="NameDisplay") src.overlays-=Over
F["Overlays"]<<src.overlays
src.AddName()
src<<output("Game Saved","InfoBox")

Load()
if(fexists("Players/[src.key].sav"))
var/savefile/F = new("Players/[src.key].sav")
var/LastX
var/LastY
var/LastZ
F["LastX"]>>LastX
F["LastY"]>>LastY
F["LastZ"]>>LastZ
F["dir"]>>src.dir
F["name"]>>src.name
F["icon_state"]>>src.icon_state
F["Level"]>>src.Level
F["Str"]>>src.Str
F["Def"]>>src.Def
F["Speed"]>>src.Speed
F["MaxHP"]>>src.MaxHP
F["MaxMP"]>>src.MaxMP
F["Exp"]>>src.Exp
F["Nexp"]>>src.Nexp
F["Gold"]>>src.Gold
F["BankedGold"]>>src.BankedGold
F["StrNum"]>>src.StrNum
F["DefNum"]>>src.DefNum
F["SpeedNum"]>>src.SpeedNum
F["NDef"]>>src.NDef
F["NStr"]>>src.NStr
F["NSpeed"]>>src.NSpeed
F["W"]>>src.W
F["H"]>>src.H
F["Class"]>>src.Class
F["Gender"]>>src.Gender
F["Quest"]>>src.Quest
F["QuestMonster"]>>src.QuestMonster
F["QuestKills"]>>src.QuestKills
F["QuestObjectives"]>>src.QuestObjectives
F["contents"]>>src.contents
F["Items"]>>src.Items
F["Overlays"]>>src.overlays
for(var/obj/Skills/O in SkillList)
F["[O]Learned"]>>O.Learned
src.HP=src.MaxHP
src.MP=src.MaxMP
if(src.Gender=="Male") src.icon='BaseMale.dmi'
else src.icon='BaseFemale.dmi'
src.loc=locate(LastX,LastY,LastZ)
src.AddName()
src<<output("Game Loaded","InfoBox")
if(LastZ==2)
usr.client.view=5
else
usr.client.view="[src.W]x[src.H]"
usr.HUDBaseProc()
usr.CrystalProc()
usr.HealthBarProc()
usr.ManaBarProc()
usr.ExpBarProc()
usr.IconReflectionProc()
usr.overlays=src.overlays
return 1
else return 0

//Clothes Seller
mob/NPCs/Clothes_Seller
icon_state="Item Seller"
verb
Shop()
set src in oview(1)
var/list/ItemList=list("Pants"=30,"Shoes"=10,"Shirt"=20,"Nothing"=0)
var/Item2Buy=input("What can I get for you today?","Item Seller") as anything in ItemList
var/Price=ItemList[Item2Buy] //this gets the price based on the list
var/Red=input("How Much Red Dye?","RGB") as num
var/Green=input("How Much Green Dye?","RGB") as num
var/Blue=input("How Much Blue Dye?","RGB") as num
if(Price)
if(usr.Gold<Price)
usr<<output("You need [ItemList[Item2Buy]] gold! You only have [usr.Gold]!","InfoBox")
else
usr<<output("You Buy a [Item2Buy]","InfoBox")
var/obj/Clothes/NewItem="/obj/Clothes/[Item2Buy]"
NewItem=new NewItem
var/icon/I = NewItem.icon
I += rgb(Red, Green, Blue)
var/Color = rgb(Red, Green, Blue)
NewItem.icon = I
NewItem.Color = Color
usr.contents+=NewItem;usr.Items+=NewItem
usr.Gold-=Price
usr<<output("Item Seller: Come again!","InfoBox")
//Equip/Unequip
obj/Clothes
var/Color
var/BaseSuffix
Shirt
icon='Shirt.dmi'
suffix = "A Shirt"
BaseSuffix = "A Shirt"
Pants
icon='Pants.dmi'
suffix = "Pants"
BaseSuffix = "Pants"
Shoes
icon='Shoes.dmi'
suffix = "Shoes"
BaseSuffix = "Shoes"
Click()
src.icon+=Color
var/obj/Over = src.icon
if(suffix != "Equiped")
usr.overlays+=Over
suffix = "Equiped"
usr<<output("You put on the [src.name]!","InfoBox")
else
usr.overlays-=Over
suffix = "[src.BaseSuffix]"
usr<<output("You took off the [src.name]!","InfoBox")


Problem description:As of right now,Once yo equip an item, you can "Unequip it" but the overlay wont come off. On top of that, If you equip something then relog/reboot without taking it off, upon logging in you cannot take it off(The Overlay).

The First problem stated recently arised as i was trying to fix the second stated, i decided not to screw up further and just ask for help. So any would be nice.

My idea with the first problem is that it might be these lines

        src.icon+=Color
var/obj/Over = src.icon


Would color change at all? I'd imagine if you removed src.icon+=Color that everything would work.

If you couldn't take off the overlay before you logged, what makes you think you could do it afterwards? (just saying)

Tell me if this works.
In response to Ganing (#1)
Ganing wrote:
My idea with the first problem is that it might be these lines

>         src.icon+=Color
> var/obj/Over = src.icon
>


Would color change at all? I'd imagine if you removed src.icon+=Color that everything would work.

If you couldn't take off the overlay before you logged, what makes you think you could do it afterwards? (just saying)

Tell me if this works.

As i said, the takign them off before i logged is a -recent- bug tht arose after the other, casue i continued to try to mess with it.

EDIT: Anyway i changed
src.icon += Color
var/obj/Over = src.icon
//to
var/obj/Over = src.icon
Over += Color


Everything works except for the bug upon reloging/rebooting, if you had clothes on, they cant come off even when toggling the item in your inventory off.
In response to XxLucifersJesterxX (#2)
no one? .-.
In response to XxLucifersJesterxX (#3)
You cant save overlays or else they become part of the icon state and cannot be removed unless you reset the icon.
I would personally just save some equip var and reapply the overlay at login