Jump to content

How to get spell with non-existent icons?


Recommended Posts

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?

Link to comment
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 by Bartimaeus
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...