ID:267394
 
I have put clothes in my game but there is a problem. When you put it on then log out, then back in you cant take it off. If you dont log out u can take it off but not if you log out. the code im using is:
obj/overlays/redshirt
name = "Red Shirt"
icon = 'clothes.dmi'
icon_state = "red"
layer=MOB_LAYER+1
density = 1
verb
Get()
set src in oview(1)
Move(usr)
drop()
set src in usr
src.loc = usr.loc

verb
Wear()
usr.overlays+=/obj/overlays/redshirt
usr<<"You wear the Red Shirt"
verb
TakeOff()
usr.overlays-=/obj/overlays/redshirt


usr<<"
You take off the Red Shirt"


but every thing works untill you log out and in.
This has been said time and time again. Overlays saved with a character cannot be removed. Remove the overlays, save them, then put them back.
In response to Garthor
But in games i play I have left the clothes on and then could take them off when i log out and in. There must be some way to fix this
In response to RPG Pro
Yes. You remove the overlays when you save, like I said.
In response to Garthor
Is there a way to automaticaly do that?
In response to RPG Pro
var/list/L
for(var/atom/movable/M in overlays)
L += M
del(M)
Write()
for(var/atom/movable/M in L)
overlays += M
del(M)
In response to Garthor
Where do I put that? o.O
In response to Garthor
Er... Garthor? You don't want to delete the items. Just remove them from the overlays list. =)

RPG, everything above the Write() line goes in your saving code. Everything below it goes in your loading code. Just remember to change the first del(M) to overlays-=M, and get rid of the second del(M). I think Garthor must have been sleep-deprived or something when he posted that. =P

<font size=-3>Ungh... sleep... bed... *falls asleep in his computer chair*</font>
In response to Crispy
Crispy wrote:
Er... Garthor? You don't want to delete the items. Just remove them from the overlays list. =)

RPG, everything above the Write() line goes in your saving code. Everything below it goes in your loading code. Just remember to change the first del(M) to overlays-=M, and get rid of the second del(M). I think Garthor must have been sleep-deprived or something when he posted that. =P

<font size=-3>Ungh... sleep... bed... *falls asleep in his computer chair*</font>

Where abouts in the save code?
In response to Crispy
Good point, I simply meant it just to be overlays -= M, but actually, that would be the saving code. He'd have to put all the things back on when reading it himself.
In response to Garthor
Oh... right... I get it now. You're adding the overlays back on after saving the character.

Okay, RPG, ignore what I said about various bits going in your loading and saving codes. That whole chunk that Garthor posted goes in your saving code. You do still need to replace the del() things though, like I said before.

For loading, you'd probably... uh... well, just make a proc that updates all the overlays on the character. Then call that once the character has loaded.
In response to Garthor
Garthor wrote:
This has been said time and time again. Overlays saved with a character cannot be removed. Remove the overlays, save them, then put them back.

That's really strange. I've never had a problem with Darke Dungeon overlays and save files. Perhaps it is because I access them as a resource file instead of as a type path.

overlays += 'fire.dmi'

instead of

overlays += /obj/fire
In response to Shadowdarke
Shadowdarke wrote:
Garthor wrote:
This has been said time and time again. Overlays saved with a character cannot be removed. Remove the overlays, save them, then put them back.

That's really strange. I've never had a problem with Darke Dungeon overlays and save files. Perhaps it is because I access them as a resource file instead of as a type path.

overlays += 'fire.dmi'

instead of

overlays += /obj/fire

^_^ thanks that worked and is a hell lot easier