Question: How do you add objects to r188?

It’s hard to say what going on without seeing any files, try this if you are still having trouble private message me your beehive.json beehive_iconic.json

This would suggest to me that your beehive_iconic.json might be referencing the full size model, if not try opening the iconic model in Quibicle, just to make sure the file is right. If the file is right I would then suggest taking a further look at your beehive.json, making sure iconic_form is properly set.

try this in your beehive_iconic.json
“model_origin” : { “x”: -0.05, “y”: 0, “z”: 0.05 }

other than that, make sure that when you exported, your beehive should be at position -15,0,-15.

Looking good so far :wink:

Edit :
I don’t know this for a fact, I am guessing, I could go and test it, but here’s my thought process now.

In your beehive_ghost.json we set “region_origin” : { “x”: 0.5, “y”: 0, “z”: 0.5 }, ie half a cube offset.
Since your model is 30x30x30, we export at -15,0,-15 to get it as close to center as the .qb file format will allow for. From here “region_origin” : { “x”: 0.5, “y”: 0, “z”: 0.5 } does the final shift to get it centered.

That did it thanks, I wasn’t centering the model in Qubicle, I’d be very stuck without help. Thanks on the comment about the models. Inside the iconic.json I was referencing the full sized .qb file so that should be fixed now.

How would I have two mods? Do all my mods have to go inside one folder?

Do you mean 2 different items?

If so just continue to add to your existing mod folder and the manifest. You can specify as many items as you want in your mod. Just remember the commas’s between entries in the manifest ;).

Otherwise

Having separate mods can be done by creating another folder in the stonehearth’s mods folder, followed by a manifest file.

The game will query the stonehearth mods folder, find all entries, then look for the manifest before doing anything.

As a side note, we probably could have done

"model_origin" : { "x": -15, "y": 0, "z": -15 },

in beehive_ghost.json, I assume it overrides the default model origin, could have avoided the re-export. But you are better off keeping things consistent, otherwise down the line you would find yourself confused as some models define the origin override, while others would be exported with the offset already. Consistency is the key to a maintainable.

1 Like

If I can do something now that will cause me much less stress when I have more items, I will do that now. All I’ve been doing is copying the folder and changing the name and forgetting about changing the manifest details, that’s why the second one wasn’t loading. Thanks!

I have a few questions regarding having more than one mod.

Overall there will be 4 models.

Beehive without Honey (beehive_empty.qb) Craftable by Carpenter
Beehive with Honey. (beehive.qb)
Tree with Beehive. (beehive_tree.qb)
Honey Pot (honey_pot.qb)

The Beehive will need to be created by the carpenter. When certain parameters are met (Beehive Placed, Flowers near Beehive, time between 1 - 5 minutes.) Bee’s will occupy the beehive and start creating honey. I would like the beehive to function just like the berry bushes.

I’ve started having a go at how the files will look. Just let me know if I’m doing something wrong.

{
"info": {
    "name": "beehive",
    "version": 1
},
"aliases": {
    "beehive": "file(entities/beehive/beehive.json)",
    "honey_pot": "file(entities/beehive/honey_pot.json)",
    "beehive_empty": "file(entities/beehive/beehive_empty.json)",
    "beehive_tree": "file(entities/beehive/beehive_tree.json)"
},
"mixintos": {
    "/stonehearth/jobs/carpenter/recipes/recipes.json": [
        "file(mixins/carpenter_recipes.json)"
    ]
}
}

I’m guessing to replace the beehive_empty model with beehive model I will need to put that into the beehive_empty.json file. I’ve no idea how to do that, could anyone give me some pointers on how to do that?

I know nobody knows anything about tree’s yet, so that model can stay on the sidelines for now.

EDIT: Found this in the stonehearth folder.

