Create Scroll code
Closed this issue · 0 comments
Grammarsalad commented
COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~ //copies all itm files
PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
READ_BYTE 0x001C type //Item type
PATCH_IF (type = 0x000b) BEGIN //if scroll type
//check if casts spell from scroll list. If so, place in 'no' category
//add these scrolls for placement
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 = index + 1) BEGIN
READ_BYTE ("%abil_off%" + (0x38 * "%index%")) "type"
PATCH_IF ("%type%" = 3) BEGIN // magical
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 = index2 + 1) 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%"))) "resource"
//PATCH_PRINT "%resource%"
INNER_PATCH_SAVE da_spl ~%resource%~ BEGIN END
INNER_PATCH_SAVE da_scr ~%SOURCE_RES%~ BEGIN END
INNER_ACTION BEGIN
ACTION_IF (FILE_EXISTS_IN_GAME ~%da_spl%.spl~) BEGIN
COPY_EXISTING ~%da_spl%.spl~ ~override~ //copies spl file
PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
READ_BYTE 0x001C type //Spell type
PATCH_IF type = 2 BEGIN //priest spells only
//CONTINUE Priest SPells
END//Priest spells
PATCH_IF type = 1 BEGIN //wizard spells (I think)
//CONTINUE wiz SPells
END//Wiz spells
END //source size
BUT_ONLY
END//if spl is in game
END//inner Action
END//opcode 146/148
END//for loop
END //magical type
END//For loop
END//scroll type
END//source size
BUT_ONLY