ID:174722
 
i cant find anything to help me use chests in my game. i wan to be able to open them and find poop.
obj/chest
verb/Open()
usr<<"You found poop"
In response to SSChicken
This ought to work,

obj
chest
verb
Open()
var
open
Click()
open = input("Do you want to take the poop?","OPEN",) in list("Yes","No")
if(open == "Yes")
new/obj/poop(usr)
return
else
usr << "you leave the poop in the chest"


hehe sorry the window was kinda small ^_^
In response to Sanuro
Nope that won't work. You can't have Click() inside a verb.
In response to SSChicken
then where can i put click?
In response to Polaris139
oh ok, will it work without the click() part then?
In response to Polaris139
You can put click() instead of verb()
In response to SSChicken
my chest opens and gives me the contents as many times as i open it, how do i make it so it only gives me the contents once?
In response to Polaris139
make an extra variable in the chest, say opened = 0
and when the chect is opened, check the variable
if(opened == 0)
opened = 1
/code here

else
usr/src << "This chest has been opened before"

i dont know if this is totally correct so will someone please fix any errors in here
mob/var/chest1 = 0

obj/chest
//add icon and state
Click()
//everyone can open it once
if(usr.chest1 == 0)
usr.chest1 = 1
usr << "you got some poop"
usr.contents += /obj/poop
else
usr << "you have already opened this before"