Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DFHack script: Fair Needs  (Read 4885 times)

skeldark

  • Escaped Lunatic
    • View Profile
DFHack script: Fair Needs
« on: August 21, 2020, 10:06:51 am »

# DFHack script: Fair Needs

Version: 0.91 BETA
Download: https://github.com/skeldark/scripts/

We know the Need system is quite bugged at the moment and it gets worse with the age of your fortress.

In my opinion the Problem is, that dwarfs show no interest in fulfilling their needs them self.
Its the players job to create the environment but its the dwarfs job to use this environment depending on his needs.
E.g. Talk to a friend if you need to talk to a friend and don't listen to poetry that you feel 0 need for.

So i created some DFHack-scripts to fix/improve the Need and Stress System.
I did try to come up with not cheating solutions!
Meaning i don't just change the Need-Values (well in most cases)

1) Religion (need-religion.lua)  (Static Script)
Dwarfs can collect way to many religions and pray in order of the index not in order of need.
This leads to endless pray-loops where the dwarf never reaches the last religions and is always unhappy.
To fix this i remove all Religions expect the first 3 (together with the deity links).
This is the max amount of Religion a dwarf can have at worldgen.
So he still needs to Pray to all his gods but its possible that he does so.

2) EatGoodMeal (need-goodmeal.lua) (Static Script)
We all know the problem with this one. Its way way to specific and you have no chance of finding the right meal for each dwarf.
Even if you do, there is a big chance he will actually never eat it.
To fix this i alter the Preference of each Dwarf and add a Food-Category instead of a specific food-item.
(i did not think it would work either but to my surprise it does!)
Its still quite a challenge, to create food from every Category, to make all happy.
But at least you have a fighting chance now!
Categorys are: MEAT, EGG, CHEESE, PLANT_GROWTH (fruits and leaves), PLANT, FISH, SEED

3) Acquire Item (need-acquire.lua) (Semi-Static Script)
There is a workaround to fill this need. You let all your dwarf carry Trinkets between 3 Stockpiles in an endless loop so that they take an item eventually.
I never liked this Goblin like behaviour.
Instead my script assigns every Dwarf in need a Trinket.
You still have to produce this Trinkets and the Dwarf still goes and collects his Trinket but he does it himself!
 
4) Wander (need-wander.lua) (Labor-Script)
Enables/Disables Pick/Gather Labor for anyone who needs to Wander.
SETUP:
   -An active gather Zone with plants/fruits to gather (best underground)   
   -Dwarfs with "Alchemy Labor" are ignored

5) Help Somebody (need-help.lua)  (Labor-Script)
Enables/Disables a Animal Care for anyone who needs to  Help Somebody
SETUP:
   -Gazeing Animals in Cages
   -Dwarfs with "Alchemy Labor" are ignored

6) Craft Item (need-craft.lua)(Labor-Script)
Enables/Disables a chosen Craft for anyone who needs to Craft Something.
SETUP:
   -Few Workshops for this Craft ( default stonecraft)
   -This Workshops only accept lower skill workers (over manager)
   -This Workshops have repeated Craft Tasks queued
   -Dwarfs with "Alchemy Labor" are ignored
   
   
7) Training (need-training.lua) (Squad-Script)
Assigns/Frees Dwarfs that needs to Train to Training-Squads
SETUP:
   -Minimum 1 squad with the name "CIVGYM"
   -An assigned squad-leader that is good in teaching
   -An assigned Barracks for this squads (best underground)
   -Activate Training orders for this Squads ( Military/Alarms)
   -Dwarfs with "Alchemy Labor" are ignored

8) Need Value (need-value.lua)

Outputs the average-need-value of your dwarfs.

X) Autostarter ( need-all.lua )
A script that runs the above scripts on timers.
Just use  "need-all -start" and "need-all -stop" if you think they had enough.
You could run it nonstop but i think its best if you use while on break/party to make the dwarfs happy.


XXX) Be with Friends / Be with Family (need-fuf.lua) (Static Script) (CHEAT!)

I tried... But the Problem is so deep in the System i can not find an easy solution.
Dwarfs just don't socialise enough and with the right persons. Even if you try to force them, its not enough to satisfy this needs.
So here i just set the Need to 0. If you have a better idea let me know!

Hope someone finds it useful :)

Thanks to:
Everyone who wrote a DFHack script because i think i "borrowed" code from most of them :)
lethosor, who helped me with my many questions about DFHack and so preventing me from giving up.

TLDR:
1. Download scripts
2. put files into DFHACK/script folder
3. type "need-all -help" into the DFHACK-Console
4. read what you need to Setup and do it ;)
5. type "need-all -start" into the DFHACK-Console
-=> watch the dwarfs get happy over time

« Last Edit: August 26, 2020, 06:24:04 am by skeldark »
Logged

Zalthor

  • Bay Watcher
    • View Profile
Re: DFHack script: Fair Needs
« Reply #1 on: August 22, 2020, 06:49:02 am »

Wow, this looks nice, especially the religion one; that is able to directly able to incapacitate dwarfs if time goes on for too long, since they'll always be purple praying.

I'll give them a test and see how they work. Hopefully they'll be included directly within DFhack, in time.
Logged

skeldark

  • Escaped Lunatic
    • View Profile
Re: DFHack script: Fair Needs
« Reply #2 on: August 22, 2020, 01:04:57 pm »

Thanks. The religion bug was the reason i started this.
I had so many dwarfs trapped  in the Pray-Loop.

Tell me if everything worked. I only tested it myself so far.
Logged

Uthimienure

  • Bay Watcher
  • O frabjous day!!
    • View Profile
Re: DFHack script: Fair Needs
« Reply #3 on: August 22, 2020, 02:52:15 pm »

