ID:145333
 
Code:
obj/var/item=null
mob/verb/pickup(var/obj/O in get_step(usr,usr.dir))
if(O.item=="a")
var/Apple = 'Items1.dmi'
usr.icon_state="Holding"
usr.overlays += Apple
Apple.pixel_y = 20

obj/Apple
icon='Items.dmi'
icon_state="Apple"
pickup = 1
item="a"


Problem description:\
It says that "Apple.pixel_y" = Undefined var
How do i define it? i want it so when the pick it up, they get the overlay and it does up 20 pixels.

obj/var/item=null
mob/verb/pickup(var/obj/O in get_step(usr,usr.dir))
if(O.item=="a")
var/obj/Apple/a=new
usr.icon_state="Holding"
usr.overlays += a
a.pixel_y = 20

obj/Apple
icon='Items.dmi'
icon_state="Apple"
pickup = 1
item="a"


You need to create a new in order to edit its vars.
In response to Mysame
mob/verb/PickUp(var/obj/O in get_step(usr,usr.dir)) //I as icon)
if(usr.holding==1)
usr.Drop()
if(O.item=="a")
var/obj/Apple/Apple = new()
usr.icon_state = "Holding"
usr.overlays += Apple
Apple.pixel_y += 20
holding = 1
mob/verb/Drop(var/obj/O)
if(O.item=="a")
var/obj/Apple/Apple = new()
usr.icon_state = "Plain"
usr.overlays -= Apple
new.Apple(usr.loc.dir)
holding = 0
obj/Apple
icon='Items.dmi'
icon_state="Apple"
pickup = 1
item="a"


That's what I have now, Only the new is messed up and I'm not sure how to make it so when they drop it, the item shows up infront of them..
And the pixel_y is still messed up, the apple is created, but the overlay stays there.
In response to Nowatimean
pixel_y isn't being set for your overlay because you added the object to the overlays list before you set pixel_y. When you add something to overlays, it adds a copy of the object, not the object itself.

Lummox JR