Unlock Models for selected Kingdoms

It’s possible to lock and unlock models of a selfmade mod when you select a certain Kingdom?

For example:

I have a desk out of wood an the same model but made out of clay. The clay table will be a sostitute of the wood model when you play with the Rayya Kingdom.

It’s something like this possible? If yes, how i can add this function to the mod?

This should be possible my settlement decor mod does something similar except it unlocks recipes based on the biome selected. If you create a campaign that only triggers when a certain kingdom is selected and the campaign simply iterates through and unlocks the recipes you want while keeping the recipes for the other kingdom locked, that should do it. For example …

{
   "type": "campaign",
   "rarity": "common",
   "can_start": {
      "test_1": {
         "kingdom_check": {
            "type": "deny_if_not",
            "item": "kingdom",
            "value": "stonehearth:kingdoms:ascendancy"
         }
      }
   },
   "arcs": {
      "trigger": {
         "some_recipes": "file(unlock_some_recipes_arc.json)"
      },
      "challenge": {},
      "climax": {}
   }
}

Something to note is that the current recipe unlock encounter will create a bulletin every time a recipe is unlocked, which will spam the player if you do this for multiple recipes, so I suggest creating a modified version of that encounter that does not create a bulletin and use that instead. I did the same thing in my mod, so use that if you want SettlementDecor

1 Like

@The_M, yes i mean this! Unlock recipes depending on the selected Kingdom.

Ok, maybe a little bit too complicate for a rookie like me xD

I have to take a closer look on your mod if it’s permitted :smiley: and maybe i can applicate something to my mod. Thx for the reply

1 Like

Or you could take the same approach the Rayya mod takes. Makes a client file that runs only when Rayya is selected, and make that load a “sub” mod that changes your recipes, adding for Rayya and removing from Ascendancy.

ok, both seems to be very interesting.

in your case @BrunoSupremo i have to use the same aliases for Rayya than i use for the Ascendancy Empire? Or i have to follow a different approach?

this all works thanks the “overrides-code” in the manifest file?

   },
   "overrides": {}
}

Will it be the same item for the same crafter, changing only the ingredients?
If so, yeah, a simple override would be enough.

If it will be crafted by different crafters (carpenter in As and potter in Ra for example), I guess the easiest way is to make the item in your main mod as usual, but both recipes would be in their own sub mods. One for each kingdom.

The fisher talisman is almost like this. I had it for both classes, but for Rayya it is locked (like the fountains and monuments). When the players chooses Rayya as the kingdom, it loads their manifest which unlocks that potter recipe, but it will also lock the carpenter recipe.
There is a “manual_unlock” key you can add to their recipe .json that locks/unlocks recipes. So in one manifest you set it as true and in the other you set it as false.

Ok, i have to take a look on this. But sounds good this possibilities. And yes, i have to change the wokshop and also the qc file

ok, tried to add the rayya objects to the mod but something doesn’t work properly.

did i have some errors in the lua or in one json file??

Models are only dimostrative… GitHub Mod <-- LINK

You need to add this to your main manifest:

"client_init_script": "file(homesweethome_client)",

to load that lua file.

1 Like

Ahh i have forgot the most important thing xD many thanks!!

i tried to integrate the lua into the manifest but i get this error message by starting the game.

ENGINE ERROR 1
release-737 (x64)[M]
attempt to call a nil value
stack traceback:
[C]: ?

ENGINE ERROR 2
release-737 (x64)[M]
c++ exception: lua runtime error
stack traceback:

Unfortunately i only copied the lua-file from your Mod @BrunoSupremo, maybe something is missing

From your git it looks like the lua client file is incomplete. Add this to it:

local function trace_player_service()
	_radiant.call('stonehearth:get_service', 'player')
	:done(function(r)
		local player_service = r.result
		check_override_ui(player_service:get_data().players)
		player_service_trace = player_service:trace('rayyas children ui change')
		:on_changed(function(o)
			check_override_ui(player_service:get_data().players)
			end)
		end)
end

radiant.events.listen(homesweethome_client, 'radiant:init', function()
	trace_player_service()
	end)

return homesweethome_client
1 Like

yes, this entire part was missing :confused:

thx @BrunoSupremo, now it’s working fine.