That script needs some work (I would add logging, etc, and checks to make sure it hasn't already been picked up but not destroyed for some reason.
However, I would do something like
setImg( this.img );
and then
PHP Code:
temp.n = putnpc2( temp.dx, temp.dy, "" );
with ( temp.n )
{
join( "object_dropitem" );
this.img = "block.png";
this.weapon = "Staff/Abuse/Major/Bloo/Tool"; // shout-out to Bloo
}