{
"type": "entity", 
"components": {
      "model_variants": {
         "default": {
            "models": [
               "file(berry_bush.qb)"
        ]
     },
     "depleted": {
        "models": [
           "file(berry_bush_empty.qb)"
        ]
     }
  },
  "render_info" : {
     "scale" : 0.15
  },
  "mob" : {
     "model_origin" : { "x": -0.075, "y": 0, "z": 0.075 },
     "region_origin" : { "x": 0.5, "y": 0, "z": 0.5 }
  },
  "region_collision_shape" : {
     "region": [
        {
           "min" : { "x" : -1, "y" : 0, "z" : -1 },
           "max" : { "x" :  2, "y" : 2, "z" :  2 }
        }
     ]
  },
  "destination" : {
     "region" : [
        {
           "min" : { "x" : -1, "y" : 0, "z" : -1 },
           "max" : { "x" :  2, "y" : 1, "z" :  2 }
        }
     ]
  },
  "unit_info": {
     "name": "Berry Bush", 
     "description": "Harvestable for a meager food supply."
  }, 
  "stonehearth:renewable_resource_node": {
     "task_group_name" : "stonehearth:task_group:harvest",
     "resource" : "stonehearth:food:berries:berry_basket",
     "renewal_time" : "22h",
     "harvest_command" : "harvest_berries",
     "unripe_description" : "Not yet ripe for harvest.",
     "harvest_overlay_effect" : "/stonehearth/data/effects/harvest_plant_overlay_effect"
  }
   }
}

If I change the berry bush info to mine it should work? I don’t need the render info as I don’t want to scale the object.

I successfully got it to work, but there’s a problem, you can’t have a moveable and a harvestable object at the same time.

"stonehearth:entity_forms":

The code above is responsible for it being movable and deployable, without that piece of code after the object is made by the carpenter it’s fixed in that place and gives you not option to move or undeploy it.

Without that code you can harvest your object but you can’t move it or undeploy it. Maybe that could be bypassed by making a json file that allows you to move it, and then after a certain time period it’s unmovable but harvestable?

I don’t know. Here the json file anyway.

{
"type": "entity",
"mixins": "file(beehive_empty_ghost.json)",
"components": {
    "stonehearth:entity_forms": {
        "iconic_form": "file(beehive_empty_iconic.json)",
        "ghost_form": "file(beehive_empty_ghost.json)",
        "placeable_on_ground": true,
        "model_variants": {
            "default": {
                "models": [
                    "file(beehive_empty.qb)"
                ]
            },
            "depleted": {
                "models": [
                    "file(beehive_empty_iconic.qb)"
                ]
            }
        },
        "mob": {
            "model_origin": {
                "x": -0.075,
                "y": 0,
                "z": 0.075
            },
            "region_origin": {
                "x": 0.5,
                "y": 0,
                "z": 0.5
            }
        },
        "region_collision_shape": {
            "region": [
                {
                    "min": {
                        "x": -1,
                        "y": 0,
                        "z": -1
                    },
                    "max": {
                        "x": 2,
                        "y": 2,
                        "z": 2
                    }
                }
            ]
        },
        "destination": {
            "region": [
                {
                    "min": {
                        "x": -1,
                        "y": 0,
                        "z": -1
                    },
                    "max": {
                        "x": 2,
                        "y": 1,
                        "z": 2
                    }
                }
            ]
        },
        "unit_info": {
            "name": "Beehive",
            "description": "Harvest this for a pot full of Honey."
        },
        "stonehearth:renewable_resource_node": {
            "task_group_name": "stonehearth:task_group:harvest",
            "resource": "stonehearth:food:berries:berry_basket",
            "renewal_time": "1h",
            "harvest_command": "harvest_berries",
            "unripe_description": "Not quite full enough yet.",
            "harvest_overlay_effect": "/stonehearth/data/effects/harvest_plant_overlay_effect"
        }
    }
}
}

Yeah I know, a beehive that gives you berries.

2 Likes

You should not have
"beehive_empty": "file(entities/beehive/beehive_empty.json)",

"beehive" should handle the transition between the filled model and the empty model.

Also I’d advise separating out you file structure.

