Custom crafting class


#1

So here I am again… I am trying to make a custom class. I followed the mod guide step by step and come up with this…


I can upload the mod for anyone to look at, but I must warn you it is VERY messy right now!

  • All of the recipes work (I tested them with a carpenter)
  • The Talisman gets made correctly
  • The Job shows up on the promotion board
  • The Hearthling gets promoted
  • Then the above error pops up.
  • Dismiss the error and open the workshop to see this…

Any ideas?
Thank You!!!
-TacocaT


#2

Can I see the job description file? :slight_smile:


#3
{
   "type": "job",
   "enabled": true,
   "job_id": "guildmaster",
   "display_order": 3,
   "alias": "weapons_plus:jobs:guildmaster",
   "display_name": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.display_name)",
   "description": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.description)",
   "requirements": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.requirements)",
   "abilities": "file(guildmaster_abilities)",
   "controller": "weapons_plus:class:guildmaster",
   "equipment": {
      "torso": "file(guildmaster_outfit)",
      "mainhand": "weapons_plus:guildmaster:hammer"
   },
   "roles": 
      "guildmaster_job crafter",
   "talisman_uri": "weapons_plus:guildmaster:talisman",
   "default_stance": "passive",
   "icon": "file(images/icon.png)",
   "promotion_activity_name": "promote_guildmaster",
   "task_groups": [
      "stonehearth:task_groups:common_tasks",
      "stonehearth:task_groups:restock",
      "stonehearth:task_groups:build",
      "stonehearth:task_groups:placement",
      "stonehearth:task_groups:mining",
      "stonehearth:task_groups:rescue",
      "stonehearth:task_groups:crafting",
      "stonehearth:task_groups:town_alert"
   ],
   "crafter": {
      "work_effect": "smith",
      "recipe_list": "/weapons_plus/jobs/guildmaster/recipes/recipes.json"
   },
   "workshop": {
      "portrait": "file(/jobs/guildmaster/guildmaster_workbench/guildmaster_workbench.png)",
      "workbench_type": "weapons_plus:guildmaster:workbench",
      "job_name": "guildmaster",
      "skin_class": "guildmaster",
      "open_sound": "stonehearth:sounds:ui:blacksmith_menu:menu_open",
      "close_sound": "stonehearth:sounds:ui:carpenter_menu:menu_closed"
   },
   "parent_job": "stonehearth:jobs:worker",
   "xp_rewards": {
      "craft_level_0": 15,
      "craft_level_1": 17,
      "craft_level_2": 19,
      "craft_level_3": 21,
      "craft_level_4": 23,
      "craft_level_5": 25,
      "craft_level_6": 27
   },
   "max_level": 6,
   "level_data": {
      "1": {
         "perks": [
            {
               "name": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_1_data.perk_000_name)",
               "id": "crafter_recipe_unlock_1",
               "icon": "file(../common/images/standard_catalog.png)",
               "description": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_1_data.perk_000_description)",
               "level": 1
            }
         ]
      },
      "2": {
         "perks": [
            {
               "name": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_2_data.perk_000_name)",
               "id": "crafter_recipe_unlock_2",
               "icon": "file(../common/images/collaborative_insight.png)",
               "description": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_2_data.perk_000_description)",
               "level": 2
            }
         ]
      },
      "3": {
         "perks": [
            {
               "name": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_3_data.perk_000_name)",
               "id": "crafter_recipe_unlock_3",
               "icon": "file(../common/images/unlock_quality_fine.png)",
               "description": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_3_data.perk_000_description)",
               "level": 3
            }
         ]
      },
      "4": {
         "perks": [
            {
               "name": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_4_data.perk_000_name)",
               "id": "crafter_recipe_unlock_4",
               "icon": "file(../common/images/extended_catalog.png)",
               "description": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_4_data.perk_000_description)",
               "level": 4
            }
         ]
      },
      "5": {
         "perks": [
            {
               "name": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_5_data.perk_000_name)",
               "id": "crafter_recipe_unlock_5",
               "icon": "file(../common/images/unlock_quality_excellent.png)",
               "description": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_5_data.perk_000_description)",
               "level": 5
            }
         ]
      },
      "6": {
         "title": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_6_data.title)",
         "perks": [
            {
               "name": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_6_data.perk_000_name)",
               "id": "crafter_recipe_unlock_6",
               "icon": "file(../common/images/master.png)",
               "description": "i18n(weapons_plus:jobs.guildmaster.guildmaster_description.level_6_data.perk_000_description)",
               "level": 6
            }
         ]
      }
   }
}

