Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Neverwinter Nights: Enhanced Edition has been released! Visit nwn.beamdog.com to make an order. NWN:EE FAQ is available.
Soundtracks for BG:EE, SoD, BG2:EE, IWD:EE, PST:EE are now available in the Beamdog store.
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

[MOD] - Random Character Generation for BGEE, BGEE+SOD, and BG2EE (v2.0+)

Mr2150Mr2150 Member Posts: 1,170
edited June 2016 in UI Modding
Fed up playing the same characters all the time?

This mini-mod will let you generate a completely random character from all the options available. It pre-sets your abilities score to a minimum of 85, but allocates those points for you. It even chooses your initial proficiencies, skills & spells.

It doesn't:
- allocate a portrait (for the purposes of character generation it will use zzzzzzz.bmp as your portrait which is the ? image - once in the game you can then change your portrait to whatever fits your character better)
- set your colours / voice.
- choose a name for you.

So you will need to do those bits...



Any feedback/questions/suggestions gratefully received...

(Thanks to @lefreut for helping me solve a random crash issue...!)


Screenshot:






It's really easy to install:


1) Download the attached zip file. Inside are two files:

- Put the file zzzzzzz.bmp into your portraits folder
- Put the file M_random.lua into your override folder.

2) Now open UI.menu and search for the 'CHARGEN' menu (it will be around line 12330). You will find the line 'ignoreesc', just enter this line below it:

onopen "randomCharacter = 0;"

3) Only if you are using versions 2.0 or 2.1 of the game, then do the following - at the top of the UI.menu file type the highlighted line in:





4) Then scroll down a little bit and look for the button marked IMPORT and BIOGRAPHY buttons - they look something like this (may vary a little depending on the game):



and



Right, between these two buttons, just insert the following code depending which game you are altering:

BGEE+SOD - use this code:

button { enabled "createCharScreen:GetCurrentStep() == 0" area 36 524 340 30 text "????" text style "button" pad 8 2 8 2 bam GUIBUTWS action "randChar()" } button { enabled "randomCharacter == 1 and createCharScreen:GetCurrentStep() == 15" area 36 524 340 30 text "Again?" text style "button" pad 8 2 8 2 bam GUIBUTWS action " chargen.information = nil randomCharacter = 0 for i=1,5,1 do createCharScreen:OnMainBackButtonClick() end randomCharacter = 1 randChar() " }

BGEE and BG2EE - use this code:

button { enabled "createCharScreen:GetCurrentStep() == 0" area 22 574 340 30 text "????" text style "button" pad 8 2 8 2 bam GUICHLNG action "randChar()" } button { enabled "randomCharacter == 1 and createCharScreen:GetCurrentStep() == 15" area 22 574 340 30 text "Again?" text style "button" pad 8 2 8 2 bam GUICHLNG action " chargen.information = nil randomCharacter = 0 for i=1,5,1 do createCharScreen:OnMainBackButtonClick() end randomCharacter = 1 randChar() " }

And that's it...!




Post edited by Mr2150 on
smeagolheartlroumenIllustairmf2112AedanDeesparkleavJuliusBorisovlolienChivalrousChevalierNoTraGrammarsaladLuthfordRAM021AMP1972

