mob
verb
pull_grass()
var/turf/grass/g
if(istype(usr.loc,/turf/grass))
for(g in usr.loc)
if(g.grassleft>=1)
usr.grass_pieces+=1
g.grassleft-=1
usr<<"You picked some grass"
if(g.grassleft<=0)
g.icon_state="grass2"
return 0
it doesn't work, but if you put in world where the red part is it works, but not how I want it to. How do i get it to work for the grass in the users loc?
ID:261275
![]() Nov 24 2001, 7:40 am
|
|
Lummox JR wrote:
Since you're standing on one turf, and you're checking to see if it's the right type anyway, instead of using a for() loop, try this: g=usr.loc That ought to work. So I do: mob verb pull_grass() var/turf/grass/g g=usr.loc if(istype(usr.loc,/turf/grass)) for(g in usr.loc) if(g.grassleft>=1) usr.grass_pieces+=1 g.grassleft-=1 usr<<"You picked some grass" if(g.grassleft<=0) g.icon_state="grass2" return 0 ????????????????????????? Not quite sure what you mean. |
Air _King wrote:
Lummox JR wrote: g=usr.loc That ought to work. |
Evilkevkev wrote:
Air _King wrote: g=usr.loc That ought to work. Ok so like this: mob verb pull_grass() var/turf/grass/g g=usr.loc if(istype(usr.loc,/turf/grass)) for(g in world) if(g.grassleft>=1) usr.grass_pieces+=1 g.grassleft-=1 usr<<"You picked some grass" if(g.grassleft<=0) g.icon_state="grass2" return 0 |
Air _King wrote:
Lummox JR wrote: Gads no. My point was to replace your for loop with the assignment, like this: mob/verb/pull_grass() Lummox JR |
Lummox JR wrote:
Air _King wrote: mob/verb/pull_grass() Lummox JR Oh, thanks!!! |
That ought to work.
Lummox JR