ID:179158
 
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
One way would be to forego the variable and have a separate object/turf/whatever for each stage of growth... when it goes up a stage, create a new one and delete the old. Then, just define the verb under the third stage plant, and have the line

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."

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