#4

Okay, it seems alright :slight_smile:

Although just a tip, you can now (and probably should) put roles into arrays, like this:

 "roles": [
      "guildmaster_job", "crafter"
 ]

And can I see the workbench json? The error mentions the equivalent workbenches component/thingy so might have to do with that


#5

sure thing! (also I don’t remember changing that to NOT an array!) <— already changed!

{
   "type": "entity",
   "mixins": "file(guildmaster_workbench_ghost.json)",
   "components": {
      "stonehearth:entity_forms": {
         "ghost_form": "file(guildmaster_workbench_ghost.json)",
         "iconic_form": "file(guildmaster_workbench_iconic.json)",
         "placeable_on_ground": true
      },
      "destination": {
         "region": [
            {
               "min": { "x": -1, "y": 0, "z": -1 },
               "max": { "x": 2, "y": 1, "z": 2 }
            }
         ]
      },
      "region_collision_shape": {
         "region": [
            {
               "min": { "x": -1, "y": 0, "z": -1 },
               "max": { "x": 2, "y": 1.5, "z": 2 }
            }
         ]
      },
      "stonehearth:workshop": {
         "job_alias": "weapons_plus:jobs:guildmaster"
      }
   },
   "entity_data": {
      "stonehearth:table": {
         "drop_effect": "carry_putdown_on_table",
         "drop_offset": { "x": 0, "y": 1.5, "z": 0 }
      },
      "stonehearth:net_worth": {
         "value_in_gold": 20,
         "rarity": "common",
         "shop_info": {
            "buyable": false,
            "sellable": true,
            "shopkeeper_type": "caravan"
         }
      },
      "stonehearth:appeal": {
         "appeal": 6
      },
      "stonehearth:item_quality": {
         "variable_quality": true
      }
   }
}

#6

Seems fine too.

Oh, duh. I know what I’m forgetting :joy:
The controller (class lua)

Could I see that too? Specifically right at the start, this line:
local CraftingJob = require 'stonehearth.jobs.crafting_job'

people often forget the stonehearth before the jobs.crafting_job


#7
local GuildmasterClass = class()
local CraftingJob = require 'stonehearth.jobs.crafting_job'
local BaseJob = require 'stonehearth.jobs.base_job'


radiant.mixin(GuildmasterClass, CraftingJob)

return GuildmasterClass

#8

You can probably remove the BaseJob since it is already required by the Crafting Job (and you’re not mixin it in anyway :smiley: )


#9

This is where I thought the error was coming from. In the modding guide it eludes to deleting all the .lua except these lines and it felt weird.


#10

Yea that was something I added in when I began this whole mess. :slight_smile:


#11

Leave it just like

local GuildmasterClass = class()
local CraftingJob = require 'stonehearth.jobs.crafting_job'
radiant.mixin(GuildmasterClass, CraftingJob)
return GuildmasterClass

#12

Also, not sure if you’re using any other mods (including ACE) but I’d recommend de-activating them for working on your mod when you get issues, makes it easier to track down since sometimes the issue can be caused by some other mod. :smiley:

Guess I’d need to take a look at the mod to see if I spot something, I’m not the best at this :joy:


#13

Seems like a css error?


#14

