RoyalProtector Posted July 16, 2023 Share Posted July 16, 2023 (edited) I'm trying to find, unsuccessfully, a way of fixing a mistake in a 2DA file with WeiDu. It's a bug that was introduced in recent versions of BGEE/BG2EE in CLSWPBON.2DA. I need to find a row for a particular class and change the penalty for a proficiency into another. It would be easy to just replace the file entirely or do it with a programming language that I know by treating it as a text file, but I'd rather go for a non destructive solution. Thanks Edited July 16, 2023 by RoyalProtector Quote Link to comment
argent77 Posted July 16, 2023 Share Posted July 16, 2023 WeiDU provides several commands for manipulating tables. This code example searches for the "SHADOWDANCER" line and changes the last column to another value. COPY_EXISTING ~clswpbon.2da~ ~override~ // Reads whole table into memory to speed up operation READ_2DA_ENTRIES_NOW clswpbon 1 // Actual data starts at row 3 FOR (row = 3; row < clswpbon; ++row) BEGIN // Reads class/kit label from column 0 for each row READ_2DA_ENTRY_FORMER clswpbon row 0 label // Match found? PATCH_IF (~%label%~ STR_EQ ~SHADOWDANCER~) BEGIN // Sets column 3 ("ZERO_SKILL_THAC0") to value 3 // Note: It's important to put updated values into a different variable! SET_2DA_ENTRY_LATER clswpbon_out row 3 3 // No need to continue the FOR-loop SET row = clswpbon END END // Write changes back to file SET_2DA_ENTRIES_NOW clswpbon_out 1 BUT_ONLY Quote Link to comment
RoyalProtector Posted July 16, 2023 Author Share Posted July 16, 2023 Thanks, that's really helpful. Looks like you already knew what I wanted to change Quote Link to comment
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.