Question: why wont buffs show up for my worker?

So I posted that bit of code in a json validator, and the only thing it noted was there needed to be a ‘{’ before the first line:

{
	"level_data": {
		"1": {
			"perks": [{
				"type": "apply_buff",
				"name": "i18n(stonehearth:jobs.farmer.farmer_description.level_1_data.perk_000_name)",
				"id": "farmer_speed_up_1",
				"icon": "/stonehearth/jobs/farmer/images/speed_up.png",
				"buff_name": "stonehearth:buffs:farmer:speed_1",
				"description": "i18n(stonehearth:jobs.farmer.farmer_description.level_1_data.perk_000_description)",
				"level": 1,
				"demote_fn": "remove_buff"
			}]
		},
		"2": {
			"perks": [{
				"name": "i18n(stonehearth:jobs.farmer.farmer_description.level_2_data.perk_000_name)",
				"id": "farmer_job_opportunities",
				"icon": "/stonehearth/jobs/farmer/images/farmerLv2.png)",
				"description": "i18n(stonehearth:jobs.farmer.farmer_description.level_2_data.perk_000_description)",
				"level": 2
			}]
		},
		"3": {
			"perks": [{
				"name": "i18n(stonehearth:jobs.farmer.farmer_description.level_3_data.perk_000_name)",
				"id": "farmer_harvest_increase",
				"icon": "/stonehearth/jobs/farmer/images/farmerLv3.png)",
				"description": "i18n(stonehearth:jobs.farmer.farmer_description.level_3_data.perk_000_description)",
				"level": 3
			}]
		},
		"5": {
			"perks": [{
				"name": "i18n(stonehearth:jobs.farmer.farmer_description.level_5_data.perk_000_name)",
				"id": "farmer_unlock_trees",
				"icon": "/stonehearth/jobs/farmer/images/farmerLv5.png)",
				"description": "i18n(stonehearth:jobs.farmer.farmer_description.level_5_data.perk_000_description)",
				"level": 5
			}]
		},
		"6": {
			"title": "i18n(stonehearth:jobs.farmer.farmer_description.level_6_data.title)"
		}
	}
}

yeah thats because i pulled it out of a whole list of code, including the opening bracket. this wont be so simple as to be a “forgot a bracket” problem.

any moore ideas @max99x ?

incidentally,
stonehearth\services\server\farming\data\all_crops.json defines what level the class that does the farming needs to be.
so if you click fallow you see the menu that lets you chooses the crop. that will always say FARMER level X/y/z. is that hardcoded or modifyable?

Haven’t checked the whole mod but, could you try shift-clicking the hearthling and clicking on “Level up”?
I wonder if the worker mixin is not liking that there are two “1” keys inside level_data after merging both files.

The crop list is read in the farming_service.lua, and the js file for the crop palette hides / disables the ones that should not be enabled depending on the farmer level or if they’re meant to be unlocked by other means. The js file does retrieve the info from the farmer job to compare the level, using the alias of the farmer job.

1 Like

you know, something interesting happens when i try.


the level up command does not appear, even though the lings in question do gain xp from harvesting.

so i wouldnt be surprised someone went NOT THE WORKER again :’)

The debugtools indeed gates the level up command by not being a worker (debugtools/ui/console/debug_console_commands.js, line 76). You could try using the add_exp console command.

With all the other issues, you might have more luck replacing the farmer job with your farmer/worker hybrid and adding some code to automatically promote workers to farmers.

Was fearing that, or changing the class of the default-added lings. You guys really liked locking down the worker for some reason :’)

(alternative, search for all instances of not a worker, lol, the code is probably going to be mostly the same every time)

well i searched for that not a worker code and it only appears in that location we already discussed. so im guessing that file is loaded before my hot loaded manifest tells it to stop not loading the workers skills :confused:

There’s a missing comma after the first override here? : nordlingmod/manifest.json at master · Thahat/nordlingmod · GitHub