Are these scripts safe to use on an established fort, or should I start a new one?
Logged
FPS in Gravearmor (850+ dwarves) is 3-6 (v0.47.05 lives on).
"I've never really had issues with the old DF interface (I mean, I loved even 'umkh'!)" ... brewer bob
As we say in France: "ah, l'amour toujours l'amour"... François D.

skeldark

  • Escaped Lunatic
    • View Profile
Re: DFHack script: Fair Needs
« Reply #4 on: August 22, 2020, 05:09:37 pm »

@Uthimienure
Not everything the scripts do can be undone.

-good-meal comes with an -undo function
-labor/training scripts are by nature only temporary
-acquire fuf and religion make permanent changes to dwarfs minds

Buts its only changing stuff to the positive.
So in generell its kind of save.
  BUT i only tested it myself so far so i would make a copy of the save just in case i missed something.
Never did i break anything in any test tho.

They are meant to be used on established forts, because you need some setup for the labor scripts and needs only really becomes a problem later in the game.
Also they still need off-time to do all the need related task and you need the economy to support that.

Load a save put your dwarfs on break(or not) let it run for a while, (watch the outputs in the consol)  stop it again and see what your needs look like in dwarf therapist.
If something happens that you don't like report back.

« Last Edit: August 22, 2020, 05:29:04 pm by skeldark »
Logged

indyofcomo

  • Bay Watcher
    • View Profile
Re: DFHack script: Fair Needs
« Reply #5 on: August 24, 2020, 01:34:18 pm »

4 ) Be with Friends / Be with Family (need-fuf.lua) (Static Script)
I tried... But the Problem is so deep in the System i can not find an easy solution.
Dwarfs just don't socialise enough and with the right persons. Even if you try to force them, its not enough to satisfy this needs.
So here i just set the Need to 0. I really dont like that solution but at the moment i dont have an better idea! If you have one let me know!

Could you make married couples have high-priority sleep needs at the same time?
Could you make family/friends have high priority eat, drink, socialize, or pray(if same religions) needs at the same times. Then all the player has to do is assign them seats next to each other.
Logged

skeldark

  • Escaped Lunatic
    • View Profile
Re: DFHack script: Fair Needs
« Reply #6 on: August 25, 2020, 05:26:32 am »

@indyofcomo
I think familiy is also socializeing but i am not even sure.
All this poet reading and story telling in the travern does not really help either. Or does it help building connections? I dont know
There is so much vague and unclear about connection building and the wiki is not very helpfull in this topic either.


The problem is they dont build and deepen connections.

Many dont even have friend and familiy because for this to happen they have to sozialise with the same dwarf several times.
In practise its only a handfull off diffrent dwarfs they talk to in a big fortress.

I need to find a way to make them sozialize way more  and at the same time make sozializeing have more impact, so they create more connections between each other.

« Last Edit: August 25, 2020, 05:33:54 am by skeldark »
Logged

indyofcomo

  • Bay Watcher
    • View Profile
Re: DFHack script: Fair Needs
« Reply #7 on: August 25, 2020, 01:28:15 pm »

I need to find a way to make them sozialize way more  and at the same time make sozializeing have more impact, so they create more connections between each other.
Well we can do that, by assigning seats in taverns. If only the same 20 dwarves out of 200 show up in The Grinning Steel Boot, they'll talk with them. Even if it takes a few visits before they see the same dwarf again, at least it can happen at better probability than all 200 using same tavern.

I have considered before burrowing segments of my population to their own work area,bedrooms, taverns, and temples. It's a little more micro than I want to take on at the moment.
I'll certainly be using your religion and get item scripts, possibly good meal.

On training, why do all other places have to be disabled? And what do you mean by places?
Logged

skeldark

  • Escaped Lunatic
    • View Profile
Re: DFHack script: Fair Needs
« Reply #8 on: August 25, 2020, 02:06:05 pm »

@indyofcomo
im working on a solution right now but im not sure if it will work. ( i try let every dwarf at least know all others dwarfs in the fortress to speed up the friend /lover  making)
I tested borrows but  it did not really help. Even after 3 months borrow together they did not make enough friends to beat the need counter.

forget that training part, it was an mistake.
I wanted to say that the other position of the squads should not be assigned.
But my script will unassign them anyway if the dwarf does not have any need for training.




« Last Edit: August 25, 2020, 02:11:33 pm by skeldark »
Logged

skeldark

  • Escaped Lunatic
    • View Profile
Re: DFHack script: Fair Needs
« Reply #9 on: August 26, 2020, 06:21:41 am »

SMALL Updates:
Changelog:
Removed need-fuf from need-all
Fixed some problems with the -help arguments
need-goodmeal now adds SEED Categorie by default "-noseed" /to disable
Cleaned Code
 

Update on Friends and Family
The problem is in the size of the fortress. The fuf/ sozialise mechanic workes ok for 30 dwarfs and gets more and more broken as bigger the fortress is.
I found a way to boost the friendprozess.
But even when i force everyone (160 dwarfs) to sozialise nonstop and boost the friendmaking and boost the soical skills:
It takes in avg half a year to fullfill "Talk to a friend" for 85% of population.
(without boost the need rises faster then it can be fullfilled)
There are just to many possible connections with so many dwarfs. I still dont see a clean solution.
And all of that does not help with family alot.





« Last Edit: August 26, 2020, 06:25:32 am by skeldark »
Logged

Silverwing235

  • Bay Watcher
    • View Profile
Re: DFHack script: Fair Needs
« Reply #10 on: September 20, 2023, 12:28:55 pm »

Apologies for the necro, @skeldark - in case you weren't aware, there's been a lot of recent interest in those scripts of yours.
Logged