How do you make it so that a verb would only appear if:
A variable is equal to 3 (or some other number)
And I'm next to the object
I'm trying to get a tree (the object) to have a Plant verb show up, when it's in it's third stage (It's Ripe) and the usr is next to it.
Thanks in Advance
ID:179158
Feb 10 2002, 3:11 pm
|
|
You can do it like this:
obj New() spawn(100) Grow() //start growing proc Grow() grow_num++ icon_state = "tree[grow_num]" if(grow_num == 3) //once it is in it's final stage verbs += /obj/proc/Pick else spawn(100) Grow() //if not done growing, continue growing Pick() set src in oview(1) grow_num-- //remove fruit from tree icon_state = "tree[grow_num]" //reset icon spawn(100) Grow() //continue cycle verbs -= /obj/proc/Pick //don't allow picking |
set src in oview(1)
at the top of the verb's code. This line tells the computer "This verb can be used by anyone exactly one square away from the source."