ID:163111
 
Hi again : D

i was woundering how do i make a code that when u click on a tree it cuts it down and leaves logs(item)
obj
log
tree
Click()
..()
var/obj/log/T = new/obj/log
T.loc = locate(src.x,src.y,src.z)
spawn(1) del(src)

there is prob a cleaner way to do that but its nice and simple.
In response to Redlion (#1)
Yeah there is. You're over-complicating things. :P

obj
log
tree
Click()
..() //Depending on your obj Click() function, you may or may not want to call this
new/obj/log(src.loc) //No need for the variable, no need for explicit declaration, the new procedure takes a turf as an argument for location, and no need for locate.
spawn() del(src)
In response to CaptFalcon33035 (#2)
obj
log
icon='Logs.dmi'
tree
icon='Tree.dmi'
Click()
..()
new/obj/log(src.loc)
spawn() del(src)


im using that but it says New Char.dm:115:error::empty type name (indentation error?)
In response to Chrislee123 (#3)
Chrislee i have a verry serious question to ask you and that is: did you read the DM Guide and DM Reference? because im getting this huge vibe that you didnt, because i started out like you asking about a billion questions here and a few people helped me but most pointed me to the DM Guide which really helped me, so check it out its on the left of this page under the Resources block, the 3rd link from the top of the Resources block.

hopefully you read this all the way through (dont skim) and it helps ^__^
In response to VolksBlade (#4)
i always look at it but its really hard to find the article your looking for thats why i ask so meny quesions i have tryed looking at it.