I have been fourm seaching on overlay help for 2 hours now. But I still have no clue. What I need is too remove the overlays at logout and re-add them at log in.
ex. I equip armour, I logout which is saving myself, I log back in and unequip my armour, its goes away.
thats what I need. at the moment I have: I equip armour, I logout which is saving myself, I log back in and unequip my armour, its DOES NOT go away!!
And please just post a small snippet. I cant do it myself :(
ID:174021
Oct 11 2003, 4:33 pm
|
|
In response to Crispy
|
|
Im using deadrons char handaling, and its late at night so I cant even grasp what your saying, please explain further and ill figure it out in the morning
|
In response to Jermman
|
|
I had the problem too. When I was setting my overlays for armor and such I always used the armor item itself so in my armor code the usr.overlays += src which worked fine as long as I didnt log out and back in. If I did I had the same problem you have. So what I did was make a new var for my armor and set it with just an icon command and I called it ArmorIcon so it was ArmorIcon = icon('icon',"icon_state") obviously I replace those with the actual dmi and icon state for that armor part. Then I just set the overlays += src.ArmorIcon and it worked flawlessly with the save and load and all.
|
In response to Jermman
|
|
I don't know if it can be explained any simpler... but I'll try...
Okay, first off, you probably have a line or two in your equipping code that says something like "usr.overlays+=src", right? Well, get rid of it. =) Instead, after you've equipped the item call a proc; let's call it OverlayRefresh(). So then you have to actually make OverlayRefresh. Loop through all of the items the player has equipped, and add it as an overlay to the character. The problem happens because the overlays and base icon are actually saved as ONE icon in the savefile. So you need to remove the overlays before saving, and add them again just after loading. To remove the overlays, set the player's overlays var to null. To add them again, call OverlayRefresh(). |
In response to Crispy
|
|
Ive got a really easy way to do it, and it works just fine. Ill show you how. Here is a example:
/obj/equipemnt/armor1 var/ARMR = 'armor.dmi' verb Equip() usr.overlays += ARMR Remove() usr.overlays -= ARMR That should work just fine, it does for me. |
In response to Shades
|
|
But that won't stop the overlay saving with the icon, which is the whole point.
|
In response to Shades
|
|
Shades wrote:
Ive got a really easy way to do it, and it works just fine. Ill show you how. Here is a example: Save the game with the overlays left on, and log-off and back on, and see what happens. What crispy is trying to explain, is a way to avoid having the overlays saving then the client logs off. |
In response to Lazyboy
|
|
The way I avoided it was like I said above. And I dont save the icon. At all.
|
In response to Aridale
|
|
Thanks to all who replied ill try that now.
|
In response to Aridale
|
|
W00T! Thanks alot that idea works. and its not much too add to my code, just 2 more lines for every item. thx!
|
overlays=null
Then make a proc which updates your overlays. Instead of adding overlays individually when required, simply call that proc, which refreshes all the overlays. It works quite well.