@AncientCowboy Any chance you'd incorporate this into EEUI Tweaks?
I tried to install it on the EET SoD UI but just copying the content changes the position of the +- buttons. There are also other differences I didn't quite know how to deal with.
I'll take a look at it when I get a chance - and see if I can spot the problem. As a general rule I avoid 'modding the mod' for the mods I put in EEUITweaks (other than my own, of course ) - generally I just fiddle with installation order, determine what components should be installed for different configurations, and discover mods that conflict. However, this might be something fairly trivial...
@GrimLefourbe - After resetting my EET GUI to SOD flavor (I normally run it with BG2 UI), and finalizing, I pasted the relevant parts from the SOD zip into UI.MENU (following the manual install instructions in the OP). It seemed to work okay. A bit more 'sluggish' in terms of response to button click than when I set it up in 'pure' BGEE/SOD (not surprising considering what EET is), but otherwise seemed to be okay. Details - EET version 1.0RC6.3, SOD version 2.3.67.3 Picture:
Did you have any other UI.MENU mods installed? Particularly related to character gen?
Updated to EET RC7.1 (knew I'd need to anyway for the next EEUITweaks version), setup SOD gui, manually patched UI.MENU. Worked fine. For anyone doing this - be very careful with the CHARGEN_ABILITIES replacement. Replace ONLY the menu definition (not the Lua code block that precedes it) and be sure to include the new LUA code block as in the listing/zip. Effectively, you'll be inserting a new LUA block before CHARGEN_ABILITIES and overwriting the old CHARGEN_ABILITIES menu definition with a new CHARGEN_ABILITIES definition. @Faydark - May I include this in EEUITweaks?
@AncientCowboy Well I guess I must have messed up somewhere, my brother had no good text editor on his computer so I was a bit confused. Thanks for the integration into EEUITweaks!
@GrimLefourbe - One of my primary motivations for EEUITweaks was to save my 'Ancient Eyes' and 'Ancient Muscle (non)Control' from the error-prone hassle of manual patching . Hopefully I'll get time to drop the next release (which will include this) later this week.
Since this seems to be the only autoroller compatible with LeUI, are there any plans to incorporate some kind of priority for exceptional strength? I know BG1 adds a Strength book, but that's quite far into the game, and I personally rather have a higher exceptional Strength during most of BG1 than, say, a higher Intelligenge during the entire saga.
The easiest would probably be to allow the user to set minimum exceptional strength to 01, 51, 76, 91 or 00, and discard any rolls with a lower exceptional strength.
Alternatively, users could be allowed to set bonus values for exceptional strength ranges, something along the lines of: 51-75 (default +1) 76-90 (default +1) 91-99 (default +1) 00 (default +2) Then when a roll has an exceptional strength of 51 or higher, it adds the bonus value for that exceptional strength to the total rolled value. Say you'd leave them to the above details, and you've saved a roll of 86 total with Strength 18/40. Then if a roll of 85 total has a Strength of 18/80, it artificially adds the bonus for 76-90 (which defaults to +1), making it count as a total of 86, and thus replaces the old stored value as the exceptional strength is higher.
The reason behind the above default values is that THAC0 increases at 18/51 and 18/00, making those steps more important than 76 and 91.
How would you set this up in EET using lefreut's BG1EE UI? EEUI-tweaks sets it up with the standard BGII UI which causes a mismatch like the one in Mr2150's post.
I haven't looked into it myself, it would depend on if IWDEE supports the "easily" moddable UI system that the BG games have now. If I get some time, I may look into it. No promises on a timeline though, I have less time lately for modding than I would like.
@Axie, what is it you are chasing? If it is the Autoroller itself, then the EEUITweaks version of @Faydark 's Autoroller has already been updated to work with IWDEE 2.5. I would, of course, opt for the later version which I think is v3 at the moment. It works well.
I wanted to use this in IWD:EE with DnD 3.5 Rules mod (https://forums.beamdog.com/discussion/66842/mod-dnd-3-5-rules-in-bg-ee-and-bg2-ee-v-2-0/p1) enabled, was working fine in pre-generated characters with only ui getting weird until I wanted to make a rogue which doesn't work with this mod and the other mentionned up there, so I know nothing about modding but used my copy paste skills to make this to work just fine with this setup, tested and no problem so far.
EDIT: If it's allowed I can post the UI.MENU here, but prefer to ask before since it use ressources from DnD 3.5 Rules mod and this Auto reroll mod.
Hello, I know this thread is old, but I stumbled upon something strange
I tried to do a good roll on elven ranger/archer with this autoroller and noticed that every time I keep getting same stats when I get 104 (highest I could get) roll
these are 18/54 17 17 18 17 17
I got these same numbers 3 times in a row after closing game, starting a new one and launching autoroller
Then I asked my friend to install game, autoroller and try same roll with elf/archer on another computer
Guess what - he got same 104 roll
18/54 17 17 18 17 17
Images attached
Since this seems to be the only autoroller compatible with LeUI, are there any plans to incorporate some kind of priority for exceptional strength? I know BG1 adds a Strength book, but that's quite far into the game, and I personally rather have a higher exceptional Strength during most of BG1 than, say, a higher Intelligenge during the entire saga.
The easiest would probably be to allow the user to set minimum exceptional strength to 01, 51, 76, 91 or 00, and discard any rolls with a lower exceptional strength.
Alternatively, users could be allowed to set bonus values for exceptional strength ranges, something along the lines of:
51-75 (default +1)
76-90 (default +1)
91-99 (default +1)
00 (default +2)
Then when a roll has an exceptional strength of 51 or higher, it adds the bonus value for that exceptional strength to the total rolled value. Say you'd leave them to the above details, and you've saved a roll of 86 total with Strength 18/40. Then if a roll of 85 total has a Strength of 18/80, it artificially adds the bonus for 76-90 (which defaults to +1), making it count as a total of 86, and thus replaces the old stored value as the exceptional strength is higher.
The reason behind the above default values is that THAC0 increases at 18/51 and 18/00, making those steps more important than 76 and 91.
I know I am quoting a 3 year old post here, but I was thinking about the same thing. This is frankly a little gem of a script and I thought that putting this here could help out others who search for this in the future.
So, I made a ham-fisted hack to solve the above. This is based on the latest version from the EEUITweaks mod collection (and yes, it works in Icewind Dale as well). I was considering posting in that thread since it has more traffic, but it seems more relevant here. Will try to explain as clearly as possible so anyone without modding experience can follow.
Disclaimer: I take no credit whatsoever for this work, all praise is due @Faydark
1. Open your game installation folder.
2. Open the "override" subfolder.
3. Find the file "UI.menu" and open it in a text editor (notepad works fine). Make a backup if you are not feeling bold.
4. Ctrl+F and search for "auto-roller".
5. The first thing you will see is a function called GetExceptionalStrength(). Close to the bottom of this function you will find the lines:
else
exceptionalStrength = 0
end
Edit this so that it says "100" instead of "0" here. This is done to not break the script in case the character cannot have exceptional strength.
6. Just below, you will find the function StoreIfBest(). The first 7 lines of this function will look like this:
local exceptionalStrength = 0
if ( storedTotalRoll == chargen.totalRoll ) then
exceptionalStrength = GetExceptionalStrength( )
end
if ( ( storedTotalRoll == chargen.totalRoll ) and ( storedExceptionalStrength < exceptionalStrength ) ) or
( storedTotalRoll < chargen.totalRoll ) then
7. Either edit by hand, or copy-paste, so these lines read as follows:
local exceptionalStrength = 0
exceptionalStrength = GetExceptionalStrength( )
if ( ( storedTotalRoll < chargen.totalRoll ) and ( exceptionalStrength > 90 ) ) or
( ( storedTotalRoll == chargen.totalRoll ) and ( exceptionalStrength == 100 ) ) then
Save the file and run the game. The difference from the original version is that now the script will only store rolls with an exceptional strength of 91 or higher, and ignore other rolls even if the total roll is higher than the stored one. This script will roll you a total of over ninety with high exceptional strength so quickly anyway that this is by far my preferred behavior. The script will overwrite an equal roll only in the case that the exceptional strength was rolled as 100 (but then again overwrite that roll if a higher total with 91 or more exceptional strength was rolled).
Note also that this will make the auto-roller run slower, due to calling the GetExceptionalStrength() function on every single roll, instead of only when the total roll was equal to the stored one. It is not by any means slow though. I rolled up a party of 6 in IWDEE, all with totals of over 93 and 91-100 exceptional strength in a matter of a few minutes.
Since this seems to be the only autoroller compatible with LeUI, are there any plans to incorporate some kind of priority for exceptional strength? I know BG1 adds a Strength book, but that's quite far into the game, and I personally rather have a higher exceptional Strength during most of BG1 than, say, a higher Intelligenge during the entire saga.
The easiest would probably be to allow the user to set minimum exceptional strength to 01, 51, 76, 91 or 00, and discard any rolls with a lower exceptional strength.
Alternatively, users could be allowed to set bonus values for exceptional strength ranges, something along the lines of:
51-75 (default +1)
76-90 (default +1)
91-99 (default +1)
00 (default +2)
Then when a roll has an exceptional strength of 51 or higher, it adds the bonus value for that exceptional strength to the total rolled value. Say you'd leave them to the above details, and you've saved a roll of 86 total with Strength 18/40. Then if a roll of 85 total has a Strength of 18/80, it artificially adds the bonus for 76-90 (which defaults to +1), making it count as a total of 86, and thus replaces the old stored value as the exceptional strength is higher.
The reason behind the above default values is that THAC0 increases at 18/51 and 18/00, making those steps more important than 76 and 91.
I know I am quoting a 3 year old post here, but I was thinking about the same thing. This is frankly a little gem of a script and I thought that putting this here could help out others who search for this in the future.
So, I made a ham-fisted hack to solve the above. This is based on the latest version from the EEUITweaks mod collection (and yes, it works in Icewind Dale as well). I was considering posting in that thread since it has more traffic, but it seems more relevant here. Will try to explain as clearly as possible so anyone without modding experience can follow.
Disclaimer: I take no credit whatsoever for this work, all praise is due @Faydark
1. Open your game installation folder.
2. Open the "override" subfolder.
3. Find the file "UI.menu" and open it in a text editor (notepad works fine). Make a backup if you are not feeling bold.
4. Ctrl+F and search for "auto-roller".
5. The first thing you will see is a function called GetExceptionalStrength(). Close to the bottom of this function you will find the lines:
else
exceptionalStrength = 0
end
Edit this so that it says "100" instead of "0" here. This is done to not break the script in case the character cannot have exceptional strength.
6. Just below, you will find the function StoreIfBest(). The first 7 lines of this function will look like this:
local exceptionalStrength = 0
if ( storedTotalRoll == chargen.totalRoll ) then
exceptionalStrength = GetExceptionalStrength( )
end
if ( ( storedTotalRoll == chargen.totalRoll ) and ( storedExceptionalStrength < exceptionalStrength ) ) or
( storedTotalRoll < chargen.totalRoll ) then
7. Either edit by hand, or copy-paste, so these lines read as follows:
local exceptionalStrength = 0
exceptionalStrength = GetExceptionalStrength( )
if ( ( storedTotalRoll < chargen.totalRoll ) and ( exceptionalStrength > 90 ) ) or
( ( storedTotalRoll == chargen.totalRoll ) and ( exceptionalStrength == 100 ) ) then
Save the file and run the game. The difference from the original version is that now the script will only store rolls with an exceptional strength of 91 or higher, and ignore other rolls even if the total roll is higher than the stored one. This script will roll you a total of over ninety with high exceptional strength so quickly anyway that this is by far my preferred behavior. The script will overwrite an equal roll only in the case that the exceptional strength was rolled as 100 (but then again overwrite that roll if a higher total with 91 or more exceptional strength was rolled).
Note also that this will make the auto-roller run slower, due to calling the GetExceptionalStrength() function on every single roll, instead of only when the total roll was equal to the stored one. It is not by any means slow though. I rolled up a party of 6 in IWDEE, all with totals of over 93 and 91-100 exceptional strength in a matter of a few minutes.
Can you just give the file ? I cant get how to make your settings work.
Hello, I know this thread is old, but I stumbled upon something strange
I tried to do a good roll on elven ranger/archer with this autoroller and noticed that every time I keep getting same stats when I get 104 (highest I could get) roll
these are 18/54 17 17 18 17 17
I got these same numbers 3 times in a row after closing game, starting a new one and launching autoroller
Then I asked my friend to install game, autoroller and try same roll with elf/archer on another computer
Guess what - he got same 104 roll
18/54 17 17 18 17 17
Hi, this bugged me for few days now so I dug deeper. I have confirmed that BG:EE (and BG2:EE) uses rand() function from C library. It is quite weak, poorly initialized (or rather not initialized at all) and after some time it even repeat itself. Therefore character ability combinations are somewhat predetermined and you cannot go out of this "loop". In my instance, a fighter cannot go higher than 100 points total (with strength 18/45).
Because of different implementations on Windows and Linux, you get different results. However, underlying issue is the same. I suspect that Linux is bit better but I didn't investigate that far.
The fix for this issue (including making all dice rolls better) is relatively easy on Linux. We can just replace rand() with better implementation using LD_PRELOAD. On Windows, it's bit more difficult but if there's an interest, I may come up with something.
With some help from fellow modders I was able to "fix" this issue by patching executable to call RDRAND CPU instruction inside rand() function. Now everyting works like it should.
Too bad game developers didnt believe me that something is wrong with randomizer and just closed my ticket in their helpdesk.
Fair enough, no one probably expected player to roll abilities million times. On the other hand, D&D games rely on dice rolls quite a bit and it's relatively important thing to make it right (hint: modulo bias, RNG period). NWN(:EE) is using rand() as well and in long term it actually has observable effect.
rand() use is discouraged for decades and using rand() without calling srand() first is even worse. Anyway, using rdrand is actually great idea and it's pretty easy to identify rand() calls in Windows binary. I wanted to create something more C++-ish but the code change would be more complex.
We can actually use WeiDU to find rand() signature and replace it with rdrand (as an optional component, perhaps)?
I've tried your solution and added some flavor. Looks good so far in BG:EE 2.6.6.0:
This is the new rand() code:
unsigned int eax;
do
{
if (!_rdrand32_step(&eax))
__debugbreak();
}
while (eax > 2147480999);
return eax;
If rdrand is not available, the game will crash. If somebody wonders, 2147481000 is divisible by all Platonic solids and 100 (which constitute all D&D dices) so there's no bias towards lower rolls when rand() is used with modulo (which is often the case).
It really bugged me. I even started to use Linux to roll my character. However your idea about RDRAND is great as it allows the code to fit inside rand() without resorting to ugly trampolines or DLL hacks.
Comments
I tried to install it on the EET SoD UI but just copying the content changes the position of the +- buttons. There are also other differences I didn't quite know how to deal with.
Thanks.
Picture:
Did you have any other UI.MENU mods installed? Particularly related to character gen?
Edit : Well I don't have access to the computer right now so can't give you a screenshot unfortunately.
For anyone doing this - be very careful with the CHARGEN_ABILITIES replacement. Replace ONLY the menu definition (not the Lua code block that precedes it) and be sure to include the new LUA code block as in the listing/zip. Effectively, you'll be inserting a new LUA block before CHARGEN_ABILITIES and overwriting the old CHARGEN_ABILITIES menu definition with a new CHARGEN_ABILITIES definition.
@Faydark - May I include this in EEUITweaks?
The easiest would probably be to allow the user to set minimum exceptional strength to 01, 51, 76, 91 or 00, and discard any rolls with a lower exceptional strength.
Alternatively, users could be allowed to set bonus values for exceptional strength ranges, something along the lines of:
51-75 (default +1)
76-90 (default +1)
91-99 (default +1)
00 (default +2)
Then when a roll has an exceptional strength of 51 or higher, it adds the bonus value for that exceptional strength to the total rolled value. Say you'd leave them to the above details, and you've saved a roll of 86 total with Strength 18/40. Then if a roll of 85 total has a Strength of 18/80, it artificially adds the bonus for 76-90 (which defaults to +1), making it count as a total of 86, and thus replaces the old stored value as the exceptional strength is higher.
The reason behind the above default values is that THAC0 increases at 18/51 and 18/00, making those steps more important than 76 and 91.
Gus
EDIT: If it's allowed I can post the UI.MENU here, but prefer to ask before since it use ressources from DnD 3.5 Rules mod and this Auto reroll mod.
I tried to do a good roll on elven ranger/archer with this autoroller and noticed that every time I keep getting same stats when I get 104 (highest I could get) roll
these are 18/54 17 17 18 17 17
I got these same numbers 3 times in a row after closing game, starting a new one and launching autoroller
Then I asked my friend to install game, autoroller and try same roll with elf/archer on another computer
Guess what - he got same 104 roll
18/54 17 17 18 17 17
Images attached
I know I am quoting a 3 year old post here, but I was thinking about the same thing. This is frankly a little gem of a script and I thought that putting this here could help out others who search for this in the future.
So, I made a ham-fisted hack to solve the above. This is based on the latest version from the EEUITweaks mod collection (and yes, it works in Icewind Dale as well). I was considering posting in that thread since it has more traffic, but it seems more relevant here. Will try to explain as clearly as possible so anyone without modding experience can follow.
Disclaimer: I take no credit whatsoever for this work, all praise is due @Faydark
1. Open your game installation folder.
2. Open the "override" subfolder.
3. Find the file "UI.menu" and open it in a text editor (notepad works fine). Make a backup if you are not feeling bold.
4. Ctrl+F and search for "auto-roller".
5. The first thing you will see is a function called GetExceptionalStrength(). Close to the bottom of this function you will find the lines: Edit this so that it says "100" instead of "0" here. This is done to not break the script in case the character cannot have exceptional strength.
6. Just below, you will find the function StoreIfBest(). The first 7 lines of this function will look like this: 7. Either edit by hand, or copy-paste, so these lines read as follows:
Save the file and run the game. The difference from the original version is that now the script will only store rolls with an exceptional strength of 91 or higher, and ignore other rolls even if the total roll is higher than the stored one. This script will roll you a total of over ninety with high exceptional strength so quickly anyway that this is by far my preferred behavior. The script will overwrite an equal roll only in the case that the exceptional strength was rolled as 100 (but then again overwrite that roll if a higher total with 91 or more exceptional strength was rolled).
Note also that this will make the auto-roller run slower, due to calling the GetExceptionalStrength() function on every single roll, instead of only when the total roll was equal to the stored one. It is not by any means slow though. I rolled up a party of 6 in IWDEE, all with totals of over 93 and 91-100 exceptional strength in a matter of a few minutes.
Can you just give the file ? I cant get how to make your settings work.
Hi, this bugged me for few days now so I dug deeper. I have confirmed that BG:EE (and BG2:EE) uses rand() function from C library. It is quite weak, poorly initialized (or rather not initialized at all) and after some time it even repeat itself. Therefore character ability combinations are somewhat predetermined and you cannot go out of this "loop". In my instance, a fighter cannot go higher than 100 points total (with strength 18/45).
Because of different implementations on Windows and Linux, you get different results. However, underlying issue is the same. I suspect that Linux is bit better but I didn't investigate that far.
The fix for this issue (including making all dice rolls better) is relatively easy on Linux. We can just replace rand() with better implementation using LD_PRELOAD. On Windows, it's bit more difficult but if there's an interest, I may come up with something.
With some help from fellow modders I was able to "fix" this issue by patching executable to call RDRAND CPU instruction inside rand() function. Now everyting works like it should.
Too bad game developers didnt believe me that something is wrong with randomizer and just closed my ticket in their helpdesk.
rand() use is discouraged for decades and using rand() without calling srand() first is even worse. Anyway, using rdrand is actually great idea and it's pretty easy to identify rand() calls in Windows binary. I wanted to create something more C++-ish but the code change would be more complex.
We can actually use WeiDU to find rand() signature and replace it with rdrand (as an optional component, perhaps)?
I've tried your solution and added some flavor. Looks good so far in BG:EE 2.6.6.0:
This is the new rand() code: If rdrand is not available, the game will crash. If somebody wonders, 2147481000 is divisible by all Platonic solids and 100 (which constitute all D&D dices) so there's no bias towards lower rolls when rand() is used with modulo (which is often the case).
Since I know myself and I would lose the changes, I've decided to go one step further and create a mod. If anybody is interested: https://github.com/drake127/randomrolls/releases.