golddustarmor()
if(goldarmorcreation)
overlays-=obj/armorhp
view(8)<<"<b><font color='yellow'><small>Shield off."
goldarmorcreation=0
return
if(cdelay1)return
cdelay1=1
spawn(50)
cdelay1=0
view(8)<<"<b><font color='yellow'><small>Shield on."
var/obj/armorhp/K=new()
K.maptext="<b><font color=red><small>[round(maxhp/10)]"
overlays+=K
goldarmorcreation=1
Problem: The way I want this to work is, you activate the ability, and it gives you a shield. I want it to show a number under the user how much the shield is. It creates the overlay, but when the ability is deactivated, it doesn't get rid of the overlay.
Would anyone know why it does this?
First off, this shouldn't even compile (unless you have variables called "obj" and "armorhp"):
Secondly, you're (probably) trying to remove "/obj/armorhp", which is a type path, after adding "a new object instance", which is not equal to the thing you're trying to remove.
That's pretty much why you shouldn't expect it to work. It's no different from doing this: