ID:145843
 
Code:
obj
proc
Respawn()
sleep(src.respawn)
loc=src.origloc

obj
tree
New()
..()
origloc=loc
verb/Cut()
set src in oview(1)
usr<<"You start cutting the [src.name]."
usr.stuff=1
sleep(50)
usr.stuff=0
usr.cutexp+=1
new /obj/items/log(locate(src.loc))
src.Move(null)
src.Respawn()
tree
name="Tree"
icon='puke.dmi'
respawn=1000


Problem description: Doesn't create a new /obj etc etc and doesn't Move to null, n'either does it respawn, might be because it doesn't move away. Ah well. Any help? o.o

I don't think move to null will work. You may be able to set the location to null to move it off of the map, but I wouldn't think telling something to move to null would work. I don't see anything in the Move help that says it accepts a Null argument to do anything, but someone correct me if I'm wrong. Hope that helps!
In response to Dragyn
I'm not quite sure that it does accept null, but you can always use
locate(world.maxx+1,world.maxy+1,1)


Which will send whoever is sent there to a null location.
In response to CaptFalcon33035
Wouldn't the src.Move() move to verb to somewhere? :S
In response to CaptFalcon33035
Why not just set loc to null directly?

loc=null
Well try this lol:
obj
proc
Respawn()
var/obj/A = new src.type
var/turf/T = src.origloc
var/resp = src.respawn
del(src)
sleep(resp)
A.loc = T
obj
tree
New()
..()
origloc=loc
verb/Cut()
set src in oview(1)
usr<<"You start cutting the [src.name]."
usr.stuff=1
sleep(50)
usr.stuff=0
usr.cutexp+=1
new /obj/items/log(locate(src.loc))
src.Respawn()
tree
name="Tree"
icon='puke.dmi'
respawn=1000
Thanks, the respawn is fixed but it still doesn't create a new item :|... T.T
In response to Stefm
Looks to me that your problem is deleting the source in the Respawn proc too soon.
obj
proc
Respawn()
var/obj/A = new src.type
var/turf/T = src.origloc
var/resp = src.respawn
del(src)//deleting the src stops the proc, since src is what's running it, meaning the next two lines are useless
sleep(resp)
A.loc = T


There are easier ways to do things like this, such as simply swapping icon states. If you were to make a state of a tree that was chopped, you wouldn't have to delete the old one and respawn a new one, simply do something like this..
mob
var
tmp
chopping=0/*always a good idea to set variables like this to tmp,
so they'll be reset when the mob logs back in, to prevent bugs.*/

obj
tree
New()
..()
origloc=loc
verb/Cut()
set src in oview(1)
if(src.icon_state!="chopped"&&!usr.chopping)//if the trees icon state isnt chopped and the usr isnt chopping
usr.chopping=1//set the users chopping, so people can't keep chopping over and over
usr<<"You start cutting the [src.name]."
usr.stuff=1
sleep(50)
usr.stuff=0
usr.cutexp+=1
usr.chopping=0//release chopping, so they can chop again
new /obj/items/log(locate(src.loc))
src.icon_state="chopped"//set it to chopped so a dead tree can't be chopped
sleep(src.respawn)
src.icon_state=""//reset the icon state so it can be chopped again
tree
name="Tree"
icon='puke.dmi'
respawn=1000


And a little friendly advice, you'll want to add some variables to stop players from being able to walk around while they're chopping wood (unless that's what "stuff" is), and to stop a person from macroing "Cut" at an insane speed. I showed an example of how to stop people from abusing Cut above.

-Edit-
You also might want to have the log appear in the persons' inventory instead of on the ground after they're done chopping, to prevent people stealing logs from other people.
In response to Mysame
the 'stuff' is one big variable to use on all actions. They can't move or anything when using it. Just didn't update the cut code because this new doesn't work. I tryed getting it into the usr's inventory, but it didn't work n'either.
tryed:
src.loc
usr.loc
usr
usr.contents

Nothing of 'em worked. :/
In response to Stefm
Try this.

new /obj/items/log(usr)
In response to Detnom
I love ya o.o. That worked! Didn't need the 'locate' part, I guess....Thanks a bunch!
In response to Stefm
Haha, not a problem. =) I try.