ID:267156
 
this is my code:

obj/gold //define a "gold" prototype, which is a kind of obj
icon='gold.dmi' //set the default icon
var
amount //declare a new variable called "amount"
verb
get() //obj/gold/verb/get()
set src in view(1) //src must be close
usr << "You pick up [amount] gold."
usr.wealth += amount //add to usr.wealth
del(src) //delete the gold
drop()
set src in usr.contents
src.loc = locate(usr.x,usr.y,usr.z)
if(amount<=100)
icon_state="small"
if(amount>100 && amount<=1000)
icon_state="medium"
if(amount>1000)
icon_state="large"


the gold drops from NPCs, and I can pick it up, but there is no icon shown. How can I fix that?
There are no small, medium, or large icon_states.
In response to Garthor
but i drew them, so shouldn't it work?
In response to Mike_Wright
Icon states are CaSe SeNsItIvE
In response to Hanns
And the iconstate is only set IF a Drop verb is used.
In response to Hanns
so how do I make it so that the drop verb is always used?
In response to Mike_Wright
Example..
<code> mob/Attack(mob/M as mob in oview(1)) world << "[M] dies!" M.drop(M.wealth) </code>
At least, I think that's how it works..
Of course, this is only an example. :P
In response to Hanns
well I have this code under each NPC that causes them to drop. Maybe it has to be modified to show the icon_states.

Del()
var/obj/gold/G=new(loc) //create a new obj from the gold blueprint
G.amount=rand(50,500) //set its amount variable randomly
..() //call the parent
In response to Mike_Wright
Yep, just put your icon_state changing code in there somewhere (before ..() though, because ..() will cause src to be deleted when called within Del() - for obvious reasons :-) ).