Miloch Posted November 22, 2010 Share Posted November 22, 2010 I've replicated a bug several times now editing CREs with DLTCEP. Fortunately it only surfaces with spellcasters, but it's pretty nasty. When adding multiple spells, the memorization spell index gets botched, apparently in some random manner. So for example, I've added a 1st level priest spell, which starts at 0, as it should, being the first spell info table. The next one should start at 1, since I added only 1 spell, but it starts at 4. If I go down the list (in NI, since DLTCEP isn't useful for this since it doesn't display the indices), several start at 4, some start at 2, some 1, then 4 again, etc. They should proceed in order. Now DLTCEP and apparently the game will read these files without complaining, but if you try to do something like ADD_MEMORIZED_SPELL with WeiDU (which I'm sure expects the indices to be in order) it'll hose the spells something bad, like push them all into the 3rd level priest slot - wizard spells and all. I have CREs that show this bug from before and after I've fixed it (with NI) and could probably explain how to replicate it. Basically take any CRE in the game, add a few spells, save it, repeat if you don't see the bug the first time. Link to comment
Miloch Posted November 23, 2010 Author Share Posted November 23, 2010 Here's what I'm talking about... The 2nd priest spell table I've got selected should start at 1 not 4, because I added 1 spell to the 1st level priest table. And it should stay at 1 until the 2nd wizard spell table (info 9) because I added 2 spells to the previous table (info 8) which would bring it to 3, and only after that should it be 4 for the remaining tables. But instead, they're all over the place. Link to comment
Avenger Posted November 23, 2010 Share Posted November 23, 2010 Ok, just to get this straight, the format is fine, the IE, NI, GemRB, DLTCEP, etc can use the file without fuss. Just WeiDU is a whiny pussy Or rather, your weidu script is I will try to fix the order, but i don't promise anything soon. Link to comment
Miloch Posted November 23, 2010 Author Share Posted November 23, 2010 Ok, just to get this straight, the format is fine, the IE, NI, GemRB, DLTCEP, etc can use the file without fuss. Just WeiDU is a whiny pussy Or rather, your weidu script is Hey, it's not *my* WeiDU script . And actually, only a few lines of WeiDU code can fix it (or prevent problems from occuring with later spell patches anyway). DEFINE_PATCH_MACRO t-enforce_spell_order smx = 0 READ_LONG 0x2a8 smf //Spell memo tables offset READ_LONG 0x2ac smc //Spell memo tables count FOR (i = 0; i < smc; i += 1) BEGIN WRITE_LONG (i * 0x10 + smf + 8) smx //Spell memo array index READ_LONG (i * 0x10 + smf + 0xc) smn //Memorized spells count smx += smn END END Probably doesn't take much more code in C++ or whatever DLTCEP is using. You're already fixing "nonstandard orders" so why not this too? Link to comment
Avenger Posted November 23, 2010 Share Posted November 23, 2010 Yes, I will add the reordering code. It is just not trivial. I could fix the problem with 1-2 line changes, but it would work only correctly ordered creatures (that's why i used the method that causes seemingly random order). So, i need to do a reordering, i don't know how many lines. Plus keeping the order while inserting spells. This is something for the weekend Link to comment
Miloch Posted November 24, 2010 Author Share Posted November 24, 2010 Cool. Don't suppose you could fix the "Default rogue" and "Default wizard" saving throw buttons while you're at it? Right now they just give zeros, though the other two (warrior and priest) seem to work. Link to comment
Avenger Posted November 25, 2010 Share Posted November 25, 2010 Fixed both. But i didn't add any reordering, so already messed up spellbooks will need reordering. I just made efforts to keep existing order. Maybe later I will add the ordering code too, as you already mentioned, I reorder lots of things already. Link to comment
Miloch Posted November 26, 2010 Author Share Posted November 26, 2010 Cheers. I came up with some revised WeiDU reordering code here but I don't know if it could be adapted to DLTCEP. With WeiDU I had to resort to a lot of hackery to sort the spell indices; maybe there's a better array sorting function in C++. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.