ID:149966
 
im making an armor system that when you put it on it makes your name "Red Knigh [name]" i want it to save how the name is before i put it on so that when i take it off it puts my name back to normal because i use prefixes for the GMs. How would i do that?
When the player logs in, make a var store the name..

mob/var
name_store
Login()
usr.name_store = usr.name // store the name


Then for the armor things..

obj/Armor
verb
Wear()
usr.name = "Red Knight [usr.name]" // change the name upon wearing
Remove()
usr.name = usr.name_store //restore the name when you unequip.


Hope i helped.

-Rcet
In response to Rcet
Good code, but I think I see a bug. What if the player logs out with the armor on, and the code sets his name to Red Knight <name> ? That would be a problem and a half.
In response to Mertek
thats easy to fix. Thanks for pointing that out. Just make first timers store the name. Example:
mob/var
name_store
first_time = 0

mob
Login()
if(usr.first_time == 0)
usr.name_store = usr.name
usr.first_time = 1
else
//login code here

obj/Armor
verb
Wear()
usr.name = "Red Knight [usr.name]" // change the name upon wearing
Remove()
usr.name = usr.name_store //restore the name when you unequip.


-Rcet

In response to Rcet
well the problem with that is i have titles like [GM]Scoobert(i dont use that one its just an example) but the first time you login the Name is just plain Scoobert. But i think i see a way to fix that. How would i make it so when i logout its takes off the armor?
In response to Scoobert
Just call the verb.

mob
Logout()
/obj/armor/verb/Remove()


-Rcet
In response to Rcet
Or just remove it from overlays:


mob/Logout()
src.overlays-=/obj/armor
del src
In response to Nadrew
just so you know its not overlays i change the icon its self.
In response to Scoobert
mob/Logout()
src.icon=initial(icon)//change it back to default
del src



And you should learn to use overlays, they cut down on download time, and leave more options open.
In response to Nadrew
well my problem with over lays is im using fullicons, Im not using one icon for helmet and one for gloves, im using many icons for status like an amry has a diffrent icon than a started and i have a diffrent icon because im the king. and i could not make a one size fits all icon for a helmet. But this is a full suit of armor im making. So the intire icon needs to be changed.

oh ya thats name thing doesnt work rec... what ever your name is. Im not sure why it looks like it should but it doesnt. Im going to fidle aroun with it a little to see if i can get it to work.
{EDITED}



Well screw it it was a good idea gone bad. I fix one problem then i get another, i will just have to add the title to them myself. but thanks for trying to help.