ID:174605
 
I have this code :

mob
verb
testoozaru()
if(usr.moon == 1)
usr<<"You see the full moon shining in the sky!"
view(6)<<"[usr] : AHHAHAHAHHHH!"
for(var/mob/characters/M in oview(6))
M.sight = 1
sleep(2)
usr.icon = 'oozaru.dmi'
usr.icon_state = "t1"
usr.oozaru = 1
usr.overlaysave -= usr.overlaysave
usr.overlaysave = usr.overlays
usr.overlays -= usr.overlays
usr.overlays += /obj/oozaruhead
for(var/mob/characters/M in oview(6))
M.sight = 0
sleep(50)
usr<<"You revert to normal size!"
view(6)<<"[usr] : AHHAHAHAHHHH!"
for(var/mob/characters/M in oview(6))
M.sight = 1
sleep(2)
usr.icon = 'male-olive.dmi'
usr.icon_state = ""
usr.oozaru = 0
usr.overlays -= usr.overlays
usr.overlays = usr.overlaysave
for(var/mob/characters/M in oview(6))
M.sight = 0

//--------------------


But when the time is up, he goes back to his icon 'male-olive', but he is bald, and naked! Why don't his overlays come back? And how can I fix this???

~GokuSS4Neo~
Everyone is a newbie, just some more than others!
make a variable called:
hairover, or hairoverlays, or something, and when they make their person, have it set it to the icon.
as for the clothes and stuff.
var/worn (variable if its worn)
just add this:
for(var/obj/O in usr.contents)
if(O.worn == 1)
usr.overlays += O

and that puts clothes back on.
In response to JackGuy
Ok, thankz!

Just wondering, why wouldn't my method work?

~GokuSS4Neo~
In response to Gokuss4neo
Now something odd is happening. Instead of them being added again as overlays, they come back as underlays! This make NO sense!!
Here is the code:

mob
verb
testoozaru()
if(usr.race == "Saiya-jin"||usr.race == "Half-Saiyan")
if(usr.moon == 1)
if(usr.ssj ==null||usr.ssj==0)
usr<<"You see the full moon shining in the sky!"
view(6)<<"[usr] : AHHAHAHAHHHH!"
for(var/mob/characters/M in oview(6))
M.sight = 1
sleep(2)
usr.icon = 'oozaru.dmi'
usr.icon_state = "t1"
usr.oozaru = 1
usr.overlays -= usr.overlays
usr.overlays += /obj/oozaruhead
for(var/mob/characters/M in oview(6))
M.sight = 0
sleep(50)
usr<<"You revert to normal size!"
view(6)<<"[usr] : AHHAHAHAHHHH!"
for(var/mob/characters/M in oview(6))
M.sight = 1
sleep(2)
if(usr.hair == "Spikey")
usr.overlays += 'hair_black_spikey.dmi'
if(usr.hair == "Long")
usr.overlays += 'hair_black_long.dmi'
if(usr.hair == "Short")
usr.overlays += 'hair_black_short.dmi'
if(usr.hair == "Goku")
usr.overlays += 'hair_goku.dmi'
if(usr.hair == "Vegeta")
usr.overlays += 'hair_vegeta.dmi'
if(usr.skin=="Pale")
usr.icon = 'male-white.dmi'
if(usr.skin=="Tan")
usr.icon = 'male.dmi'
if(usr.skin=="Dark Black")
usr.icon = 'male-black.dmi'
if(usr.skin=="Olive")
usr.icon = 'male-olive.dmi'
usr.icon_state = ""
usr.oozaru = 0
usr.overlays -= /obj/oozaruhead
for(var/obj/O in usr.contents)
if(O.worn == 1)
usr.overlays += O
for(var/mob/characters/M in oview(6))
M.sight = 0
In response to Gokuss4neo
Probably because your adding the overlays before the icon, then when you add the icon it goes obove the overlays. Try doing the overlays after the icon part
In response to Gokuss4neo
also, I'd suggest using spawn() after for(), in EX:

for(var/mob/M in oview(6,usr)
spawn()
M.sight=0
that way, all of their variables will be changed instantaneously. And, why are you using "Zeta" programming/icons? O.o
In response to Koolguy900095
It already is after the icon bit! :P

~GokuSS4Neo~
In response to Gokuss4neo
No its not...
                                              if(usr.hair == "Spikey")
usr.overlays += 'hair_black_spikey.dmi'
if(usr.hair == "Long")
usr.overlays += 'hair_black_long.dmi'
if(usr.hair == "Short")
usr.overlays += 'hair_black_short.dmi'
if(usr.hair == "Goku")
usr.overlays += 'hair_goku.dmi'
if(usr.hair == "Vegeta")
usr.overlays += 'hair_vegeta.dmi'
if(usr.skin=="Pale")
usr.icon = 'male-white.dmi'
if(usr.skin=="Tan")
usr.icon = 'male.dmi'
if(usr.skin=="Dark Black")
usr.icon = 'male-black.dmi'
if(usr.skin=="Olive")
usr.icon = 'male-olive.dmi'


See your adding the overlays before the icon and when you add the icon its probably going over the overlays...
In response to Koolguy900095
Overlays are on a special layer, that isn't the problem. :|
In response to Jnco904
Not really...In my game I have to set the layer to mob_layer+1 when its worn or else it shows as an underlay..
In response to Koolguy900095
Oops! I didn't make myself very clear! The hair overlays are fine! It is the other overlays :

for(var/obj/O in usr.contents)
if(O.worn == 1)
usr.overlays += O

That appear as underlays!

~GokuSS4Neo~
In response to Koolguy900095
Then there is probably something else causing your problem. Look up overlays var in the help section of DM to read about the float layer. :)
In response to Jnco904
I know there is another problem..lol.. that's why I posted in the first place. But I can't work out how to fix it, or even what the problem is! The overlays normally work fine, they are always where they are meant to be an so on, but in this verb they go wrong! Can someone please help?

Thank you for your time!

~GokuSS4Neo~
In response to Gokuss4neo
That reply was to Koolguy. :P

As for your problem the only think I can think of is that maybe overlaysave isn't defined as a list(which it may not even need to be, I'm not sure). Hope that helps.
In response to Jnco904
That's what I thought might be wrong, before I even posted, but I have checked it, and it is a list!

~GokuSS4Neo~

P.s. Any chance this could be a BYOND bug?
In response to Gokuss4neo
Hmmm, I don't know how I missed this:

usr.overlays += /obj/oozaruhead

I don't think this can be done like that, it looks like it's adding a type path. It's probably better to add the .dmi instead. :)
In response to Jnco904
Lol, that part of the coding works fine though! And I have to add it like that, because it is making him a multi-tiled mob, and the obj :
obj/oozaruhead
pixel_y = 32
icon = 'oozaru.dmi'
icon_state = "t2"

is made to BE an overlay!

I am sure this part is not the problem!

~GokuSS4Neo~

P.s Thankz anyway!
In response to Gokuss4neo
Well. I would think you would atleast have make in a new obj or refer to an already made one. Other than that I have no clue though, sorry.
In response to Gokuss4neo
for(var/obj/O in usr.contents)
if(O.worn == 1)
O.layer = MOB_LAYER+1
usr.overlays += O

That should put it right above the mobs icon. try that.
In response to JackGuy
It worked! It actually worked!!! I am SOOO happy! I'll put you in my credits!!! Thank you!

~GokuSS4Neo~

P.s If you have a character on Raekwon's Zeta version 46, just say, and I'll give you 50,000 zenni!