News:

Welcome to World of Banished!

Main Menu

Question about "RandomSelection _deathSelector"

Started by sym, December 19, 2016, 04:21:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sym


RandomSelection _deathSelector
{
float _years = 10;
float _population = 100;
}

from /Game/Profession/Profession.rsc

I'm wondering exactly what these variables represent. I've looked through the resources, but I can't find how they are actually used.

Discrepancy

The code is attached to the individual Professions. As far as I know it is controlling the chance/likelihood of a 'work death' for that profession.

If you look throughout the Profession.rsc file, you will see that the Miner has 'float _years = 4;' -- the miner is the most 'dangerous' profession, the likelihood of a death to a miner is higher.
A Buillder, Forester and Hunter I think are next, with 'float _years = 5;'
The lower the number, the more likely a 'work death' will occur. Higher the numbers, the less likely.

The code 'flost _population = 100;' I would guess would be the required population at which a death could occur.

I'm sure @Tom Sawyer or another person from this great community will have more insight into this.

sym

Thanks for the reply :)
I just tested this by setting values in the laborer's Profession.rsc to these:
_years = 0.1f
_population = 5

and then started a new game, this was the outcome:


My entire population died off rapidly, even after hitting and going below the threshold of 5, so I don't think that's what _population refers to..

_years is definitely a scale of how likely someone is to die on the job, lower being a higher chance of death.. If you set it to wildly high values you should basically never experience a death.

elemental

You'd think that "years" might refer to time rather than probability. Maybe  _years denotes how often the game rolls the dice to see if someone is going to die, but exactly how the game determines which profession gets hit and what chance they have of dying... who knows. These links might be helpful:

Safer mines and quarries mod:

http://steamcommunity.com/sharedfiles/filedetails/?id=741446941&searchtext=mining

and the source code for that mod:

http://www.nexusmods.com/banished/mods/46/?tab=2&navtag=http%3A%2F%2Fwww.nexusmods.com%2Fbanished%2Fajax%2Fmodfiles%2F%3Fid%3D46&pUp=1

Tom Sawyer

I do not know the exact formula. But I think the values mean that by using a random function about every x years one of y citizens dies if he does this job.

The lower x (_years), the more dead.
The lower y (_population), the more dead.

The deadliest job in vanilla Banished is by far the stonecutter followed by miners. In the North I changed the stonecutter to the better level of the miner and all jobs in the Nordic woods are more dangerous with some new events. ;D

sym

#5
@elemental That's actually the original reference I was using when trying to learn how to write a mod. It was pretty helpful for my case, but didn't help really in explaining what the values did. I do think it has something to do with probability.

@Tom Sawyer I think you might be close to it with that. Perhaps it acts as some sort of ratio, as in: if a worker worked without stopping for (_years amount of game years), then you can expect (_population amount of workers) to die? edit: This is definitely not the case.

I'll do some more testing today and report results. I've sent an e-mail to Shining Rock asking for specifics about how the deaths work, hopefully I get a response..