Jump to content

How can I use magical item flag to patch specific (item) files?


a.greene

Recommended Posts

I'm trying to restrict a kensai's ability to use magical items weapons via the following (edited)

COPY_EXISTING_REGEXP "^.+\.itm" override					
  PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN					
    READ_LONG 0x64 ex_off
    READ_SHORT 0x68 ex_co
    READ_LONG 0x60 enchantment				
    PATCH_IF enchantment > 0 BEGIN						
      READ_BYTE  0x2f "use"
      WRITE_BYTE 0x2f ("%use%" BOR 0b00000100)					
    END
  END

Would it be possible to use the magical item flag instead of enchantment > 0? If so could someone assist me in re-writing this?

Thank you

Cheers,

a.

Edited by a.greene
Link to comment

That calls for another layer of filtering. How to detect a weapon? You can run through all of the item types that are weapons; bows, daggers, maces, and so on. You can scan for whether the item uses a proficiency; that's probably the cleanest. You can check for the presence of "melee" or "ranged" or "launcher" abilities, though that might have false positives.

For the proficiency check, you read the byte at 0x31.

READ_LONG 0x18 flags
READ_BYTE 0x31 prof
PATCH_IF (prof > 88 AND prof < 135) BEGIN // Stats 89 to 134 are the proficiencies
  PATCH_IF (flags BAND BIT6) BEGIN
    // Do stuff
  END
END

That should work.

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...