ID:138927
 
What is wrong with this snippit of code (yes I know its old and outdated) It all compiles with no errors and the object shows on the map fine and into the inventory but when I go to equip it the obj does not show up any idea why


obj
Outfit
name = "Outfit"
icon = 'OutfitS.dmi'
icon_state = "gear"
verb
Equip()
if(src.worn)
eq=0
src.worn = 0
usr.overlays -= src.icon
usr.overlays += usr.hair

else
eq=1
src.worn = 1
usr.overlays += src.icon
usr.overlays -= usr.hair

Drop()
if(src:worn == 1)
usr << "Not while its being worn."
if(src:worn == 0)
src.loc=locate(usr.x,usr.y-1,usr.z)
Get()
set src in oview(1)
src.loc = usr
usr<<"You picked up a [src]"


Note: I was using a grid inventory but I had the same issue the + it would only allow 1 thing equiped at a time and i would not like players goin around nude just so they can equip that sword they worked so hard to get
Layer.

If your overlay is derived from obj, then it will appear as an underlay on the player. Try setting its layer to MOB_LAYER+1 and see what happens.

- Hashir
In response to Hashir
That did the same thing
In response to Wrath69
Just noticed something in your code.

usr.overlays += src.icon



Try using path to add the overlay instead of trying to add its icon on the player. Something like:


obj/sword
// icon, name etc goes above
layer = MOB_LAYER+1

verb/Equip_Sword()
if(usr.alreadywearing)
return
else
usr.overlays += /obj/sword
usr.alreadywearing = 1


If there are still problems, let me know.

- Hashir
In response to Hashir
Got it thanx for the help