mob
npc
Barber
icon='npc barber.dmi'
name="{NPC} Barber"
NPC=1
Click()
switch(alert("Would you like a hair cut?",,"Yes","No"))
if("Yes")
usr.overlays-='afro.dmi'
switch(alert("What style would you like?",,"Bald","Afro","Aizen"))
if("Bald")
usr.overlays-='afro.dmi'
usr.overlays-='aizen.dmi'
return
if("Afro")
var/hair='afro.dmi'
var/color=input("What color?","Color")as color
hair=initial(hair)
hair+=color
usr.overlays+=hair
return
if("Aizen")
var/hair='aizen.dmi'
var/color=input("What color?","Color")as color
hair=initial(hair)
hair+=color
usr.overlays+=hair
return
if("No")
return
Problem description: This adds the overlays just fine. Problem is, it won't remove them afterwords. Essentially I need to be able to reset the hair overlays that are on the mob each time, so they're not layering on top one another and making things look strange. Unfortunately that's exactly what is happening.
My advice would be to use an overlay manager structure to associate overlays with a unique string name. For things like hair, that the player should only have one of at a time, this will ensure that the old overlay is removed prior to adding the new one. Just make sure the same type of thing uses the same name for the id category.