honey_pot is most a food source, so it should go into, entities/foods/honey_pot/honey_pot.json
beehive_tree should go into say, entities/trees/beehive_tree/beehive_tree.json
and so on.

Having this structure now is important, as the project grows you’ll find yourself overwhelmed by the shear number of files. Having a clear directory structure is crucial. If you were to continue, you’ll wind of being stuck with some 100 files with all paths have to be change to fit new organization.

Take a look at Stonehearth’s directory structure. They have separate folders for just about everything.

Your JSON is invalid for 2 reasons, first "stonehearth:entity_forms" and "model_variants" should not be part of the same array. And would be declared like this

 "stonehearth:entity_forms": {
      // data
 },
 "model_variants": {
     // data
 }

Beyond that I have never seen "model_variants" and "stonehearth:entity_forms" declared together. I would assume it would cause trouble.

Basically a craftable berry_bush. This is rather straight forward. I’ll try to focus more on your specific situation, rather than using examples which don’t pertain to what you are specifically doing.

Just change your beehive_ghost.json to match this

{
   "type": "entity", 
   "components": {
      "model_variants": {
         "default": {
            "models": [
               "file(beehive_full.qb)"
            ]
         },
         "depleted": {
            "models": [
               "file(beehive_empty.qb)"
            ]
         }
      },
      "render_info" : {
         "scale" : 0.2
      },
      "mob" : {
         "model_origin" : { "x":0, "y": 0, "z": 0 },
         "region_origin" : { "x": 0.5, "y": 0, "z": 0.5 }
      },
      "unit_info": {
         "name": "Beehive", 
         "description": "Beehive harvest description."
     }, 
         "stonehearth:renewable_resource_node": {
             "task_group_name" : "stonehearth:task_group:harvest",
             "resource" : "stonehearth:food:berries:berry_basket",
             "renewal_time" : "1h",
             "unripe_description" : "Nope not yet.",
             "harvest_overlay_effect" : "/stonehearth/data/effects/harvest_plant_overlay_effect"
      }
   }
}

That should be it, let me know how it’s working :wink:

.

3 Likes

I’m going to have to look at that tomorrow, it’s getting late and my brain will stop working soon.

I’ve attached my BeehiveMod folder. If you want to take a look at the directory and just tell me if that’s correct then that would be great.

So far I’ve only edited the recipes / mixins and manifest json files at the moment.

I only want the Empty Beehive craftable, but for testing purposes I need them to be craftable.

Thank you for all the help, Get ready for more questions tomorrow.

Mod files:

https://mega.co.nz/#!pRcXHZJb!gwsHk7M7kXWFrUM_oWrxkFqIczRO6A2R_rD4LmOx90M

and / or picture:

EDIT: I’m still having no luck at all getting two objects to show up in the carpenters menu.

I took a gander at your mod myself and noticed a few things that didn’t make this mod work properly. Note that I’m mostly using the beehive recipe as the other recipes have similar issues.

  • In manifest when doing a mixinto for your recipes, you’re looking for filenames "..._recipes.json" when the actual file names are ..._recipe.json.

  • In mixins/beehive_recipes.json. You have this line:
    "recipe" : "file(/recipes/beehive_recipe.json)",.
    While it should be: "recipe" : "/BeehiveMod/recipes/beehive_recipe.json".
    The problem here is that you’re using "file()" to search for a file. This is fine; if the file in question is in the same folder as the json or in a subsequent folder, but you had the file in a different place so SH couldn’t find it. Also I removed the extra comma at the end of the line, it’s useful if you have more key-values to write in, but since that was the only one here there’s no need for the comma.

  • In recipes/beehive_recipe.json, you have this line:
    "item":"BeehiveMode:animalhousing:beehive:beehive"
    It should be "item":"BeehiveMod:beehive" only. Here Stonehearth attempts to locate this item by looking under aliases in the manifest, and so we tell SH to look for the alias beehive in the mod BeehiveMod.

After these changes I could easily craft the beehive, and I would say that you do want to scale it down, unless you want the beehive to be as big as the citizens. :wink:

