Problems changing .lua

Hi, i started modding and i want to change a .lua file. But when i try to override the lua the game doesnt open, just keeps a blackscreen. The lua file its not even changed, just copy paste, so its something in the manifest i guess. I have it this way:

“overrides” : {“stonehearth/services/server/population/population_faction.lua”:“file(population_faction.lua)”}

As i said i just copy paste the file, so cant be a lua error. Y tried with mixintos, like json, but didnt work. Ty for help

What are you trying to accomplish / change in that file? Sometimes there are things that you can really do with mixintos in JSON files instead of overwriting Lua files.

Take a look at your stonehearth.log (it’s in C:\Program Files (x86)\Steam\steamapps\common\Stonehearth). It might give a hint about the blackscreen.

i want to change the way hearthlings stats and traits are randomized and add a low probability to have super hearthlings with better stats. In the population json i just could change the points of all of them.

Heres the log

2018-04-30 19:36:36.581911 | server | 1 | app | Stonehearth Version 0.24.0.828 (x64)
2018-04-30 19:36:36.581911 | server | 1 | core.config | user id is 4d7df889-cba0-4c3a-9368-e45fa4d5bb67
2018-04-30 19:36:36.581911 | server | 1 | core.config | session id is bc478676-27b1-4f02-8bcb-ca2cb90e5fdc
2018-04-30 19:36:36.581911 | server | 0 | app | Steam present.
2018-04-30 19:36:36.581911 | server | 0 | core.system | Initializing crash reporter
2018-04-30 19:36:37.083882 | server | 0 | lua.data | lua jit is disabled
2018-04-30 19:36:38.311993 | server | 1 | resources | Modules have been modified by the user!
2018-04-30 19:36:38.336057 | server | 0 | app | Running Stonehearth server on port 55888
2018-04-30 19:36:38.336057 | client | 0 | client.core | Connecting to local server…
2018-04-30 19:36:38.336057 | server | 0 | physics.navgrid | subspace pathfinder is enabled
2018-04-30 19:36:38.337060 | client | 1 | game_engine | Initializing OpenGL
2018-04-30 19:36:38.345583 | server | 1 | mod radiant | lua controller lifetime tracking set to “nil”
2018-04-30 19:36:38.358124 | server | 0 | mod stonehearth.ai.service | enable_cpp_compound_action is on
2018-04-30 19:36:38.378177 | client | 1 | game_engine | Determining window placement
2018-04-30 19:36:38.378177 | client | 1 | game_engine | Selecting monitor at 1280, 720
2018-04-30 19:36:38.378177 | client | 1 | game_engine | Creating OpenGL Window
2018-04-30 19:36:38.751758 | client | 1 | game_engine | Creating OpenGL Context
2018-04-30 19:36:38.751758 | client | 1 | game_engine | Finished OpenGL Initialization
2018-04-30 19:36:38.752259 | client | 1 | horde.general | Initializing GL2 backend using OpenGL driver ‘4.6.0 NVIDIA 391.35’ by ‘NVIDIA Corporation’ on ‘GeForce GTX 1080/PCIe/SSE2’
2018-04-30 19:36:38.813471 | client | 1 | browser | cef started.
2018-04-30 19:36:38.867124 | client | 0 | physics.navgrid | subspace pathfinder is enabled
2018-04-30 19:36:38.874142 | client | 1 | client.core | user feedback is on
2018-04-30 19:36:38.874142 | client | 1 | network | client allocating new send buffer (total: 0)
2018-04-30 19:36:38.874142 | client | 0 | client.core | Authenticating…
2018-04-30 19:36:39.089274 | server | 0 | simulation.core | Making authentication request with provider: host
2018-04-30 19:36:39.089274 | server | 0 | simulation.core | Authentication successful, responding with session.
2018-04-30 19:36:39.089274 | server | 0 | simulation.core | {
“session” : {
“player_id” : “player_1”,
“client_id” : “host”,
“provider” : “host”
},
“state” : “configuring”
}
2018-04-30 19:36:39.089274 | server | 0 | mod stonehearth | Player ‘player_1’ joined
2018-04-30 19:36:39.139408 | server | 1 | network | server allocating new send buffer (total: 0)
2018-04-30 19:36:39.140410 | client | 0 | client.core | Authenticated
2018-04-30 19:36:39.142917 | client | 1 | mod radiant | lua controller lifetime tracking set to “nil”
2018-04-30 19:36:39.604646 | client | 1 | lua.code | unrecognized object type ‘boxed’ in json_to_lua!
2018-04-30 19:36:39.605147 | client | 1 | lua.code | unrecognized object type ‘boxed’ in json_to_lua!
2018-04-30 19:36:39.674831 | server | 1 | lua.code | unrecognized object type ‘boxed’ in json_to_lua!
2018-04-30 19:36:39.674831 | server | 1 | lua.code | unrecognized object type ‘boxed’ in json_to_lua!

It seems as if the attributes for the initial hearthlings are set in population_faction.lua based on what’s in ascendancy_population.json, while for immigrants they get random values based on the attributes defined at base_human.json (many of the attributes are based on equations defined in this file). So yeah, you might be able to change those of immigrants, but those of the initial hearthlings are kind of hardcoded there, not to mention the way the traits are assigned.

I tried to override it too but my log does show errors after a while.
You’ll need to change some things on your lua file or it won’t load correctly.

In line 3:

local IntegerGaussianRandom = require 'lib.math.integer_gaussian_random'

add stonehearth. before lib :

local IntegerGaussianRandom = require 'stonehearth.lib.math.integer_gaussian_random'

Now the game starts but when i hit the reroll button sends me a bug of a nil value in get_gender function. Just put the stonehearth. in the line. So i gonna let this part for now and try something else. Ty for help

1 Like

Did you put it in the next line too?

local constants = require 'stonehearth.constants'

ooh now i get it, i had to tell that its from original game and not my mod. Now works fine, ty again for help :}

1 Like