Making workers First class citizens

Hello guys,

This is my first small mod for stonehearth, It basically adds experience and perks to workers, so that they’re no longer second class citizens who learn nothing from their toils. As they gain experience they become faster and faster. Having experienced workers will be a real boon!

version 2 : resetting worker levels

version 3: job worker levels

Tested on develop 2310

Update:
Now on version 2: on class change it now removes worker class levels for hearthling.

Update the second:
Version 3 is available. it has worker job levels that won’t be lost on promotion to different class and when promoting to a worker again will get readded to calculate experience

Disclaimer be careful :
This mod overwrites workerluac, worker description,json and Job_component .lua

4 Likes

Whilst it’s great to see another modder here, I don’t know how to feel about having the workers level up. It’d make it slower to level up the other jobs later on, since the hearthlings levels up along with the job.

So when your worker would become level 4 and then making him/her into a mason (for example), it’d take as long time for that hearthling to reach level 1 in mason as if he/she would reach level 5 in worker.

I suspect that it’s for this reason that Team Radiant didn’t have the worker level up in the first place.

But don’t get me wrong. I’d surely like to see what other mods you can come up with later on. :wink:

Idk @Drotten, I don’t disagree with the workers leveling up. I do agree it should be slow, very slow at that. They shouldn’t get any perks then maybe the speed thing and a small amount of HP. When it comes to switching to other classes. It shouldn’t affect them at all, they just lose the workers speed buff. But should lvl up as normal. Look at this way, any job you do including gathering and building, you gain exp in real life, as you learn more and you figure out how to do stuff a bit faster.

The only problem I see though is the gear you can put on them. They get speed buffs from that.

Is there a way to mod in an experience wipe with this, that way when they change they can start from square one. It would have to be only if they gained the experience as a worker and I’m unsure how complicated that would be and how much access modders have to that area.

Oh I’m not saying that leveling up workers is bad in itself, only that it gives a penalty and makes leveling up other jobs a lot slower (since the hearthling has leveled up a bit before changing to a different job).

I’m not too worried about the buffs. I haven’t looked at it that much, but I think the buffs from jobs don’t carry over to other jobs (I could be wrong though so don’t quote me on that :stuck_out_tongue: ) I think it’s the same for the gear: the gear is switched depending on the job and the buffs are changed with it.

@Melite that’s possible, and looking at the code for leveling up I don’t think it should be too hard to implement. Maybe the hardest is to add some kind of button that resets all levels and experience back to zero.

Perhaps 2 versions of workers, maybe something like dedicated worker. If you want them to start gaining xp put them in the second tier of worker.

1 Like

Thanks for the responses,
To be honest I didn’t know that jobs all used the same xp pool thing(Just got stonehearth), I’ll see if I can delevel them when changing classes. or indeed making an advanced worker class.
It’s unfortunate they didn’t split up job experience and character experience.

also I’m currently overriding the worker luac. and worker description json,which isn’t very good from a compatability standpoint. esspecially if i need to add a remove_xp function in another luac.
I suppose mixing into workerdescription would be very doable but is that also the case for the worker luac? does it overwrite functions? is there a modding wiki? I guess I should just read all the pinned posts first :slight_smile:

Anyhow thanks for the interest and feedback. I’ll see if i can implement some of these suggestions this week.

the buffs are removed on class change.I like it that way so that it is a choice to have a proffesional worker, but you define this yourself so they don’t HAVE to be removed. it currently just ticks up some xp every hour. so this is very easily modified to be slower or faster. it’s currently 20 xp per hour that might be too fast or too slow depending on if they have to relevel every time they change to worker.

removing levels might introduce some buggy behaviour with the hp’s a character gets on level up.I guess i’ll see this evening.

1 Like

mixintos only work for json files ATM. If you want to modify other files, override is required, though really really not recommended (though I’m also bad in that regard >_>).

So if you feel that you have to override, I’d say: look into Jelly. It extends the API in SH and can easily be modified for what you need, like overriding a LUA file to insert maybe a function or a trigger somewhere.

If you’d like to know more, look in here. RepeatPan explains it all in greater detail (not only in that post but also further down in the same thread).

Yeah it’s not gonna that easy unfortunately. I think that it’s only the max health you’d have to modify together with the level (I’m not completely sure on this though, just a hunch).

2 Likes

Small status update, I’ve gotten it to remove the worker levels on promotion but the new xp calculation is still a bit buggy. it won’t remember the level of the worker. but maybe i can store that and retrieve it creating a sort of worker job level. I guess I could try that in version 3.
I’ll hopefully be able to fix it tommorow so that it atleast resets worker levels to 0 on job change :smile:

Thanks for the links Drotten, I’ll have a closer look at jelly in the weekend. looks promising.

I do miss my polymorphism, inheritance and overriding. :wink:

1 Like

Version 2 is here.
With awesome level resetting workers.
The link has been updated.

I saw that it already stores the job level so it might not be that hard to reset to that level on worker promotion. Will see this evening. Then people can choose between which system they prefer.

and version 3 is here. workers now set total level back by the number of worker levels they have and regain those levels when promoted to worker. They just lose any experience they had when they were promoted to a different class.

1 Like