One last thing: I’d recommend to remove the beehive_tree_recipes.json from your minfest for now, since it’s not in the mod yet.

I hope you get it to work and that you understand what’s happening. :smile:

2 Likes

Thanks a lot for that,

You know what, commas can do one, I don’t like them anymore.

I’ve got all three items now showing up in the carpenters menu just for testing and they are all craftable.

The beehive.qb which represents a full beehive ready to be harvested still cannot be moved when is has been crafted. It is harvestable but an error pops up about a directory (food:honey_pot:honey_pot) or something, though reading though previous posts I know what I’ve done wrong there.

We’re getting there, again thanks for all the help guys.

I don’t like commas.

4 Likes

Having some trouble exporting a file. This is the outcome, it’s got a matrix of 40 h x 12 w x 10 d

I have had that problem as well:

http://www.minddesk.com/vanilla/index.php?p=/discussion/853/not-exporting-properly

i sent him my files and he is looking into it. Might be worth posting over there as well so he knows more people are having this problem.

I’ve sent him an email to support@minddesk.com

Hopefully it can be fixed, is your model a large one as well?

Sometimes the best way to learn is by having an example to go by. big walls of text can be tedious to learn from.

I’ve gone ahead and corrected some issues with the mod files you provided.

https://www.dropbox.com/s/sdafrzbqb16d2l4/beehivemod.zip?dl=0

Main Things


  • I’ve removed behive_empty from the the project in favor of

    behive_testing

    beehive_testing should be used for cheating in the full beehive.
    beehive should be just the normal gameplay beehive the player will be using. It should start off empty, and look for all the requirments in order to start producing honey.
    This will make it easier for release as you would just need to remove beehive_testing from the project.

  • I combined your mixin for the carpenter recipe into just one mixin. You were correct in individual recipe files, but there is no need to do separate mixins.

  • beehive and beehive_testing are both placeable and haverstable, even after crafting.

  • various fixes to .json for beehive/iconic/ghost

  • fixed aliases in recipes

  • changed your mod directory, just cause conventions… lower case, no spaces, no - .

  • corrected some issues with your honey pot to make it ediable. Basically the way Stonehearth handles foods is you have a food_container and the actual food, which returns from the container. I’ve set this up as.
    honey_pot = food_container
    honey_pot:serving = actual food


What I’ve done is set-up most of the project as though I was doing it myself. This doesn’t mean that necessarily you’ve done things wrong. It’s up to each modder to make their own decisions when it comes to their mod. But there where issues with some parts of your mod, these are things that would have to be changed.

I’ve also added a little startup script, each time you start a new world, the game will handle a few things for you.

  • add a few more hearthlings
  • create a stockpile off to the side
  • promote a citizen to a carpenter, as this is the main class you are working with right now
  • have the carpenter place his/her workbench
  • put into the stockpile a beehive
  • put into the stockpile a beehive_testing
  • put into the stockpile a honey_pot
  • put into the stockpile a bunch of wood
  • put into the stockpile talisman’s for each class

Most of these, are all tasks I commonly do myself each time when starting up the game to test out a mod I am working on. This little startup script takes away some of the repetitive tasks we do when getting started.

new games will look this by default, make sure to pick an open enough area

Obvious Question : Why do I need a start-up script, why not just save and re-load?

I’ve run into many problems loading a save when modding. An easy example you can test yourself.

Start a new game, craft one of your items, save and exit.
Now go change the crafting recipe name for that item, save.
Start Stonehearth re-load your game.

Now you’d expect the recipe name to change, but it doesn’t. It stays the same. As though you didn’t change a thing.

Now the real kicker is start a new game and check the recipe name. It’s the new name you change it too before. :hushed:

Point being saved games store too much data. This is just one small example, there are many others. You’re much better off starting a new game each time.

The startup script is an override to new_game_call_handler, I’ve add various helpers functions to make it easier to do things like, place entities, promote hearthlings. This should not be distributed with your mod, only for development.

