Hi all,
I installed an immensely modded EET playthrough, but accidentally applied an option from cdtweaks I didn't mean to, and was hopeing to roll it back without doing my whole 4 hour installation process all over again. I spent some time reading the weidu documentation, and took the existing code and modified it.
I applied a level requirement to all scrolls, so this snippet of code should go back through all scroll items and set their level requirement to one.
However, when I run the script using weidu, it gives me a parse error. Any suggestions?
*Edit* Resolved! thank you everyone for the assistance!
BEGIN ~Fixthisthing~
COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~
READ_SHORT 0x1c type
READ_SHORT 0x24 level
PATCH_IF (type = 11) BEGIN // Mycomment: Patches all scroll items, including those with existing levels
READ_LONG 0x64 abil_off ELSE 0
READ_SHORT 0x68 abil_num ELSE 0
READ_LONG 0x6a fx_off ELSE 0
FOR (index = 0 ; index < abil_num ; ++index) BEGIN
READ_SHORT (abil_off + 0x1e + (0x38 * index)) abil_fx_num
READ_SHORT (abil_off + 0x20 + (0x38 * index)) abil_fx_idx
FOR (index2 = 0 ; index2 < abil_fx_num ; ++index2) BEGIN
READ_SHORT (fx_off + (0x30 * (abil_fx_idx + index2))) opcode
PATCH_IF ((opcode = 146) OR (opcode = 148)) BEGIN // cast spell
READ_ASCII (fx_off + 0x14 + (0x30 * (abil_fx_idx + index2))) spell
PATCH_IF (("%spell%" STRING_COMPARE_REGEXP ~^[Ss][Pp][Ww][Ii][3-9][0-9][0-9]$~ = 0) OR
("%spell%" STRING_COMPARE_REGEXP ~^[Ss][Pp][Pp][Rr][3-7][0-9][0-9]$~ = 0)) BEGIN // levels 1&2 usable by level 0/1, so no need for level requirements: Left alone
PATCH_IF ("%spell%" STRING_COMPARE_REGEXP ~^[Ss][Pp][Ww][Ii][3-9][0-9][0-9]$~ = 0) BEGIN SET level_break = 11 END ELSE BEGIN SET level_break = 13 END // account for extra level for priest 6>7 and wizard 5>6: Left Alone
READ_BYTE (fx_off + 0x18 + (0x30 * (abil_fx_idx + index2))) level
SET level = 1 // Setting level to one, to fix the problem
PATCH_IF level < level_break BEGIN
SET level = 1 // Setting level to one here as well, didn't want to mess up the loops
END
END
END
END
END
WRITE_SHORT 0x24 level // still 0 if no match found, otherwise new value
END
BUT_ONLY