ID:139394
 
obj/wooden_hatchet
icon='wooden hatchet.dmi'
icon_state="wooden hatchet"
verb
Use()
set src in usr //So the player only gets the verb when the hatchet is in their inventory.
for(var/turf/Tree/t in oview(1)) //Looks for a tree within one tile of the player.
if(t) //If one is found..
if(t.icon_state=="chopped") //If the tree is already chopped down.
usr<<"Oh my! This tree is already chopped down!"
return
if(t.icon_state=="unchopped") //If the tree isn't already chopped.
t.icon_state="chopped" //Makes the tree chopped down.
usr.contents+=new/obj/raw/log //Adds 'wood' to the player's inventory.
usr<<"You chopped down the tree for wood!"
return
usr<<"Oh no! There are no nearby trees!" //Displays this if no trees are nearby.


I made the tree icon and put the stump in the same icon file with the state name of both icons, but now everytime I go to the map, it doesn't show the trees, Why?

Do you mean they don't show up at all during runtime, they don't show up as stumps when you cut them down, or they don't show up in the map editor at all?
Well the problem is where you defined the tree's initial icon state. You'll find that under

turf
//Tree, or whatever.


somewhere. What you've shown us is just a verb under the hatchet.
In response to ANiChowy (#1)
They don't show up on the map editor or during runtime.
In response to Kyle_ZX (#2)
I did that already only I made it an object.
In response to Bigmnm (#4)
This might help you.
In response to Emasym (#5)
It worked perfectly fine for me. Let me show you what I did, was just a slight modification.

<DM>obj/wooden_hatchet
icon='wooden hatchet.dmi' // Of course, same icon file tp use
icon_state="wooden hatchet" // The icon state
verb
Use() // Verb telling you to use it
set src in usr //So the player only gets the verb when the hatchet is in their inventory.
for(var/obj/Tree/t in oview(1)) //Looks for a tree within one tile of the player. EDIT: Changed it to an obj since that makes it more practical.
if(t) //If one is found..
if(t.icon_state=="chopped") //If the tree is already chopped down.
usr<<"Oh my! This tree is already chopped down!"
return
if(t.icon_state=="unchopped") //If the tree isn't already chopped.
t.icon_state="chopped" //Makes the tree chopped down.
usr.contents+=new/obj/log //Adds 'wood' to the player's inventory. Edit: Took out the 'raw' part by backspacing. Is pretty useless at this time
usr<<"You chopped down the tree for wood!"
return
usr<<"Oh no! There are no nearby trees!" //Displays this if no trees are nearby.

obj/log
icon='log.dmi'

obj/Tree // Defines the Tree so it can work when you try to use it in your code
icon='Tree.dmi' // This is the tree icon file!
icon_state="unchopped" // IMPORTANT INFO: Thee icon stae of the tree. It must be "unchopped" from the get-go. If you put this without an icon state, it could cause some problem. So yeah, just put the unchopped icon state on the initial tree.
In response to Gtgoku55 (#6)
Nothing seems to be working!
In response to Bigmnm (#7)
Do... You... Compile ... ?
In response to Emasym (#8)
Of course I compiled. I'm not stupid -_-
In response to Bigmnm (#9)
<.< Can you show pics? Also, just copy and paste my code than fill in the icon files.
In response to Gtgoku55 (#10)
Gtgoku55 wrote:
<.< Can you show pics? Also, just copy and paste my code than fill in the icon files.

I did copy and paste and by the way I don't know how I would show you the icons. Besides why does it matter? Because I already named the icon states.
Hmmm, do you have the tree on a turf which has its layer var edited to a higher layer than that of the tree?
Because that'd definitely stop it from showing up on the map editor.
In response to Divine Soldier (#12)
What do you mean? I have trees on turf yes.
In response to Bigmnm (#13)
He means drawing layer.
In response to ANiChowy (#14)
I put the trees over turf yes assuming thats what you mean.
In response to Bigmnm (#15)
Show us the object definition for trees.

Also your hatchet code is wrong for a lot of reasons, but I assume you'll want to deal with having trees show up on the map first.
In response to ANiChowy (#16)
Yes, haha.
In response to Bigmnm (#3)
It's quite obvious that the tree's wont show up during runtime if they even wont show up in the map editor. Also, do what ANiChowy asked you here [link] , "show us the object definition for trees."
In response to Raimo (#18)
obj
Tree
icon='tree.dmi'
icon_state="unchopped"
density=1
Page: 1 2