ID:143690
 
    iron_rock
verb
Pick()
set src in oview(1)
set category= "Iron Rock"
if(usr.mng>=1)
if(usr.contents.Find(/obj/iron_pick))
usr << "You get an iron ore! You gain 3 XP for mining!"
usr.mngxp+= 3
new/obj/iron_ore(usr)
del(src)
else
usr << "You don't have a pickaxe!"
else
usr << "You failed to mine it!"
icon= 'm&s.dmi'
icon_state= "iron"
density= 1
name= "Iron Rock"


Problem description: I compliled it and I got no errors or warnings but when I test it, it doesn't seem to work. I get an Iron Pick and when I click the Pick verb, it says I don't have a pickaxe. This is more of a in game problem. Do I need to use something else?

if(usr.contents.Find(/obj/iron_pick)


I'm not sure you can do that, try this.

var/found = 0
for(var/obj/iron_pick/I in usr)
usr<<"you get exp or whatever"
found = 1
break
if(!found)
usr<<"You dont have a pick."

In response to Smokey Joe
Smokey Joe wrote:
if(usr.contents.Find(/obj/iron_pick)

I'm not sure you can do that, try this.

> var/found = 0
> for(var/obj/iron_pick/I in usr)
> usr<<"you get exp or whatever"
> found = 1
> break
> if(!found)
> usr<<"You dont have a pick."
>


You should also be able to use:

if(locate(/obj/iron_pick) in usr.contents)
In response to Foomer
Aha, I knew there was a better way.
In response to Foomer
Ah, thanks, Foomer.
In response to DadGun
Ok, I made it where the player can smelt ore into bars, here is the code:
    furnace
verb
Smelt_Iron()
set category= "Furnace"
set src in oview(1)
if(usr.sth>=1)
if(locate(/obj/iron_ore) in usr.contents)
usr << "You make an iron bar! You gain 3 XP for Smithing!"
usr.sthxp+= 3

Nothing is wrong with it, but I want to know how to delete ore or change it into a bar.
In response to DadGun
What was wrong with what you had in the first post?
In response to Foomer
I would pick up a Iron Pick (like I coded it) and it said "I don't have one" which messed it up, but now it works.