I have every mod disabled except this one. Please look past all the models and Artwork. I am still in the coding part of this mod! I have to get a cloud sharing service or something because the mod is too big to upload here…


#15

Is your .less file in the manifest?


#16

Your workbench needs catalog data. The UI tries to retrieve it and then access it, and it doesn’t exist so it causes that error.


#17

Catalog data is probably in the workbench ghost


#18

Here is the workbench_ghost.json

{
   "mixins": "stonehearth:mixins:placed_object",
   "components": {
      "mob": {
         "model_origin": { "x": 0, "y": 0, "z": 0 },
         "region_origin": { "x": 0.5, "y": 0, "z": 0.5 }
      },
      "render_info": {
         "scale": 0.15
      },
      "model_variants": {
         "default": {
            "models": [
               "file(guildmaster_workbench.qb)"
            ]
         }
      }
   },
   "entity_data": {
      "stonehearth:hide_child_entities_from_pathfinder": true,
      "stonehearth:catalog": {
         "display_name": "i18n(weapons_plus:jobs.guildmaster.guildmaster_workbench.guildmaster_workbench_ghost.display_name)",
         "description": "i18n(weapons_plus:jobs.guildmaster.guildmaster_workbench.guildmaster_workbench_ghost.description)",
         "icon": "file(guildmaster_workbench.png)",
         "category": "workshops",
         "material_tags": [
            "stockpile_tool"
         ]
      }
   }
}

And here is the manifest containing the .less in the “ui” section

