ID:155478
 
hi all

I'm trying to check for the axe in my "back Pack" before the usr can chop down the tree:

obj

tree
icon = 'enviroment.dmi'
icon_state = "tree"
density = 1

verb
chop()
set src in view(1)
if(/obj/axe in contents) // <-- this is my problem. Need to chek if Axe is in contents but it doesnt seem to be checking
switch(alert("Chop down tree?",,"Yes","No"))
if("Yes")
var/obj/wood/w = new(locate(src))
w.desc = "Wood"
del src

if("No")
return
else
usr << "You have no axe. You should find one or buy one"
You're checking if the type path is there, instead you need to use the locate() proc with the type path.
In response to Kalzar
ah thanks :)
In response to Saladon
sorry to bug you once again. But please could you help me fix this. I want to create a seperate object(wood) in place of the the fallen tree:

                    switch(alert("Chop down tree?",,"Yes","No"))
if("Yes")
var/obj/wood/w = new(locate(src.loc))
w.desc = "Wood"
del src

if("No")
return
In response to Saladon
dont worry i fixed it. :)