Can someone tell me how to get more people via editing files

My game has reset my town like 5 times now and I want to cheese my way back to its original size so I was wondering if anyone could tell me the paths to the files to get more starting guys and what I would have to change to get more or a way to get people faster because they seem to not like appearing in my games (my record of people was a mere 8 and I had some big towns)

stonehearth\call_handlers\new_game_call_handler.luac

Line 65 has what you’re looking for. I broke it up into new lines to make it easier to read here. This line creates 7 workers, the firepit, and then puts a few items in your worker hands.

If you want more workers, just add a few extra ones here. You can optionally give them items and place them wherever you want.

local worker1=place_citizen_embark(camp_x-3,camp_z-3)
local worker2=place_citizen_embark(camp_x+0,camp_z-3)
local worker3=place_citizen_embark(camp_x+3,camp_z-3)
local worker4=place_citizen_embark(camp_x-3,camp_z+3)
local worker5=place_citizen_embark(camp_x+3,camp_z+3)
local worker6=place_citizen_embark(camp_x-3,camp_z+0)
local worker7=place_citizen_embark(camp_x+3,camp_z+0)
self:place_item(pop,'stonehearth:firepit',camp_x,camp_z+3,{force_iconic=false})
radiant.entities.pickup_item(worker1,pop:create_entity('stonehearth:resources:wood:oak_log'))
radiant.entities.pickup_item(worker2,pop:create_entity('stonehearth:resources:wood:oak_log'))
radiant.entities.pickup_item(worker3,pop:create_entity('stonehearth:trapper:talisman'))
radiant.entities.pickup_item(worker4,pop:create_entity('stonehearth:carpenter:talisman'))
return{random_town_name=random_town_name}
end
2 Likes

The immigration stuff is in

stonehearth\scenarios\dynamic\immigration_scenario\immigration_scenario.json
stonehearth\scenarios\dynamic\immigration_scenario\immigration_scenario.luac

It would be easiest to edit the JSON file. Just change the expiration_timeout to a lower frequency to make it happen more often, or lower the thresholds so they are more likely to join.

immigration_scenario.json

{
   "scenario_type" : "population",
   "rarity" : "common",
   "uri" : "stonehearth:scenarios:immigration", 
   "scenario_data" : {
      "expiration_timeout" : "6h",
      "happiness_threshold" : 4,
      "food_threshold" : 100,
      "score_threshold" : 1000,
      "title" : "A traveller approaches your town.",
      "success_title" : "__name__ has joined __town_name__!", 
      "messages" : [
         "I've heard a lot about your town!", 
         "I'd like to join your town.", 
         "You guys really look like you could use a hand!", 
         "Wow! What a town! Let me help out!"
      ],
      "outcome_statement" : " A __job__ would like to join __town_name__!", 
      "jobs" : {
         "stonehearth:jobs:worker" : {
            "shares" : 10, 
            "rating" : 1
         }, 
         "stonehearth:jobs:carpenter" : {
            "shares" : 1, 
            "rating" : 3
         },  
         "stonehearth:jobs:farmer" : {
            "shares" : 2, 
            "rating" : 2
         },
         "stonehearth:jobs:footman" : {
            "shares" : 2, 
            "rating" : 3, 
            "equipment" : "stonehearth:weapons:wooden_sword"
         }
      }
   }
}
3 Likes

hey jonzoid do you know if its possible to code a limit on how many characters can use a specific proffession, to prevent a huge power imbalance but still create something unique for 1 villager

I didn’t really look too close…the concept seems easy but it would be a bit involved to do. You would need to make sure immigrants don’t take on a job you already have / have a talisman for. You would also need to prevent constructing talismans for jobs you already have.

I’ve mostly dealt with editing the JSON files up to this point. I believe you would need to write some LUA to help this so I couldn’t be too much help yet.

You can, however, always “promote” any immigrants with jobs back to workers if you want to play with limits on profession count. It would just be up to you to play with those rules.

1 Like

I’ve been having issues with not having enough citizens. Is there a way to either increase the amount you get in game or is there a way to “cheat” them in. As in modding them in or just changing the start up codes. Please leave details if you can, thanks to any that respond.

Here is a post discussing the same issue. :wink:

1 Like

So i changed the “6h” to “2h” and haven’t gotten anyone. I’m fairly new to modding this game so not sure if there was anything else I should have changed.

