turf/obj/anvil
icon = 'OBJ.dmi'
icon_state = "anvil"
layer=4
density=1
verb
Smith()
set src in oview(1)
if(!(locate(/obj/Items/Smith/Hammer) in usr.contents))
usr << "<font size=1><font color=yellow>You need a hammer to start smithing!"
return
else
var/smithing = input("What would you like to create?","SMITH MENU")in list("Iron Sword","Cancel")
if(smithing == "Iron Sword")
var/Iron_Bar = 0
for(var/obj/Items/Smith/I in usr.contents)
if(istype(I,ironitemType))
Iron_Bar++
if(Iron_Bar>=5)
for( var/i = 0; i < 6; i++ )
var/obj/Items/Smith/B = locate() in usr.contents
if(istype(B,ironitemType))
if( istype( B, ironitemType ) )
del(B)
usr.contents+=new/obj/Items/equipment/arms/right/Iron_Sword
usr << "<font size=1><font color=green>You smith an Iron Sword!"
return
else
usr << "<font size=1><font color=yellow>You need 5 iron bars to make an Iron Sword!"
return
Problem description:
Ok, the problem is that when I smith, only 4 ores gets taken away and after that it doesn't take away anymore ore to create the sword. I dont know whats wrong b/c it compiles, though i'm guessing it with the loop.
I'd place datums in the list, but you could always associate text names of the items with a list of it's requirements.