{
   "info": {
      "name": "Weapons Plus",
      "namespace": "weapons_plus",
      "version": 3,
      "steam_file_id": "1592802375"
   },
   "default_locale": "en",
   "aliases": {
      "armor:cape_courage": "file(entities/armor/cape)",
      "armor:cape_courage_iconic": "file(entities/armor/cape/cape_iconic.json)",
      "armor:cape_defender": "file(entities/armor/cape/cape_defender)",
      "armor:cape_defender_iconic": "file(entities/armor/cape/cape_defender/cape_defender_iconic.json)",
      "armor:cape_speed": "file(entities/armor/cape/cape_speed)",
      "armor:cape_speed_iconic": "file(entities/armor/cape/cape_speed/cape_speed_iconic.json)",
      "armor:helmet": "file(entities/armor/helmet)",
      "armor:helmet_iconic": "file(entities/armor/helmet/helmet_iconic.json)",
      "armor:square_shield": "file(entities/armor/square_shield)",
      "armor:square_shield_iconic": "file(entities/armor/square_shield/square_shield_iconic.json)",
      "carpenter:guildmaster_hammer": "file(jobs/carpenter/guildmaster_hammer)",
      "carpenter:guildmaster_hammer_iconic": "file(jobs/carpenter/guildmaster_hammer/guildmaster_hammer_iconic.json)",
      "carpenter:recipes": "file(jobs/carpenter/recipes)",
      "carpenter:recipes:cape_courage": "file(jobs/carpenter/recipes/cape_recipe.json)",
      "carpenter:recipes:cape_defender": "file(jobs/carpenter/recipes/cape_defender_recipe.json)",
      "carpenter:recipes:cape_speed": "file(jobs/carpenter/recipes/cape_speed_recipe.json)",
      "carpenter:recipes:guildmaster_hammer": "file(jobs/carpenter/recipes/guildmaster_hammer_recipe.json)",
      "carpenter:recipes:helmet": "file(jobs/carpenter/recipes/helmet_recipe.json)",
      "carpenter:recipes:square_shield": "file(jobs/carpenter/recipes/square_shield_recipe.json)",
      "carpenter:recipes:wooden_staff": "file(jobs/carpenter/recipes/wooden_staff_recipe.json)",
      "carpenter:recipes:wooden_war_hammer": "file(jobs/carpenter/recipes/wooden_war_hammer_recipe.json)",
      "guildmaster:abilities": "file(jobs/guildmaster/guildmaster_abilities)",
      "guildmaster:effects:work": "file(data/rigs/jobs/blacksmith/blacksmith_forge/effects/work.json)",
      "guildmaster:guildmaster_hammer:iconic": "file(jobs/carpenter/guildmaster_hammer/guildmaster_hammer_iconic.json)",
      "guildmaster:guildmaster_outfit": "file(jobs/guildmaster/guildmaster_outfit)",
      "guildmaster:guildmaster_workbench:ghost": "file(jobs/guildmaster/guildmaster_workbench/guildmaster_workbench_ghost.json)",
      "guildmaster:hammer": "file(jobs/carpenter/guildmaster_hammer)",
      "guildmaster:recipes": "file(jobs/guildmaster/recipes)",
      "guildmaster:recipes:cape_courage": "file(jobs/guildmaster/recipes/cape_recipe.json)",
      "guildmaster:recipes:cape_defender": "file(jobs/guildmaster/recipes/cape_defender_recipe.json)",
      "guildmaster:recipes:cape_speed": "file(jobs/guildmaster/recipes/cape_speed_recipe.json)",
      "guildmaster:recipes:guildmaster_workbench": "file(jobs/guildmaster/recipes/guildmaster_workbench_recipe.json)",
      "guildmaster:recipes:helmet": "file(jobs/guildmaster/recipes/helmet_recipe.json)",
      "guildmaster:recipes:square_shield": "file(jobs/guildmaster/recipes/square_shield_recipe.json)",
      "guildmaster:recipes:wooden_staff": "file(jobs/guildmaster/recipes/wooden_staff_recipe.json)",
      "guildmaster:recipes:wooden_war_hammer": "file(jobs/guildmaster/recipes/wooden_war_hammer_recipe.json)",
      "guildmaster:skin": "file(jobs/guildmaster/skin/workshop.less)",
      "guildmaster:talisman": "file(jobs/carpenter/guildmaster_hammer/guildmaster_hammer_talisman.json)",
      "guildmaster:workbench": "file(jobs/guildmaster/guildmaster_workbench)",
      "guildmaster:workbench_iconic": "file(jobs/guildmaster/guildmaster_workbench/guildmaster_workbench_iconic.json)",
      "jobs:guildmaster": "file(jobs/guildmaster/guildmaster_description.json)",
      "ui": "file(data/ui/start_menu.json)",
      "ui:less": "file(jobs/guildmaster/skin/workshop.less)",
      "weapons:wooden_staff": "file(entities/weapons/wooden_staff)",
      "weapons:wooden_staff_iconic": "file(entities/weapons/wooden_staff/wooden_staff_iconic.json)",
      "weapons:wooden_war_hammer": "file(entities/weapons/wooden_war_hammer)",
      "weapons:wooden_war_hammer_iconic": "file(entities/weapons/wooden_war_hammer/wooden_war_hammer_iconic.json)"
   },
   "mixintos": {
      "stonehearth:jobs:index": "file(jobs/index.json)",
      "stonehearth/jobs/carpenter/recipes/recipes.json": "file(jobs/carpenter/recipes/recipes.json)",
      "stonehearth/data/ui/start_menu.json": "file(data/ui/start_menu.json)"
   },
   "overrides": {},
   "components": {},
   "controllers": {
      "class:guildmaster": "file(jobs/guildmaster/guildmaster.lua)"
   },
   "ui": {
      "less": [
         "file(jobs/guildmaster/skin/workshop.less)"
      ]
   }
}

Signing up for dropbox now to send the entire .smod


#20

Is there any particular reason why you alias your items’ iconics?
I don’t think it’s an issue but haven’t seen that before, makes browsing through the entities a bit confusing though :stuck_out_tongue:

(taking a look)


#21

I use SHED for my manifest and en files for localization and ease of cross referencing. I find it easier than searching for missing commas every single time.