1 Like

That… Could be it actually.
I’ll give it a shot! I’ll let you know :slight_smile:

well that helped, now its no longer a blank screen but at least it has words saying what level and the naming scheme (from crap to master worker)
the rest is probably some other fluke that i need to fix :stuck_out_tongue: back to the drawing board!

1 Like

so looking at the upgrades as i have them now for my worker (mostly copied from the farmer with small changes)

where do the “id” fields point? because i should probably snoop around there but i have no clue where they are hidden.

"level_data": {
      "1": {
         "perks": [
            {
               "type": "apply_buff",
               "name": "i18n(stonehearth:jobs.farmer.farmer_description.level_1_data.perk_000_name)",
               "id": "farmer_speed_up_1",
               "icon": "/stonehearth/jobs/farmer/images/speed_up.png",
               "buff_name": "stonehearth:buffs:farmer:speed_1",
               "description": "i18n(stonehearth:jobs.farmer.farmer_description.level_1_data.perk_000_description)",
               "level": 1,
               "demote_fn": "remove_buff"
            }
         ]
      },
      "2": {
         "perks": [
            {
               "name": "i18n(stonehearth:jobs.farmer.farmer_description.level_2_data.perk_000_name)",
               "id": "farmer_job_opportunities",
               "icon": "/stonehearth/jobs/farmer/images/farmerLv2.png)",
               "description": "i18n(stonehearth:jobs.farmer.farmer_description.level_2_data.perk_000_description)",
               "level": 2
            }
         ]
      },
      "3": {
         "perks": [
            {
               "name": "i18n(stonehearth:jobs.farmer.farmer_description.level_3_data.perk_000_name)",
               "id": "farmer_harvest_increase",
               "icon": "/stonehearth/jobs/farmer/images/farmerLv3.png)",
               "description": "i18n(stonehearth:jobs.farmer.farmer_description.level_3_data.perk_000_description)",
               "level": 3
            }
         ]
      },
      "5": {
         "perks": [
            {
               "name": "i18n(stonehearth:jobs.farmer.farmer_description.level_5_data.perk_000_name)",
               "id": "farmer_unlock_trees",
               "icon": "/stonehearth/jobs/farmer/images/farmerLv5.png)",
               "description": "i18n(stonehearth:jobs.farmer.farmer_description.level_5_data.perk_000_description)",
               "level": 5
            }
         ]
      },
      "6": {
         "title": "i18n(stonehearth:jobs.farmer.farmer_description.level_6_data.title)"
      }

What about the IDs? :thinking:
They’re only specified in that json file. They’re used as an index of a table in base_job.lua to store which perks are already unlocked, so that other scripts (such as AI actions) can ask whether a specific perk has been attained or not, and act accordingly.
So they just have to be unique, you don’t have to worry about them besides that.

Not sure yet why the perks aren’t showing, but it must be in some other file (or an issue about the order in which they’re loaded, like you said, or perhaps the game it’s getting confused with the mixins. The js file is overriden correctly, I checked with the CEF debugger, but there must be something else that’s making them not appear).

well now i know i should probably look at that one at least :stuck_out_tongue:

also, another side effect to my rather strange program i noticed: the upgraded worker outfits are enquipped to people with worker_job. mine have farmer_job.
so my nordlings outfits get made in such a way that they work for both :’)…i should probably not make those buyable or peoples farmers will be all swaggy. lol.

1 Like

more anoyingly, even if my workers level up (they do) and dont display the skills, and have the farmer job in their worker_description, the crops dont unlock if they reach higher levels. ive take a look at stonehearth\services\server\farming\farming_service.lua in the hope that that file decided the unlock or not but the only refference to levels i can find is at line 181
“crop_level_requirement = crop.level_requirement”

which i think only applies if its not defined in all_crops.json…

aaand then i lost track of where to search, any tips on where to look @Relyss ? (or anyone else that has stumbled around the code more often :stuck_out_tongue: )