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.
ID:267394
![]() Apr 4 2003, 8:26 pm
|
|
![]() Apr 4 2003, 9:17 pm
|
|
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.
|
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
|
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) |
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> |
Crispy wrote:
Er... Garthor? You don't want to delete the items. Just remove them from the overlays list. =) Where abouts in the save code? |
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.
|
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. |
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 |
Shadowdarke wrote:
Garthor wrote: ^_^ thanks that worked and is a hell lot easier |