# Problems changing .lua

**URL:** <https://discourse.stonehearth.net/t/problems-changing-lua/34950>\
**Category:** Modding\
**Created:** [April 30, 2018, 5:48pm UTC](https://discourse.stonehearth.net/t/problems-changing-lua/34950 "2018-04-30T17:48:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darak](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@Darak](https://discourse.stonehearth.net/u/Darak)\
**Post date:** [April 30, 2018, 5:48pm UTC](https://discourse.stonehearth.net/t/problems-changing-lua/34950/1 "2018-04-30T17:48:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Relyss](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/relyss/32/41785_2.png) [@Relyss](https://discourse.stonehearth.net/u/Relyss)\
**Post date:** [April 30, 2018, 5:51pm UTC](https://discourse.stonehearth.net/t/problems-changing-lua/34950/2 "2018-04-30T17:51:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Darak](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@Darak](https://discourse.stonehearth.net/u/Darak)\
**Post date:** [April 30, 2018, 6:12pm UTC](https://discourse.stonehearth.net/t/problems-changing-lua/34950/3 "2018-04-30T18:12:41Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Relyss](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/relyss/32/41785_2.png) [@Relyss](https://discourse.stonehearth.net/u/Relyss)\
**Post date:** [April 30, 2018, 7:20pm UTC](https://discourse.stonehearth.net/t/problems-changing-lua/34950/4 "2018-04-30T19:20:52Z")

</div>

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:

```auto
local IntegerGaussianRandom = require 'lib.math.integer_gaussian_random'

```

add `stonehearth.` before `lib` :

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

```

---

<div class="post-metadata">

**Author:** ![Darak](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@Darak](https://discourse.stonehearth.net/u/Darak)\
**Post date:** [April 30, 2018, 8:50pm UTC](https://discourse.stonehearth.net/t/problems-changing-lua/34950/5 "2018-04-30T20:50:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Relyss](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/relyss/32/41785_2.png) [@Relyss](https://discourse.stonehearth.net/u/Relyss)\
**Post date:** [April 30, 2018, 9:02pm UTC](https://discourse.stonehearth.net/t/problems-changing-lua/34950/6 "2018-04-30T21:02:14Z")

</div>

Did you put it in the next line too?

```auto
local constants = require 'stonehearth.constants'

```

---

<div class="post-metadata">

**Author:** ![Darak](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@Darak](https://discourse.stonehearth.net/u/Darak)\
**Post date:** [April 30, 2018, 9:55pm UTC](https://discourse.stonehearth.net/t/problems-changing-lua/34950/7 "2018-04-30T21:55:36Z")

</div>

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 :}
