ID:149739
 
LOL, Hey hows everyone doing at the code problem board? I got a little problem with my plants growing verb. I sorta had an idea how to fix it but can't seem to approch it right here take a look:

Plant()
set category="Agriculture"
if(usr.name == "Kalzimere")
usr << "You plant the seeds."
sleep(50)
new/obj/pflower(usr.loc)
else
usr << "You can't plant here."

The code above works fine except for to things. You see where it says "if(usr.name == "Kalzimere")" Well if i could some how get it to detect a specific type of turf that would be sweet lol. I tried using somthing like if(/turf/dirt in oview(0)) but that didn't seem to work. Secondly you see where it says new/obj/pflower(usr.loc). Well this also works ok but the plants pop up where ever teh usr is lol hence thats how i programmed it. But i like to make it so they pop up where they were planted. so i thougt using something like "set turf in oview(0) tag="[usr.name]plant"(i know this code makes no sense other then my crazy made up code world lol) then have the new/obj/pflower(usr.loc = ("[usr.name]plant"]). I hope that sorta makes sense and any help would be deeply apreciated thanks.

-kalzimere





Something like this would work for you first part:

if(isturf(src.loc))

For #2, you'll probably want to create an object right when you plant it (seeds) then change that object into the plant after the sleep proc finishes.
In response to Foomer
Alright thats what i was aslo thinkig for #2 lol. Im glad to here i wasn't the only one, im going to go try those suggestiong you made, ill get back to you if it works and thanks for your tiem and help.

-kalzimere
here for #1 i think i got a way, put like plant(turf/dirt as turf in world) instad of just plant()..............I think.


[edit]
You can make world to like view(1) or oview(1) or whatever you want.
I actually have made a demo for this:
TreeGrowth
Thanks to all of your help. Especialy that demo it really helped, i didn't see it when i looked before sorry. Thanks again.

-kalzimere