ID:178672
 
This is my code for my treasure chest

SChestclosed
icon='Treasure Chests.dmi'
icon_state="Closed"
Click()
usr<<"<b>You found your shield in the chest!!"


how would i make it to where after you click it it creates an item in your inventory?
Click()
src.Move(usr)

Use that.
SuperGoku15 wrote:
This is my code for my treasure chest

> 
> SChestclosed
> icon='Treasure Chests.dmi'
> icon_state="Closed"
> Click()
> usr<<"<b>You found your shield in the chest!!"
>

how would i make it to where after you click it it creates an item in your inventory?

After it tells the usr that he has found his chest try using usr.contents += new /obj/My_Shield
SuperGoku15 wrote:
This is my code for my treasure chest

> 
> SChestclosed
> icon='Treasure Chests.dmi'
> icon_state="Closed"
> Click()
> usr<<"<b>You found your shield in the chest!!"
>

how would i make it to where after you click it it creates an item in your inventory?

Simple! Just create a new /obj/shield in the usr's inventory. Using usr is correct in this example. If it's not, the reference needs fixin' :)

Here's an example of how to use new():
mob/verb/your_verb()
world << "[usr] made a new rock!"
new /obj/rock(usr) // make a new /obj/rock in usr's inventory

That world output is just to fill the verb up a bit more. If you have any questions, feel free to ask :)

Of course, you'll have to deal with making sure the player can't get the sword more than once. I'll leave that as an exercise for you :)

Good luck.
=V

PS: Thief jack, your example is wrong because it's got incorrect syntax (mis-use of the new() proc), and Super16's example will move the treasure chest into the player's inventory.
In response to Vortezz
Vortezz wrote:
PS: Thief jack, your example is wrong because it's got incorrect syntax (mis-use of the new() proc), and Super16's example will move the treasure chest into the player's inventory.

I think Thief jack's version will also work. There are several syntaxes for new, which tends to be pretty forgiving. Still, new /obj/shield(usr) would have been my choice.

Lummox JR