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?
ID:178672
![]() Apr 18 2002, 2:27 pm
|
|
This is my code for my treasure chest
SChestclosed how would i make it to where after you click it it creates an item in your inventory? |
SuperGoku15 wrote:
This is my code for my treasure 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 > 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() 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. |
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 |
src.Move(usr)
Use that.