Skip to content

How do I change the Kensai kit to include the magic weapon restriction?

GreenerGreener Member Posts: 430
I'm trying to recreate the PnP Kensai from Oriental Adventures 1ed, thus I'm trying to figure out a way to include a restriction on magical weapons.

This has been suggested, but unfortunately includes several non-magical weapons. Is there a way to refine or adjust this code?

COPY_EXISTING_REGEXP "^.+\.itm" override
PATCH_IF SOURCE_SIZE > 0x71 BEGIN
READ_LONG 0x64 ex_off
READ_SHORT 0x68 ex_co
PATCH_IF LONG_AT 0x60 > 0 BEGIN
FOR (i = 0; i < ex_co; i += 1) BEGIN
READ_BYTE (ex_co + i * 0x38) type
PATCH_IF type == 1 || type == 2 || type == 4 BEGIN
WRITE_BYTE 0x2f (THIS & 0b00000100)
END
END
END
END
BUT_ONLY

Comments

  • GreenerGreener Member Posts: 430
    I believe I have figured it out...

    COPY_EXISTING_REGEXP "^.+\.itm" override // copies all items
    PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // protects against invalid files
    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) // adds kensai flag
    END
    END
    BUT_ONLY_IF_IT_CHANGES
Sign In or Register to comment.