"expiration_timeout" is used to see how long the immigrant will stay waiting for your response if they can join your town, before just leaving on their own. Changing it will have no effect on how often the scenario is called.

immigration_scenario.luac
immigration_scenario.json

are only about one half of the files controlling this scenario. There is also…

stonehearth/services/server/dm/dm_service.luac 
stonehearth/services/server/dynamic_scenario/population_pace_keeper.luac
stonehearth/services/server/dynamic_scenario/dynamic_scenario_service.luac

The main file you should be concerned with is population_pace_keeper.luac.

The dm_service is responsible for calling to pace_keeper’s which in turn call scenario’s, like immigration. If you’d like more detail let me know ;).

Messing around with a pace_keeper’s update function, along with it’s min/max/cooldown functions you should be able to get the scenario to pop up more often. There is how ever one side of the scenario I’ve left out and that is it’s requirements.

Each scenario implements can_spawn(), which returns true/false if the scenario is good to go. To ensure that the immigration scenario goes through when called, I’d change it’s can_spawn() function to always return true. Currenlty it’s return valued is based on a few different things. All of which is visible in this file

stonehearth\scenarios\dynamic\immigration_scenario\immigration_scenario.luac

Though still your chances are at best 50/50, because of the way dynamic_scenario_service’s try_spawn_scenario(scenario) and _rarity_to_value(rarity) are called, containing rng with no option for 100% follow through.

Overall if you’d like to see the scenario called more often I’d just recommend using a timer and force spawning it. You could still take into account town net worth, housing, food supplies, but then you’d know you have full control.

On a side note, I’ve heard the argument a few times that players are confused as to why they are not getting new Hearthlings. Overall the process comes down to luck and how good your town is. Perhaps a mod that forces the scenario could ease some of the tension. :wink:

dynamic_scenario_service implements force_spawn_scenario(scenario), so in theory it should be callable. If you’d like to discus anything further or perhaps would like me to implement the mod for you I’d be glad to. :slight_smile:

2 Likes

is there a file that saves your villagers data ? example : when i played Timber and stone getting villagers was also really really slow so i made 1 game file then i took all the villagers game data from that game file after playing for a bit and made a new game file and put the old villagers data in the new game file, giving me twice the villagers and some with experience…is there anyway to do that in this one? id gladly trade my slightly bugged town for more villagers xD

@honestabelink Thanks for the info. I have set all the values in

to true. Still haven’t had much luck. But i was wondering if it is possible to call these files in-game via the console. haven’t really played around with it yet.

It seems that all this should be fairly easy once you understand how everything works. Hopefully I’ll start understanding it a lot sooner. lol.

Thanks again for your help.

Actually it possible call scenarios by uri, and will be my recommendation to players looking to cheat a few more Hearthlings in from now on.

Type this into the console

spawn_scenario stonehearth:scenarios:immigration

The console can be opened in game by pressing the tilde key, key next to the number 1.

You would also have do some work to

stonehearth/services/server/dynamic_scenario/population_pace_keeper.luac

As I said before, it goes dm_service to pace keepers, to individual secenario’s. If your happy with adding Hearthling through the console, that’s fine. If you like’d to extend the current behavior to appear more often thats fine too. Just let me know for the other.

Hi there Jonzoid,
for the spawning in of hearthlings and items with it,
how would you spawn in armor, weapons and ingots?
Do show. Thanks

returnes this

If you download the debugtools mod, there’s a command in there called add_citizen that’ll grant you a citizen each time you call it. (make sure you rename the folder from “debugtools-master” to just “debugtools” when you download it).

How exactly do I open stonehearth (inside mod). I get “windows cannot open this program because it has been prevented by a software restriction policy. For more information, contact your system administrator”

Hi and welcome to the forum!

You don’t really open Stonehearth through the smod files. Just start the game up as you usually would; all mods that are in the mods folder will be read and added to the game by itself. Considering that the mods are valid of course.

EDIT: I totally misunderstood what you meant, sorry for that. Luckily @voxel_pirate has the answer for you down below.

Actually “stonehearth.smod” is a re-named .zip-file. To open it, you just need to rename the ending to .zip and use your tool of choice to un-zip.

This doesn’t work for me, have they changed it???

Mod link??? please OvO