ID:266609
 
i wnt to make it so that when you talk to this guy, you can buy a sowrd, but then i want thte sword to be sent to the usr's inventory, wich i dot know how to create i have this for the sword seller...
*****************************CODE************************
Sword_Seller
icon = 'merchant.dmi'
verb
Talk()
set src in oview(1)
var/weapons = input("Would you like to buy a weapon?") in list ("Broad Sword", "Knife", "Dagger")
switch(weapons)
if("Broad Sword")
usr.Total_GP = usr.Total_GP - 50
usr.GoldCheck()
new/obj/item/sword(usr)

That creates an item in the users contents. That's all there is to it.
In response to Nova2000
yeah but wher do i put that line?



my friend wizdragon said to do this..

/obj/Sword
icon = 'Sword.dmi'
var/obj/o = new /obj/Sword

but it dusnt put the sword in the inventory, and he didnt get a chance to figger out y...
In response to Magnus VI
Put it in the buying proc.
Also don't forget to create the object that you point to when creating it.

As for wizdragon... I think that's another way of doing it, but I can't explain it, so I don't use it.