Client/server_init_scripts in a deferred_load mod are not possible?

So I’m trying to load a script in a deferred_load mod (the archipelago_biome_extra) in its manifest, like this:

"server_init_script": "file(archipelago_biome_server_extra)",

But that file is never called. I added some logs in it to check.

Removing the “deferred_load”: true, from the manifest (which makes it a normal mod, loaded within the start of the game instead of only after the biome selection) makes it work, and the file is called, and I can see the logs being printed.

I am doing something wrong or this is not supported?

This is not supported. Hot loaded mods do not go through server or client initialization because the server and client have already been initialized by that time. Sorry! T_T

Ok, thanks for clarifying.

I’m trying to change the random town names when in that biome. So instead of “Rosewood” or “New Spring” names being suggested, it would be something like “Black Water Atoll” or “Coconut Island”.

Just adding it (through mixinto or overrides) does not work, as the game reads those files before the changes are made and ends up with the old version in memory/variables.

Maybe I’m approaching this problem in the wrong way or most probably overcomplicating it.

1 Like

You could try to do something with the new mixintypes override/remove tech. That wouldn’t be a script, just a hotloaded mixinto, if your deferred mod runs whenever the archipelago is chosen.

That’s what I did. But the game gets the old file in memory before the hotload happens, so nothing that I change through a mixintype has any effect as the game will just use the version it has in memory, ignoring the json with the applied changes.

I will try to do this in the main mod, and just add a condition to check what biome it is in. If not Archipelago, use the vanilla name generator (loaded from the kingdom), else loads my name generator.

1 Like


You could probably use the same way I’ve loaded mods before there was any sort of mod managing, including init scripts. Define a callback (function/command) in your manifest, then create a JS that simply calls that function, therefore “initialising” your mod from outside. Worked like a charm three years or so ago.

I created a function which is being called only when using the biome (at the minimap screen). The random generated name is being created correctly too. (checked through the logs)
But I’m having problems to apply it to the town.

I’m using this:

local my_town ="player_1")

The first line is giving me the error attempt to index field ‘town’ (a nil value)
I’m not sure why it is giving me nil. It is the same as the original function. Do I need to import something? Cause I tried importing the town and town_service and it didn’t worked either…

The town service, or even stonehearth itself, may not be initialized at the time you’re calling that code.

That is being called when the world_generation service activates (when the minimap is first draw). It is in my biome trace (based on the rayya ui hotload, where it traces the kingdom)

The town name is set just after the first screen where you select kingdom, biome, and difficult.

I guess I’m just calling it wrong.