Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

Dtry

Uploaded by

dTry

Virus scan

Safe to use

Tags for this mod

About this mod

is DAR's random() function not working as intended for u? use this calculator to figure out real probability.

Permissions and credits
Many ppl use DAR's random() function to assign NPCs random animations, but mathematically, the actual chance of those animations triggering is different from what you put in to random(). Here's why:

say if I have 5 DAR folders, each containing a sprint animation. I want to my character to use them equally randomly. What do I do intuitively? Give al of them 20% random chance by adding random(0.2) to _conditions.txt. Well, that's not how exactly probability works, and you may end up getting one type of animation way more or way less frequently than other. This is because when DAR chooses animation, it goes through 2 steps:

1. deciding which folders would be available
this includes looking into each folder's conditions.txt and see if they apply to the character calling the animation. So in the aforementioned case, each folder indeed have 20% chance to be available.

2. selecting the actual animation
during this process DAR looks at every folder's names and rank their priority. Folders with larger number names gets prioritized. this is where the probabilities mess up. For example, if the folder with lower priority gets selected 20% of time, while folders with higher priorities also get selected 20% of time, lower priority folder will much more likely be overwritten, even though it got its 20% chance. 

So what to do?
 a very simple probability algorithm that rebalances all the chances:

Probability to put into Random() = expected real probability of this folder / net probability of higher priority folders NOT overwriting this folder

The program automates the calculation. You only need to input the he number of DAR folders and desired real probability for each of them, and it generates an array of probabilities for each folder‘s Random() function.


How to use the program:

1. own windows
2. have internet.
3. have Nexus account.
4. download file.
5. extract file.
6. own a mouse.
7. double click .exe.
8. input how many DAR folders are you going to use to store the same set of animation(but different actual animations)
9. input whether you want each of them to be triggered with actual equal probability, or you want to prioritize one over another and customize the probability of each. If you choose to customize probability, you'll need to input probability of each folder in ascending order one by one. The sum of custom probability cannot be bigger than 1
10. calculator will return an array of values, they are corresponding values to put into your Random() function in _conditions.txt for each folder.
11.your OCD is cured.
SourceCode