ID:138960
 
Code:
mob/Joshua
icon = 'mobs.dmi'
icon_state = "Joshua"
gender = "male"
HP = 100
lvl = 20
player = 0
unhexable = 1
Npc = 1
verb/Buy_a_wand()
set src in oview(2)
if(/obj/wand in usr)
usr << "<font color = red><b>Joshua says:</font> I have already given you wand."
return
else
if(usr.Gold < 50)
usr << "It costs 50 galleons to buy a wand, you don't have enough!"
else
usr << "<font color = red><b>Joshua says:</font> You need a wand from me?"
sleep(20)
usr << "<font color = red><b>Joshua says:</font> I happen to be an experienced wand maker, I am Ollivander's nephew.. still cry about his death, but the fact that I am continuing what he used to do makes me happier!"
sleep(60)
usr << "<font color = red><b>Joshua says:</font> Bah, enough of that, you are here for a wand."
sleep(30)
usr << "<font color = red><b>Joshua says:</font> Well, the wand chooses the wizard , so this will take a while. . ."
step_rand(src)
sleep(40)
usr << "<font color = red><b>Joshua says:</font> Hmm"
step_rand(src)
usr << "<font color = red><b>Joshua says:</font> Try this one, and say ''Accio!''"
sleep(20)
step_rand(src)
usr << "<b>You: Accio!"
sleep(10)
step_rand(src)
usr << "<i><b>A book falls"
sleep(30)
usr << "<font color = red><b>Joshua says:</font> Nope, doesn't work!"
step_towards(src,usr)
sleep(30)
usr << "<font color = red><b>Joshua says:</font> This seems good.. try it!"
sleep(40)
usr << "<b><i>You flick the wand, and you see a cut on the table."
sleep(20)
usr << "<font color = red><b>Joshua says:</font> Oh god.. this will take a while. . . "
sleep(30)
usr << "<font color = red><b>Joshua says:</font> How about this one?"
sleep(30)
usr << "<font color = red><b>Joshua says:</font> Yes yes! It's perfect!"
sleep(20)
usr << "<font color = red><b>Joshua says:</font> That will be 50 galleons!"
usr.Gold -= 50
new/obj/wand(usr)


Problem description:
When you use the verb "Buy a wand" the game is supposed to check you for /obj/wand. If you don't have a wand, he checks your money , if you have enough , he talks and gives you a wand. once you have the wand, and you talk to him again, he still talks and gives you a wand.

You'll need to utilize the locate() proc, as it stands you're simply checking for a type-path inside of a list, which it won't find.

var/obj/my_obj/O = locate() in contents
if(O) // If the player has a my_obj
// do stuff
else // If they don't
// do other stuff.
In response to Nadrew (#1)
Thanks, this works.