Overrall if you have any questions as to why I changed something the way I did, how to work with the start up script, or about anything else just post here. :wink:

As a side note,

I have a plan on how to handle this behaviour… ;), I haven’t test it yet but I’ll let you know.

I’m liking what I have seen from your mod so far. :slight_smile:

2 Likes

IT’S WORKING!!! IT’S WORKING!!!

That’s great haha, It was a shock when I saw 22 workers :smiley: I was close to asking you how to do that anyway, making a carpenter was very tedious and the new hired help will, well, help. :smiley:

I’m just going through your files now and seeing where I was going wrong. It looks like I went wrong everywhere haha.

What I have noticed though is that the Beehive should be made without honey inside, then we have the parameters I mentioned, which you are aware of as you’re working on it.

It’s working great and it’s perfect, can’t wait to see how you handle the parameters :smiley: thanks!

Edit: I’m going to change the look of the full beehive model as well, it looks a bit rushed, i’m contemplating removing the lid when full to see the honey.

2 Likes

Bringing this thread back up from the dead because I’ve crossed paths with entity clusters in the mining/ore code!

Do you have any experience with ore spawning and vein implementation?

I’m seeing some files to play around with, notably:

stonehearth\scenarios\scenario_index.json
stonehearth\data\terrain\terrain_blocks.json
stonehearth\scenarios\static\terrain\ore_vein\ore_vein.json
stonehearth\scenarios\static\terrain\gold_vein\gold_vein.json (and others)

Looks interesting. I’m trying to add crystals to the lightsaber mod, and I figure I can make tiny veins, about 10 voxels in size, containing unrefined crystals. The rest of the coding would be simple popy-caste stuff with clever renaming of everything.

If I’m understanding correctly, does the weight parameter set the % chance of a cluster being whatever it is you’d like to spawn, or is it more of a ‘higher-weight = greater absolute number of these in world’ type of deal? (Hope that makes sense!)

How would this compare to editing the density parameter in ‘scenario_index.json’? (assuming I create a custom ‘raw_gems’ category

I don’t know how to set custom ores/raw gems to randomly drop from stone, but I’ll be messing about with those two files in particular to see if its doable, otherwise I’ll implement dedicated gem veins!

EDIT:

It seems I’ve found what I’m looking for:

stonehearth\services\server\mining\mining_loot_tables.json

I guess I’ll start with this and make veins in the future if I think they’re necessary

2 Likes

Thanks for all the info in this thread. I’ll just started to learn LUA and JS but i know the basics of programming from my university courses, so most of the basic tuts here were a little bit too easy and didn’t get into the specifics of SH.

But this thread helped me the most. It dives into the SH behaviour between files. We need more threads like this, which explain the structure of SH to modding newbies like me. Thats what i have the most problems with, to read the code and understand what the effect of it is or seeing whats inherent code of JS or LUA and what are function or whatever from SH… -_-

2 Likes

Anyone could make a tutorial how to add an custom model with animations ingame?

Setting this up is a cluster f*ck of files and editing :open_mouth:

Is my general idea on how to approach this the right way?

  1. Setup correct folder structure for all the files that needs to be loaded ingame

  2. Setup manifest.json in my own folder with all the skeleton/effect/animation/Other requirements folder locations on the aliases tab?

  3. no idea, haha.

Hi there,
I would recommend you this Website from @voxel_pirate and look up his threads here (e.g. this(1) or this(2)) He is doing an addon for blender to make animation easier for Stonehearth.
But otherwise i can tell you, because i dived into blender and animating the models with it, it is as you called it… a shitload of work. But if you like blender and want to have fun with it…just do it :slight_smile:

He did already @pandaroc :smile: and yes, that will be a bit of work. As the game is still changing frequently, I guess I will wait with this kind of guides. My suggestion would be to chose one creature which is already in the game and dig into the structure from there.

If you only want to see your stuff in the game, you could also try to just replace the models, skeleton and animation files of an existing mob.

1 Like