ID:167998
 
Baically, I'm trying to create a system, so that when you exit a vechicle, it will remember your previous icon and what overlays you had on immediatly, then restoring them, without any extenious lines of code checking mob/var. Thank you.
mob/var/origicon

mob/verb/Get_In()
usr.origicon=usr.icon
usr.icon='vehicle.dmi'
mob/verb/Get_Out()
usr.icon=usr.origicon
In response to Mysame
It works, but it does not save what overlays were on. Thanks, though.
In response to Bobthehobo
Overlays aren't saved because your changing your icon, then reverting to it. Make a var to save the overlays and then re-apply them, once the player Gets out.
In response to Verikai
The only system I can think of goes something like this:

        switch(usr.jumpsuit)
if("Green Jumpsuit")
// ect.


But it is way to long, as I need to name pretty much every object.



I tried this:

mob/var/origoverlays
mob/vehicle/verb/Get_Out()
usr.overlays += usr.origoverlays
//ect.


But, as I figured, it did not work at all.
In response to Bobthehobo
Well, if I get what you mean, you want to do something like this:

for(var/obj/O in origoverlays)
src.overlays += new O


I think that should work, if you put them in the list as typepaths. If you didn't you should get rid of the new.
In response to Kalzar
I didn't put them in as type paths, so I removed the new, but it didn't work. Thanks for trying...
In response to Bobthehobo
Bobthehobo wrote:
It works, but it does not save what overlays were on. Thanks, though.

Did you honestly think I was giving you a fully working code? You said that it's not changing overlays, then why not change it yourself?
In response to Mysame
Well, you should always try and give working code. If you give him code that you know doesn't work, then you aren't helping. Also, he specifically asked for overlays to save, which you didn't do.
In response to Kalzar
Yes, but I expect him to be smart enough to be able to change it. What would happen when we would give fully working codes in the first post in Developer how-To? Yes, many new games with a sourcecode the coder doesn't understand half of.
In response to Mysame
Maybe a couple of more clues of what to do could of helped. I wasn't expecting the answer, just clues or something.
In response to Bobthehobo
I gave you the biggest clue. All you have to do was change some vars.
In response to Mysame
But even after I did, it still did not work...
In response to Mysame
Um. No. What you gave him wouldn't help him with overlays at all. All it did was change his icon back and forth.
In response to Kalzar
And it can do the same with overlays! Isn't that just brilliant!
In response to Mysame
No it can't.
In response to Kalzar
mob/var/origoverlays
mob/verb/Save()
usr.overlays=usr.origoverlays
In response to Mysame
Did you try that? Besides not compiling, overlays is a special kind of list and you can't access it directly I don't think.
In response to Kalzar
I'm pretty sure it does because I'm using it....