jastey Posted November 3 Posted November 3 On 2/16/2024 at 2:05 PM, jmerry said: It looks like EET does some tricky things with random treasures, separating the BG1 random treasures (that can drop level 1-3 scrolls) and the BG2 random treasures (that can drop scrolls of much higher level) into different items. The old token name goes with the BG2 table, while a new token name points to the BG1 table. And if a mod that doesn't take this into account is installed onto EET, you can end up with random treasures that are significantly more generous than intended. Would someone be so kind and explain to me where I can see which gets replaced with what, the RNDTRES.2DA either doesn't list the random treasure items used in bgqe or it's not there at all (for BGT), so I am obviously looking at the wrong place. Referring to this PR here. Quote
jmerry Posted November 3 Posted November 3 (edited) I found the EET code that edits the tables, and I don't see a clear correspondence. Spoiler ///// \\\\\ ///// RNDXXX.2DA \\\\\ ///// \\\\\ COPY_EXISTING ~RNDTRES.2DA~ ~override~ PRETTY_PRINT_2DA REPLACE_TEXTUALLY ~^RNDTRE07 ~ ~SODTRE07 ~ REPLACE_TEXTUALLY ~^RNDTRE08 ~ ~SODTRE08 ~ REPLACE_TEXTUALLY ~^RNDTRE09 ~ ~SODTRE09 ~ COPY + ~%MOD_FOLDER%/temp/array/RNDTREAS.2DA~ ~%MOD_FOLDER%/temp/array~ REPLACE_TEXTUALLY ~^GEMBLADE .+$[%newline%]*~ ~~ OUTER_SET treasMag = 0 ACTION_FOR_EACH file IN RNDMAGIC RNDTRES RNDTREAS RNDEQUIP RNDSCROL RNDWEP BEGIN COPY + ~%MOD_FOLDER%/temp/array/%file%.2DA~ ~%MOD_FOLDER%/temp/array~ PRETTY_PRINT_2DA SPRINT textToReplace ~2DA[ %TAB%]+V1.0[%newline%]+.+[%newline%]+.+[%newline%]+~ COUNT_REGEXP_INSTANCES ~%textToReplace%~ num_matches PATCH_IF (num_matches > 0) BEGIN REPLACE_TEXTUALLY ~%textToReplace%~ ~~ END ELSE BEGIN PATCH_WARN ~WARNING: could not find %textToReplace% in %SOURCE_FILESPEC%~ END REPLACE_EVALUATE CASE_INSENSITIVE ~\([A-Za-z0-9#_-]+\)~ BEGIN SPRINT match ~%MATCH1%~ SPRINT res ~itm~ LPM EET_PCU_outer_res END ~%match%~ PATCH_IF ~%file%~ STR_EQ ~RNDTRES~ BEGIN COUNT_2DA_ROWS 1 "cntrow" FOR (cnt = 0; cnt < "%cntrow%"; cnt = cnt + 1) BEGIN READ_2DA_ENTRY cnt 0 1 new_name DEFINE_ASSOCIATIVE_ARRAY rnd_items BEGIN ~%new_name%~ => ~%file%~ END PATCH_IF (FILE_CONTAINS_EVALUATED (~RNDTRES.2DA~ ~^%new_name%[ %TAB%]+~)) BEGIN REPLACE_TEXTUALLY ~^%new_name%[ %TAB%]+.+$~ ~deleteMeDummy~ PATCH_PRINT ~Skipping RNDTRES.2DA patching: already has %new_name% row~ END END REPLACE_TEXTUALLY ~deleteMeDummy~ ~~ END ELSE BEGIN INNER_ACTION BEGIN COPY_EXISTING ~%file%.2DA~ ~override~ PRETTY_PRINT_2DA COUNT_2DA_ROWS 3 cnt SET cnt = cnt - 1 BUT_ONLY END REPLACE_EVALUATE CASE_INSENSITIVE ~^\([^ ]+\)\([ ]+[^ ]+[ ]+.+\)$~ BEGIN SET cnt = cnt + 1 PATCH_IF (cnt = 10) AND (~%file%~ STR_EQ ~RNDTREAS~) BEGIN //no problem since the first row is moved to RNDMAGIC.2DA END ELSE PATCH_IF (cnt > 9) BEGIN PATCH_WARN ~WARNING: %file%.2DA with more than 9 rows~ END PATCH_IF (~%file%~ STR_EQ ~RNDTREAS~) AND (treasMag = 0) BEGIN SPRINT appendTo ~RNDMAGIC~ SET treasMag = 1 END ELSE BEGIN SPRINT appendTo ~%file%~ END INNER_ACTION BEGIN ACTION_IF ~%MATCH1%~ STR_EQ ~AVERAGE~ BEGIN OUTER_SPRINT name ~AVRG~ END ELSE ACTION_IF ~%MATCH1%~ STR_EQ ~WELL_OFF~ BEGIN OUTER_SPRINT name ~WELL~ END ELSE ACTION_IF ~%MATCH1%~ STR_EQ ~WEALTHY~ BEGIN OUTER_SPRINT name ~WEAL~ END ELSE BEGIN OUTER_SPRINT name ~%MATCH1%~ END APPEND ~%appendTo%.2DA~ ~%name%_BG1%MATCH2%~ END END ~%MATCH1%%MATCH2%~ END END COPY_EXISTING ~rndtres.2da~ ~override~ APPEND_FILE ~%MOD_FOLDER%/temp/array/rndtres.2DA~ PRETTY_PRINT_2DA BUT_ONLY ACTION_FOR_EACH file IN RNDMAGIC RNDTREAS RNDEQUIP RNDSCROL RNDWEP BEGIN COPY_EXISTING ~%file%.2DA~ ~override~ PRETTY_PRINT_2DA COUNT_2DA_ROWS 3 cntrow FOR (cnt = 1; cnt < "%cntrow%"; cnt = cnt + 1) BEGIN INNER_PATCH_SAVE new_name ~%file%~ BEGIN REPLACE_TEXTUALLY ~^\(RND...\).+$~ ~\10%cnt%~ END DEFINE_ASSOCIATIVE_ARRAY rnd_items BEGIN ~%new_name%~ => ~%file%~ END END BUT_ONLY END ACTION_PHP_EACH rnd_items AS file => source BEGIN ACTION_IF (NOT FILE_EXISTS_IN_GAME ~%file%.itm~) BEGIN COPY_EXISTING ~RNDTRE01.ITM~ ~override/%file%.itm~ END ELSE ACTION_IF (~%source%~ STR_EQ ~RNDTRES~) BEGIN WARN ~WARNING: %file%.itm already exists in game, possible conflict~ END ACTION_IF (FILE_EXISTS ~%patch_dir%/itm/%file%.itm~) BEGIN DELETE + ~%patch_dir%/itm/%file%.itm~ END END //unused code /*ACTION_FOR_EACH file IN RNDEQUIP RNDMAGIC RNDSCROL RNDTREAS RNDWEP RNDTRES BEGIN ACTION_IF (FILE_EXISTS ~%MOD_FOLDER%/temp/array/%file%.2DA~) BEGIN COPY + ~%MOD_FOLDER%/temp/array/%file%.2DA~ ~%MOD_FOLDER%/temp/array~ PRETTY_PRINT_2DA SPRINT textToReplace ~2DA[ %TAB%]+V1.0[%newline%]+.+[%newline%]+.+[%newline%]+~ COUNT_REGEXP_INSTANCES ~%textToReplace%~ num_matches PATCH_IF (num_matches > 0) BEGIN REPLACE_TEXTUALLY ~%textToReplace%~ ~~ END ELSE BEGIN PATCH_WARN ~WARNING: could not find %textToReplace% in %SOURCE_FILESPEC%~ END REPLACE_EVALUATE CASE_INSENSITIVE ~\([A-Za-z0-9#_-]+\)~ BEGIN SPRINT match ~%MATCH1%~ SPRINT res ~itm~ LPM EET_PCU_outer_res END ~%match%~ SPRINT filename "%SOURCE_RES%" COUNT_2DA_ROWS 1 "cntrow" FOR (cnt = 0; cnt < "%cntrow%"; cnt = cnt + 1) BEGIN PATCH_IF (~%filename%~ STR_EQ ~RNDEQUIP~) BEGIN SPRINT item ~DEQU~ END ELSE PATCH_IF (~%filename%~ STR_EQ ~RNDMAGIC~) BEGIN SPRINT item ~DMAG~ END ELSE PATCH_IF (~%filename%~ STR_EQ ~RNDSCROL~) BEGIN SPRINT item ~DSCR~ END ELSE PATCH_IF (~%filename%~ STR_EQ ~RNDTREAS~) BEGIN SPRINT item ~DTRE~ END ELSE PATCH_IF (~%filename%~ STR_EQ ~RNDWEP~) BEGIN SPRINT item ~DWEP~ END ELSE BEGIN //RNDTRES READ_2DA_ENTRY cnt 0 1 ~new_name~ PATCH_IF (FILE_CONTAINS_EVALUATED (~RNDTRES.2DA~ ~^%new_name%[ %TAB%]+~)) BEGIN REPLACE_TEXTUALLY ~^%new_name%[ %TAB%]+.+$~ ~deleteMeDummy~ PATCH_PRINT ~Skipping RNDTRES.2DA patching: already has %new_name% row~ END END PATCH_IF (NOT ~%filename%~ STR_EQ ~RNDTRES~) BEGIN SET value = cnt + 1 PATCH_IF (value < 10) BEGIN SPRINT value ~0%value%~ END READ_2DA_ENTRY cnt 0 1 ~old_name~ SET_2DA_ENTRY cnt 0 1 ~BG%item%%value%~ DEFINE_ASSOCIATIVE_ARRAY remapped_itm BEGIN ~RN%item%%value%~ => ~BG%item%%value%~ END SPRINT log_remapped_itm ~%log_remapped_itm%%TAB%RN%item%%value%%TAB%=>%TAB%BG%item%%value%%TAB%%slash%%slash%%old_name%%LNL%~ READ_2DA_ENTRY cnt 0 1 ~new_name~ END INNER_ACTION BEGIN ACTION_IF (NOT FILE_EXISTS_IN_GAME ~%new_name%.itm~) BEGIN COPY_EXISTING ~RNDTRE01.ITM~ ~override/%new_name%.itm~ END ELSE BEGIN WARN ~WARNING: %new_name%.itm already exists in game, possible conflict~ END ACTION_IF (FILE_EXISTS ~%patch_dir%/itm/%new_name%.itm~) BEGIN DELETE + ~%patch_dir%/itm/%new_name%.itm~ END END END REPLACE_TEXTUALLY ~deleteMeDummy~ ~~ COPY_EXISTING ~rndtres.2da~ ~override~ APPEND_FILE ~%MOD_FOLDER%/temp/array/%file%.2DA~ PRETTY_PRINT_2DA BUT_ONLY END END*/ Not easy to tell what the new treasure names are. There really should be cpmvars entries for the BG1 random treasures, but there aren't. For the main RNDTRE## entries, I think it's (BGEE) RNDTRE02 -> (EET) RNDTRE06, (BGEE) RNDTRE03 -> (EET) RNDTRE07, (BGEE) RNDTRE04 -> (EET) RNDTRE08, (BGEE) RNDTRE05 -> (EET) RNDTRE09. At least, that's what SCS thinks they are. Edited November 3 by jmerry Quote
jastey Posted November 3 Author Posted November 3 This is from EET? Thanks for looking this up. 5 minutes ago, jmerry said: For the main RNDTRE## entries, I think it's (BGEE) RNDTRE02 -> (EET) RNDTRE06, (BGEE) RNDTRE03 -> (EET) RNDTRE07, (BGEE) RNDTRE04 -> (EET) RNDTRE08, (BGEE) RNDTRE05 -> (EET) RNDTRE09. At least, that's what SCS thinks they are. I could just trust smarter people than me and call it a day. (very tempted) But I want to understand. My EET RNDTRES.2DA looks like this: 2DA V1.0 * 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 SODTRE07 BDRING07 BDRING09 BDRING12 BDAMUL25 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * SODTRE08 POTN02 POTN03 POTN08 POTN09 POTN10 POTN11 POTN12 POTN17 POTN18 POTN19 POTN20 POTN22 POTN24 POTN26 POTN27 POTN28 POTN29 POTN30 POTN31 POTN36 POTN37 POTN38 POTN39 POTN42 POTN43 POTN43 POTN44 POTN45 POTN46 POTN52 * * * * * * * * * * SODTRE09 MISC16 MISC17 MISC18 MISC19 MISC20 MISC21 MISC22 MISC23 MISC24 MISC25 MISC26 MISC27 MISC28 MISC29 MISC30 MISC31 MISC32 MISC33 MISC34 MISC35 MISC36 MISC37 MISC38 MISC39 MISC40 MISC41 MISC42 MISC43 MISC44 MISC45 * * * * * * * * * * RNDWAND WAND03 WAND05 WAND06 WAND07 WAND08 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDSCRL RNDSCR01 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDTRI01 RING10 RING11 RING14 AMUL05 AMUL06 AMUL07 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDTRI02 RING13 RING15 RING12 RING16 AMUL08 AMUL10 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDTRI03 RING17 RING18 RING19 AMUL11 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDGEM01 MISC16 MISC17 MISC18 MISC19 MISC21 MISC22 MISC23 MISC24 MISC25 MISC26 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDGEM02 MISC20 MISC27 MISC28 MISC29 MISC30 MISC31 MISC32 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDGEM03 MISC33 MISC34 MISC35 MISC36 MISC37 MISC38 MISC39 MISC40 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDGEM04 MISC41 MISC42 MISC43 MISC6Z * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDGEM05 MISC44 MISC45 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDARO01 AROW01 AROW02 AROW08 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDARO02 AROW09 AROW10 AROW02 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDARO03 AROW05 AROW11 AROW04 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDPTN01 POTN02 POTN08 POTN19 POTN20 POTN28 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDPTN02 POTN52 POTN17 POTN42 POTN24 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDPTN03 POTN14 POTN11 POTN12 POTN21 POTN45 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * RNDOMAGE SW1H20 SW1H43 SW1H46 SW1H48 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * No RNDTRE08, no RNDTRE04. In BGT, it's not even present. What am I missing? Quote
jmerry Posted November 3 Posted November 3 That's not the only table. The RNDTRE## entries are in RNDTREAS.2DA. Non-SoD BGEE and BG2EE each have five rows, labeled in the 2DA with words from "POOR" to "RICH" - but the actual tokens are numbered, because that table is partly hardcoded. SoD adds two more rows, labeled as GEMBLADE; these get moved to some of the SODTRE rows of RNDTRES.2DA in EET. BGEE's RNDTRE01 is basically unused - no appearances at all in the main BG1 campaign, only a few in SoD. The other four random treasures in that table are the trouble spot. Quote
Graion Dilach Posted November 3 Posted November 3 (edited) 45 minutes ago, jmerry said: I found the EET code that edits the tables, and I don't see a clear correspondence. Not easy to tell what the new treasure names are. There really should be cpmvars entries for the BG1 random treasures, but there aren't. TBH, people do overlook this one. I mean, BGT also carries this difference. See RNDTREAS.2DA from BGT 1.21 (yes, I know it's outdated, but that's what I found here suddenly) 2DA V1.0 * 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 POOR MISC19 004 SCRL75 001 001 001 001 001 001 001 001 001 001 001 002 002 003 003 MISC16 AVERAGE RNDMAG01 MISC23 AMUL05 MISC17 015 012 SCRL75 008 006 003 001 001 007 009 RNDSCR01 MISC18 MISC22 AMUL06 RNDMAG01 WELL_OFF RNDMAG01 RNDMAG01 AMUL08 MISC20 034 AMUL09 RNDSCR01 008 009 RING11 023 RNDSCR01 RING14 MISC26 MISC25 057 MISC27 MISC28 RNDMAG01 WEALTHY RNDMAG02 RNDMAG01 MISC37 MISC35 RING16 AMUL07 RNDSCR02 047 038 029 AMUL09 RING10 RING15 RNDSCR02 RING13 RING17 MISC34 RNDMAG01 RNDMAG02 RICH RNDMAG02 RNDMAG02 RNDMAG01 RNDMAG01 AMUL12 AMUL13 AMUL10 MISC29 MISC21 073 MISC24 RNDSCR03 MISC34 MISC38 RNDSCR03 RNDMAG01 RNDMAG01 RNDMAG02 RNDMAG02 AVRG_BG1 rndmag03 MISC23 AMUL05 MISC17 015 012 010 008 006 003 * 001 007 009 rndscr04 MISC18 MISC22 AMUL06 RING12 WELL_BG1 rndmag03 MISC31 AMUL08 MISC20 034 AMUL09 rndscr04 008 009 RING11 023 rndscr04 RING14 MISC26 MISC25 057 MISC27 MISC28 AMUL04 WEAL_BG1 rndmag03 RING18 MISC37 MISC35 RING16 AMUL07 rndscr05 047 038 029 AMUL09 RING10 RING15 rndscr05 RING13 RING17 MISC34 MISC36 rndmag04 RICH_BG1 rndmag04 rndmag03 MISC43 AMUL11 AMUL12 AMUL13 AMUL10 MISC29 MISC21 073 MISC24 rndscr06 MISC34 MISC38 rndscr06 MISC40 MISC42 rndmag03 rndmag04 and from EET 2DA V1.0 * 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 POOR MISC19 004 SCRL75 001 001 001 001 001 001 001 001 001 001 001 002 002 003 003 MISC16 AVERAGE RNDMAG01 MISC23 AMUL05 MISC17 015 012 SCRL75 008 006 003 001 001 007 009 RNDSCR01 MISC18 MISC22 AMUL06 RNDMAG01 WELL_OFF RNDMAG01 RNDMAG01 AMUL08 MISC20 034 AMUL09 RNDSCR01 008 009 RING11 023 RNDSCR01 RING14 MISC26 MISC25 057 MISC27 MISC28 RNDMAG01 WEALTHY RNDMAG02 RNDMAG01 MISC37 MISC35 RING16 AMUL07 RNDSCR02 047 038 029 AMUL09 RING10 RING15 RNDSCR02 RING13 RING17 MISC34 RNDMAG01 RNDMAG02 RICH RNDMAG02 RNDMAG02 RNDMAG01 RNDMAG01 AMUL12 AMUL13 AMUL10 MISC29 MISC21 073 MISC24 RNDSCR03 MISC34 MISC38 RNDSCR03 RNDMAG01 RNDMAG01 RNDMAG02 RNDMAG02 AVRG_BG1 RNDMAG03 MISC23 AMUL05 MISC17 015 012 010 008 006 003 001 001 007 009 RNDSCR04 MISC18 MISC22 AMUL06 RING12 WELL_BG1 RNDMAG03 MISC31 AMUL08 MISC20 034 AMUL09 RNDSCR04 008 009 RING11 023 RNDSCR04 RING14 MISC26 MISC25 057 MISC27 MISC28 AMUL04 WEAL_BG1 RNDMAG03 RING18 MISC37 MISC35 RING16 AMUL07 RNDSCR05 047 038 029 AMUL09 RING10 RING15 RNDSCR05 RING13 RING17 MISC34 MISC36 RNDMAG04 RICH_BG1 RNDMAG04 RNDMAG03 MISC43 AMUL11 AMUL12 AMUL13 AMUL10 MISC29 MISC21 073 MISC24 RNDSCR06 MISC34 MISC38 RNDSCR06 MISC40 MISC42 RNDMAG03 RNDMAG04 TLDR: EET duplicates BGT's behaviour here to decrease the amount of behavioural difference between the two games. Personally, I think SoD shouldn't have used the RNDTRE filenames for it's own random items if they ended up added to RNDTRES.2DA instead, and EET renaming them outside RNDTREAS's range is what the game should have went with in the first place, since that means modders can freely use the RNDTREAS tables as they fit in all games, considering that even after these lines, there's still ~25 options (after the padding has been inserted between 9 and A as per https://forums.beamdog.com/discussion/comment/792223/#Comment_792223). Edited November 3 by Graion Dilach Quote
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.