temnix Posted May 7, 2021 Share Posted May 7, 2021 I'm patching spells that have an icon. Ones that don't are excluded. For this I'm using READ_ASCII 0x76. IF !(~%icon%~ STRING_EQUAL_CASE ~None~), then patching goes ahead. However, I have a number of spells from my old mods that are cast by NPC, monsters and special protectors, whose icons I don't get to see, but which do have a reference to an icon in that field, only that icon is non-existent. I don't even know how many of these spells there are, but they are patched now when they ought to be skipped. Is it possible to go through spells and clean out references to icons that aren't there? Quote Link to comment
Bartimaeus Posted May 7, 2021 Share Posted May 7, 2021 (edited) COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) BEGIN READ_ASCII 0x3a "spellbook_icon" SET "spellbook_exists" = 0 PATCH_IF FILE_EXISTS_IN_GAME ~%spellbook_icon%.bam~ BEGIN SET "spellbook_exists" = 1 END PATCH_IF ("%spellbook_exists%" = 0) BEGIN PATCH_PRINT "%SOURCE_FILE% issue: Non-existent spellbook icon (%spellbook_icon%.BAM)! Removing icon..." WRITE_ASCII 0x3a ~~ #8 END READ_ASCII 0x76 "abilities_icon" SET "abilities_exists" = 0 PATCH_IF FILE_EXISTS_IN_GAME ~%abilities_icon%.bam~ BEGIN SET "abilities_exists" = 1 END PATCH_IF ("%abilities_exists%" = 0) BEGIN PATCH_PRINT "%SOURCE_FILE% issue: Non-existent abilities icon (%abilities_icon%.BAM)! Removing icon..." WRITE_ASCII 0x76 ~~ #8 END END BUT_ONLY_IF_IT_CHANGES Something like this? Somewhat cannibalized from lolfixer (originally for items, I refitted it for spells). Alternatively, you could just change either of the "_exists" checks to 1 and instead do your patching after instead of trying to strip all spells of their non-existent icons...either way. Edited May 7, 2021 by Bartimaeus Quote Link to comment
temnix Posted May 8, 2021 Author Share Posted May 8, 2021 Yes, something like that. With FILE_EXISTS_IN_GAME. But this may be more trouble than it's worth. 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.