Mod Help - Coding Muskets

Me and my friend have been making good headway in creating a mod to add muskets, but we’ve hit a brick wall straight-on. So far we’ve got our models and a rough idea on how we’re going to go about it. So far our idea, which due to pure inexperience I have yet to know how to test, is based on a lightly modified bow/arrow code (more damage, new models, faster projectile, etc) however we’re completely lost when it comes to making said code work as a mod. Any and all advice/help is appreciated.

On account of being a new user I can’t upload attachments, so this zip (Musket) contains everything we’ve got thus far.

The download is legitimate, this seems like an honest endeavor.

how have you got it working in your end? I dont mod, I am just curious.

It’s not functional yet, we haven’t figured out how to code it properly even using modified versions of existing code unfortunately. Hence why I’m here.

@farseer1013 will you have the muskets for a new class or for an existing class?

In concept they would be an upgrade for the Archer, like a farmer to a chef.

Some things to fix:

  • The “version” in the manifest should be 3. This is the modding API version, not your mod version (confusing, we know). So make sure it’s always the same than in the stonehearth mod’s manifest, otherwise the mod won’t load.

  • The mod “name” in the manifest should be the exact same name than your mod’s folder (we usually have everything with lowercase to avoid typos). This is necessary if you’re going to make your mod translatable.

  • There’s a trailing comma after your last alias in your manifest. Remove it just in case.

  • You can simplify your mixintos for the recipes, since they are in the same folder. This:

"recipe": "file(../recipes/musket_recipe.json)"

can be simplified to this:

"recipe": "file(musket_recipe.json)"
  • You’re mixinto’ing your recipe for the blacksmith to the stonehearth’s carpenter recipes in your manifest, not sure if you did it on purpose for testing or if it’s just a typo.

  • You need a localization file. Create a locales directory inside your mod folder, and create an en.json file (Musket/locales/en.json file). Then i18n(musket:musket.musket.display_name) would correspond to

{
    "musket" : {
        "musket" : {
            "display_name" : "My display name"
        }
    }
}

inside that en.json file. But first be consistent with the name of your mod, because the i18n keys are preceded by the mod’s name and a colon, so your mod’s name and mod’s folder should be the same (all lowercase, or the some letters in uppercase if you want, just be consistent).

  • Make sure your paths and aliases in your json files are correct. For example, the musket recipe for the engineer, points to a wrong path for the png and a bad alias for the item that it produces: in your manifest, the alias for the musket is pointing to turrets/balista_turret which doesn’t exist in your mod. The alias for the produced item in your musketball recipe also doesn’t match any alias in your manifest, and it isn’t prefixed by your mod’s name plus a colon, either (it should be "item": "Musket:weapons:musketball" - or in lowercase, don’t know how will you change your mod’s name). And the path for that alias in the manifest also references unexisting folders and files, you’ll need to fix that too.

  • If you’re going to create a new class, you’ll need to mixinto the class to the jobs index from the stonehearth mod (you can try copying the archer and see what you’re missing). The first weapons used by the combat classes might look identical to their talismans for promoting them, but they’re actually specified in different json files. I don’t see an alias for your talisman in your manifest. It also has fields that need to be changed.

Fixing these things will at least load your mod and show the recipes for the corresponding crafters, but there are more things that you might need to fix after that, and to add a new class.

To test faster, you can select a hearthling, open the console with Ctrl+C and type promote_to blacksmith (or any of the stonehearth jobs. If it’s a custom job you have to specify the fully qualified alias). Then press enter.

2 Likes