a.greene Posted February 25, 2023 Share Posted February 25, 2023 (edited) 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 May 6, 2023 by a.greene Quote Link to comment
jmerry Posted February 25, 2023 Share Posted February 25, 2023 Of course it would - and there are plenty of magical items with enchantment level 0. Including some weapons. The relevant flag group is at 0x18, and "magical" is bit #6. READ_LONG 0x18 flags PATCH_IF (flags BAND BIT6) BEGIN // Do stuff END Basically that. Quote Link to comment
a.greene Posted February 25, 2023 Author Share Posted February 25, 2023 @jmerry Thank you, I appreciate your reply Quote Link to comment
a.greene Posted May 6, 2023 Author Share Posted May 6, 2023 @jmerry It appears I did not accurately describe what I wanted to do... Is it possible to only add the kensai flag to magical weapons, and not to all magical items? Quote Link to comment
jmerry Posted May 6, 2023 Share Posted May 6, 2023 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. 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.