Works now! Thanks, Dawg!
/////////////////////////////////////////////////////////
// Fixes do to the results of CamDawg's Inventory Checker
COPY_EXISTING AASIM.CRE OVERRIDE // Aasim (AR0615, Iron Throne Building)
READ_LONG 0x2bc "itm_off" ELSE 0
READ_LONG 0x2c0 "itm_num" ELSE 0
FOR (index = 0 ; index < itm_num ; index = index + 1) BEGIN // searches through items
READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item"
PATCH_IF ("%item%" STRING_COMPARE_CASE "SHIELD04" = 0) BEGIN // find invalid resref
WRITE_ASCII ("%itm_off%" + (0x14 * "%index%")) "SHLD04" #8 // corrected resref
SET "index" = "%itm_num%" // kills loop
END
END
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING RINNIE.CRE OVERRIDE // Rinnie: LEAT01 (Leather Armor)
ZHURLO.CRE OVERRIDE // Zhurlong: LEAT01 (Leather Armor)
READ_LONG 0x2b8 "slot_off" ELSE 0
READ_LONG 0x2bc "itm_off" ELSE 0
READ_LONG 0x2c0 "itm_num" ELSE 0
FOR (index = 0 ; index < itm_num ; index = index + 1) BEGIN
READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item"
PATCH_IF ("%item%" STRING_COMPARE_CASE "LEAT01" = 0)
BEGIN
FOR (index2 = 0 ; index2 < 36 ; index2 = index2 + 1) BEGIN // search through slots and add reference to first null slot
READ_SHORT ("%slot_off%" + ("%index2%" + 0x02)) "ref"
PATCH_IF ("%ref%" = 0x01) BEGIN // if incorrect reference in armor
WRITE_SHORT ("%slot_off%" + ("%index2%" + 0x02)) "%index%" // adds reference to item
SET "index2" = 36 // kills loop
END
PATCH_IF ("%index2%" = 0) BEGIN // if end of armor slots, skip ahead to inventory
SET "index2" = 20 // otherwise go to inventory slots
END
END
END
END
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING ANDRIS.CRE OVERRIDE // Andris: CLCK12 (Knave's Robe)
MARCEL.CRE OVERRIDE // Marcellus: CLCK13 (Traveller's Robe)
SHANDAL2.CRE OVERRIDE // Shandalar: CLCK16 (Cloak of the Neutral Archmagi)
READ_LONG 0x2b8 "slot_off" ELSE 0
READ_LONG 0x2bc "itm_off" ELSE 0
READ_LONG 0x2c0 "itm_num" ELSE 0
FOR (index = 0 ; index < itm_num ; index = index + 1) BEGIN
READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item"
PATCH_IF ("%item%" STRING_COMPARE_CASE "clck12" = 0) OR
("%item%" STRING_COMPARE_CASE "clck13" = 0) OR
("%item%" STRING_COMPARE_CASE "clck16" = 0)
BEGIN
WRITE_SHORT ("%slot_off%" + 0x02) "%index%" // puts in armor slot
WRITE_SHORT ("%slot_off%" + 0x22) 0xffff // removes entry from cloak slot
END
END
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING DEZKIE.CRE OVERRIDE // Dezkiel: CLCK22 (Shandalar's Cloak)
BHEREN.CRE OVERRIDE // Bheren: CLCK01 (Cloak of Protection +1)
READ_LONG 0x2b8 "slot_off" ELSE 0
READ_LONG 0x2bc "itm_off" ELSE 0
READ_LONG 0x2c0 "itm_num" ELSE 0
FOR (index = 0 ; index < itm_num ; index = index + 1) BEGIN
READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item"
PATCH_IF ("%item%" STRING_COMPARE_CASE "clck22" = 0) OR
("%item%" STRING_COMPARE_CASE "clck01" = 0)
BEGIN
WRITE_SHORT ("%slot_off%" + 0x22) "%index%" // puts in cloak slot
WRITE_SHORT ("%slot_off%" + 0x24) 0xffff // removes entry from quick item 1 slot
END
END
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING DRATAN.CRE OVERRIDE // Dra'tan: AROW01 (Arrows)
READ_LONG 0x2b8 "slot_off" ELSE 0
READ_LONG 0x2bc "itm_off" ELSE 0
READ_LONG 0x2c0 "itm_num" ELSE 0
FOR (index = 0 ; index < itm_num ; index = index + 1) BEGIN
READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item"
PATCH_IF ("%item%" STRING_COMPARE_CASE "arow01" = 0) BEGIN
FOR (index2 = 13 ; index2 < 36 ; index2 = index2 + 1) BEGIN // search through quiver slots and add reference to first null slot
READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref"
PATCH_IF ("%ref%" = 0xffff) BEGIN // first null reference in quivers
WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "%index%" // adds reference to item
SET "index2" = 36 // kills loop
END
PATCH_IF ("%index2%" = 16) BEGIN // if end of quiver slots, skip ahead to inventory
SET "index2" = 20
END
END
END
END
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING NADARI.CRE OVERRIDE // Nadarin: BOOT02 (Boots of Stealth)
READ_LONG 0x2b8 "slot_off" ELSE 0
READ_LONG 0x2bc "itm_off" ELSE 0
READ_LONG 0x2c0 "itm_num" ELSE 0
FOR (index = 0 ; index < itm_num ; index = index + 1) BEGIN
READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item"
PATCH_IF ("%item%" STRING_COMPARE_CASE "boot02" = 0)
BEGIN
WRITE_SHORT ("%slot_off%" + 0x10) "%index%" // puts in boots slot
WRITE_SHORT ("%slot_off%" + 0x24) 0xffff // removes entry from quick item 2 slot
END
END
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING ALDETH.CRE OVERRIDE // Aldeth Sashenstar: MAGE04 (blur ring)
READ_LONG 0x2b8 "slot_off" ELSE 0
READ_LONG 0x2bc "itm_off" ELSE 0
READ_LONG 0x2c0 "itm_num" ELSE 0
FOR (index = 0 ; index < itm_num ; index = index + 1) BEGIN
READ_ASCII ("%itm_off%" + (0x14 * "%index%")) "item"
PATCH_IF ("%item%" STRING_COMPARE_CASE "mage04" = 0) BEGIN
FOR (index2 = 4 ; index2 < 36 ; index2 = index2 + 1) BEGIN // search through ring slots and add reference to first null slot
READ_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "ref"
PATCH_IF ("%ref%" = 0xffff) BEGIN // first null reference in rings
WRITE_SHORT ("%slot_off%" + ("%index2%" * 0x02)) "%index%" // adds reference to item
WRITE_SHORT ("%slot_off%" + 0x2a) 0xffff // removes entry from inventory 1 slot
SET "index2" = 36 // kills loop
END
END
END
END
BUT_ONLY_IF_IT_CHANGES