ID:146468
 
Code:
turf
box
icon ='turf.dmi'
icon_state ="box"
density=1
var/on=0
verb
Box()
set src in view(1)
if(usr.on == 0)
usr.overlay ='box.dmi'
usr << "Your hiding under a box"
else
usr.overlay =''
usr << "you take off the box"


Problem description:
I need it to be when you put the box on it dissappears and goes onto you and dosn't still sit in the corner.

turf
box
icon ='turf.dmi'
icon_state ="box"
density=1
var/on=0
verb
Box()
set src in view(1)
var/a = icon('box.dmi')
if(usr.on == 0)
usr.overlay +=a
usr << "Your hiding under a box"
else
usr.overlay -=a
usr << "you take off the box"


I think that should work, if icon() doesn't try new, or try new /obj/box which would mean you would have to change turf to icon as the parent.
In response to N1ghtW1ng
Code:
turf
box
icon ='turf.dmi'
icon_state ="box"
density=1
var/on=0
verb
Box()
set src in view(1)
var/a = icon('box.dmi')
if(usr.on == 0)
usr.overlay +=a
usr << "Your hiding under a box"
else
usr.overlay -=a
usr << "you take off the box"

Problem:
I get these earrors,
turf.dm:73:error:usr.on:undefined var
turf.dm:74:error:usr.overlay:undefined var
turf.dm:77:error:usr.overlay:undefined var
In response to Animekid09
mob
var
on

turf
box
icon ='turf.dmi'
icon_state ="box"
density=1
on=0
verb
Box()
set src in view(1)
var/a = icon('box.dmi')
if(src.on == 0)
usr.overlays +=a
usr << "Your hiding under a box"
src.on=1
else
usr.overlays -=a
usr << "you take off the box"
src.on=0




That should work :)
In response to O-matic
Code:
mob
var
on=0

turf
box
icon ='turf.dmi'
icon_state ="box"
density=1
on=0
verb
Box()
set src in view(1)
var/a = icon('box.dmi')
if(src.on == 0)
usr.overlays +=a
usr << "Your hiding under a box"
src.on=1
else
usr.overlays -=a
usr << "you take off the box"
src.on=0

Problem:
turf.dm:73:error:on:undefined var
turf.dm:78:error:src.on:undefined var
turf.dm:81:error:src.on:undefined var
turf.dm:85:error:src.on:undefined var
turf.dm:77:error:icon:bad proc
turf.dm:78:error::invalid expression
turf.dm:77:a :warning: variable defined but not used
In response to Animekid09
Dont just copie and paste from the forums, copie and paste it and tab it correctly.

O-matic
In response to O-matic
i did and it still didn't work
In response to Animekid09
did it give the same errors?
In response to O-matic
yeah
In response to Animekid09
mob
var/on = 0
obj
box
icon ='turf.dmi'
icon_state ="box"
density=1
verb
Box()
set src in view(1)
if(usr.on == 0)
usr.overlays += /obj/box
usr << "Your hiding under a box"
else
usr.overlays -= /obj/box
usr << "you take off the box"
In response to MagicBLC13
why not just do..
mob/var/on = 0
obj/Box
icon = 'whatever.dmi'
layer = 10
//include all that crap
verb/Hide()
if(usr.on)
usr.on = 0
usr.loc=locate(src.x,src.y+1,src.z)//Moves them away form the box.
return
else
usr.on = 1
usr.loc=locate(src.x,src.y,src.z)//Locates them ON the box
return
In response to Flame Sage
K thanks i got it.
In response to Animekid09
Or, you could just change the layer of the box so that it is above you so when you walk on the tile you are under it and it hides you. If you wanted that....