I made all my trees into icons! :(


#1

I’m trying to make trees craftable but I can’t figure this out. I created the recipes, created icon forms for all of the trees, etc. With the game as it currently appears in the screenshot below, I can craft a tree with my carpenter, place the iconic version in a stockpile, then place the actual tree down on the ground; the ghost appears properly and then the tree appears properly. It almost works 100% Unfortunately, the rest of the trees of the same type in the world start out as iconic versions that I can actually pick up and move into stockpiles!

Here’s my medium_oak_tree.json file that is a mixin for the Stonehearth medium_oak_tree.json. If I REMOVE the components section of this file, the trees in the world are back to normal, but when I craft a tree it just pops a tree right up on my carpenter bench instead of turning into the proper iconic version. This makes sense because I removed the definition for the iconic version of this tree.

Here’s an archive of what I currently have: TinyUpload.com - best file hosting solution, with no limits, totaly free

{
   "mixins" : "file(medium_oak_tree_ghost.json)",
   "components": {
      "stonehearth:entity_forms" : {
         "iconic_form" : "file(medium_oak_tree_iconic.json)",
         "ghost_form" : "file(medium_oak_tree_ghost.json)",
         "placeable_on_ground" : true,
         "placeable_category" : "trees"
      }
   },
   "entity_data" : {
      "stonehearth:medium_oak_tree" : {}
   }
}


#2

I don’t know exactly how to fix this but it is because the game is reading the qb files for the iconic version of the tree when generating the terrain.

From what I can gather from the stonehearth engine, if an item has an iconic version it will always use the iconic when an entity is first created unless it is strictly told not to, hense why crafters create the iconic versions. Placing the object seems to force the entity to use the full sized model.

Unless there is a way in the json files that I haven’t noticed, your best bet would be to look into editing the landscaper.lua.

I might be wrong but that’s just a few things I noticed while doing a little bit of beginning testing of my own.


#3

Yeah, I know this problem :slight_smile:

If you use this code, ALL trees becoming a placeable object. This means, they will be in their iconic form, until you place them anywhere in the world. So the problem is, that the world creation don’t place these objects in the world, because they aren’t placeables for the landscaper. And so, every tree is an unplaced placeable - an iconic.

You have 2 possibilities:

  1. Hard code the landscaper, so that the landscaper place these trees in the world. At this time they will look normal and still can be placed elsewhere.
  2. Make some “double trees” (that’s the way I’m doing it). So you don’t change anything in the original trees but add a new double for every tree like “craft_medium_oak_tree”. If you let the carpenter craft these trees they will behave correctly, but the original created trees can’t be moved around. This way is a bit more of copy/paste-work, but if you just want to make trees craftable, it should work.

Greetz

Damned… @Avairian was too fast :smiley:


#4

I’m really liking how these kind of topics are slowly starting to pop up. I like the experimenting that’s going on with Stonehearth now. I ran into this issue when trying to find a way to make my bamboo plants (which emulate wild silkweed) to be able to be harvestable as well as “undeployable” to allow you to plant them somewhere else or to use them to make potted plants.

I’d trust @Programmierer, he knows how to code in lua, unlike me. xD

And its way past my bedtime :stuck_out_tongue_winking_eye:

The one thing i want to know is how you made the trees drop two kinds of items. :laughing:
Been wanting to do something like that as well as figure out a way to make harvestable items give more than of an item. Kinda like a hybrid tree/silkweed/flower plant i guess. rofl


#5

[quote=“Avairian, post:4, topic:8033”]
I’d trust @Programmierer, he knows how to code in lua, unlike me. xD[/quote]
Doesn’t mean that’s correct. That’s also just the result out of some testing :smiley:

[quote=“Avairian, post:4, topic:8033”]
And its way past my bedtime[/quote]
In Germany it’s 06:18, so it’s right past bedtime… AND seeing that I Have to go to sleep xD

[quote=“Avairian, post:4, topic:8033”]
The one thing i want to know is how you made the trees drop two kinds of items.[/quote]
Yeah, I’m sure you want to know this… :stuck_out_tongue: :smiley:
It’s really simple. Just change the resource_node_component using this file.
This adds two new values for the .json named resourceb and durabilityb. You can use these as in the same way with only one condition: durability have to be bigger than or equal to durabilityb.

So you’re just changing your code to something like:

"stonehearth:resource_node": {
         "resource": "stonehearth:silver_birch_log", 
         "durability": 12,
         "resourceb": "stonehearth:silver_birch_sapling", 
         "durabilityb": 3
      },

Ant that’s the hole magic :open_mouth:


#6

Ok, I see what you’re saying. I’m not sure if there’s a perfect solution right now without some other modifications. I might try to jump into some of the Lua and see what I can do.

I want the original trees in the world to be placed down
I want my trees craftable
I don’t want any trees movable/undeployable
I don’t want to duplicate trees because then I have to change my dupes to match the originals if they ever get updated (this one I guess I could give up if I had to)

Thanky ou @Programmierer and @Avairian for your help! I didn’t expect replies so quickly. :smile:


#7

There is a real easy fix. You shouldnt be trying to make the games tress craftable, instead you should treat it like any other craftable object and then copy in the tree models into this new craft object. Call it something like Craft trees, or arborist or something like that. If you dont know how to add new objects to a crafter we can help with that.


#8

[quote=“jonzoid, post:6, topic:8033”]
I want the original trees in the world to be placed downI want my trees craftableI don’t want any trees movable/undeployableI don’t want to duplicate trees because then I have to change my dupes to match the originals if they ever get updated (this one I guess I could give up if I had to)[/quote]
If this is your goal, I recommend the second way using the duplicate trees. If there are changes in the tree-files, you will have to do this again, no matter what (placeable on ground, etc)…

So here is the thing, if you want to achieve your goal without doubles, you need to change these things:

  • Make trees craftable and moveable
  • Changing the landscaper, so the trees get placed in the world.
  • Changing the landscaper, so all placed trees aren’t placeable on ground any more.
  • (Other way round you could change the carpenter-system to change the status of every crafted tree to placeable)
  • Changing the place_item, so every placed tree aren’t moveable/placeable any more.
    That’s a lot of work and the chance you had to renew this is very high, because the .luac can also change very quickly.

With duplicate trees, you had something like this:

  • Make craftable and moveable doubles (that’s really just copy/paste)
  • Change the place_item, so every placed double aren’t moveable any more (if you don’t do this, the new trees are moveable, but I think that’s okay too).

Maybe there is another way round, but after working an my tree-mod, these are the possibilities I ended with…
Greetz