Comments

  • smeagolheartsmeagolheart Member Posts: 6,641
    Very cool... I'm a bit too scared personally to do this but I've known a lot of folks who really like to try new things, or step outside their comfort zone, or who don't like to reroll. This would be awesome for thos adventurous spirits.

    Mr2150JuliusBorisovGrammarsaladIllustair
  • IllustairIllustair Member Posts: 817
    Very creative idea! This might just be the cure for restartitis!

    Mr2150mf2112JuliusBorisov
  • Mr2150Mr2150 Member Posts: 1,170
    Updated code and instructions for all games...

    JuliusBorisov
  • IllustairIllustair Member Posts: 817
    Would it be possible to change the 85 minimum total points from our side? It would be like increasing the dosage for this possible cure for restartitis

    RAM021
  • Mr2150Mr2150 Member Posts: 1,170
    edited May 2016
    @Illustair


    Yeah - it's really easy to change it... but do note that the 85 is achieved via an autoroller... if you set the value too high then it could momentarily pause the game performing roll after roll, whilst it seeks that number - eg putting very high numbers could cause the game to crash if it never rolls that number (which is possible!)

    I set it at a 'minimum of 85' because for me, it's low enough to roll quickly and was just enough of a boost to a random character - who may end up with some otherwise crazy choices - without feeling unfair or like cheating.


    Anyway - to change the 85 all you need to do is:

    1) Close your game. Go to your override folder.

    2) Open the M_random.lua file, and scroll down until you get to the section marked abilities:

    -- Abilities if createCharScreen:GetCurrentStep() == 8 then createCharScreen:OnMenuButtonClick() while chargen.totalRoll < 85 do createCharScreen:OnAbilityReRollButtonClick() end Infinity_PopMenu() createCharScreen:OnDoneButtonClick() end

    2) And there you can see the 85 value... Feel free to alter that however you choose...


    I wouldn't go higher than around 95 as for me that will roll within about 5 seconds but will pause until it achieves the roll (you can tell it's paused because the music stutters/stops until it finds the value).

    If you want a version you can edit on the fly IN GAME without editing this file each time, then drop me a message and it will be quick enough to make a custom version for you, but that's treading into autoroller territory which this mod is not.

    Post edited by Mr2150 on
    JuliusBorisovIllustair
  • StefanOStefanO Member Posts: 319
    Nicely done. To be combined with the item randomizer mod for even more randomness.

    Mr2150
  • IglosnofIglosnof Member Posts: 119
    Damn, I really tried making it work and I don't know how. I followed all the steps but it seems I messed something up nevertheless. Would anyone be kind enough to just roll one character for me and post it here or send me a message? I'd love to try this but I just can't on my own :/

    Thanks!

  • Mr2150Mr2150 Member Posts: 1,170
    edited June 2016
    Hey @Iglosnof , I'm out at the moment but if you want I can take a look at what you've done.

    Send me a message with your UI.menu in a zip!

  • IglosnofIglosnof Member Posts: 119
    Well actually I didn't even have a UI.menu to begin with, I had to create one by following the instructions on https://forums.beamdog.com/discussion/48994/the-new-ui-system-how-to-use-it
    Should I have had one in the first place?

  • Mr2150Mr2150 Member Posts: 1,170
    Not unless you followed those instructions already....

    That's easy then, when I get home I will update the OP with a install of (UI.menu + this mod's changes). It will be about an hour :)

    Iglosnof
  • Mr2150Mr2150 Member Posts: 1,170
    Glad we could fix that!

    I have updated the mod instructions in the OP to include pre- 2.2 versions...

    JuliusBorisov
  • Mr2150Mr2150 Member Posts: 1,170
    No problems for this mod with 2.3 that I could see... !

  • ChivalrousChevalierChivalrousChevalier Member Posts: 16
    edited July 2016
    This will definitely make starting a new playthrough more interesting! Thanks a heap to you @Mr2150 for putting your time, invaluable skills and effort into making this for all of us!

    Mr2150
  • PokotaPokota Member Posts: 503
    edited December 2016
    Definitely loving this, thank you!

    E: Is there a way to mod this mod so that multiclass is excluded?

    Post edited by Pokota on
    RAM021
  • tortuosittortuosit Member Posts: 62
    edited December 2016
    Many thanks!

    Here's my code for Lefreut's UI (ui.menu tested for BGI SOD EE):

    [code] button
    {
    enabled "createCharScreen:GetCurrentStep() == 0"
    area 22 565 340 32
    text "Random"
    text style "button"
    pad 8 2 8 2
    bam GUICHLNG
    action "randChar()"
    }
    button
    {
    enabled "randomCharacter == 1 and createCharScreen:GetCurrentStep() == 15"
    area 22 565 340 32
    text "Again?"
    text style "button"
    pad 8 2 8 2
    bam GUICHLNG
    action "
    chargen.information = nil
    randomCharacter = 0
    for i=1,5,1 do
    createCharScreen:OnMainBackButtonClick()
    end
    randomCharacter = 1
    randChar()
    "
    }
    [/code]

  • tortuosittortuosit Member Posts: 62
    edited December 2016
    It seems, clicking on the Random button ends in a deadlock at times.
    EDIT: I think, it is because I use LeUI. I think, "createCharScreen:OnGenderSelectButtonClick(2)" may be a wrong reference, because the Gender screen has been massively changed in that UI.

    Post edited by tortuosit on
  • tortuosittortuosit Member Posts: 62
    edited December 2016
    The "Again" button does not show up in BG1EE+SOD, the check for "randomCharacter == 1" does never match, it's weird. But I have no knowledge about BG scripting, maybe it's a variable scope thing?

    EDIT: Solved. IThe semicolon? Also, I combined onOpen lines. Result:
    onOpen
    "
    randomCharacter = 0
    gender = 2
    "

    Post edited by tortuosit on
  • tortuosittortuosit Member Posts: 62
    edited December 2016
    Hey Mr2150, I found the possible cause of a deadlock. Please fix it, because otherwise clicking the "Random" button is a risk if you already created some party members...
    It happens e.g. for half-elves in the mage spell picking. The "Done" button is only available if correct spells are picked, which never seems to happen.
    If you can do nothing you could still add counters to the while() loops so it does an emergency stop there.

  • tortuosittortuosit Member Posts: 62
    edited December 2016
    Your mod chooses "85" as a minimum abilities roll. The following replacement code chooses to emulate (my) human rolling :smiley: Which means choosing the best roll and: a) Getting tired of rolling at 150 rolls b) chance (here 0-20%) of missing a good pick.

    -- Abilities if createCharScreen:GetCurrentStep() == 8 then createCharScreen:OnAbilityReRollButtonClick() createCharScreen:OnAbilityStoreButtonClick() local best = chargen.totalRoll for i = 1,150 do createCharScreen:OnAbilityReRollButtonClick() if chargen.totalRoll > best and math.random() > (0.2 * math.random()) then best = chargen.totalRoll createCharScreen:OnAbilityStoreButtonClick() end end createCharScreen:OnAbilityRecallButtonClick() createCharScreen:OnMenuButtonClick() Infinity_PopMenu() createCharScreen:OnDoneButtonClick() end

  • tortuosittortuosit Member Posts: 62
    As for the first button, I think you can safely change:
    --> enabled "createCharScreen:GetCurrentStep() == 0"
    to
    --> enabled "createCharScreen:GetCurrentStep() <15"

    Button will be available at any step and the advantage is, e.g. YOU can decide about gender and race, your mod will decide the rest. So you get as much control as you want.

  • SenSayNyuSenSayNyu Member Posts: 13
    Still random crashing for me on EET + LeUI install plus broken gender assigment. Any help, please?

  • lefreutlefreut Member Posts: 1,332
    edited August 2017
    @SenSayNyu

    Here is an updated files that should fix the incompatibility with LeUI. (As a side effect, it will now randomize the spells selection even when using other UI).

    SenSayNyuAncientCowboyNostariel
  • SenSayNyuSenSayNyu Member Posts: 13
    Working flawlessly, thank you so much!

Sign In or Register to comment.