// Standardize the school and secondary type of items which cast illusionary spells
COPY_EXISTING ~ring28.itm~ ~override~ // Ring of Air Control
~sw1h26.itm~ ~override~ // Ilbratha +1
READ_LONG 0x64 "abil_off"
READ_SHORT 0x68 "abil_num"
FOR (index = 0; index < "%abil_num%"; index = index + 1) BEGIN // parse each ability
READ_BYTE ("%abil_off%" + ("%index%" * 0x38)) "abil_type" // determine ability type
PATCH_IF ("%abil_type%" = 3) BEGIN // only patch the magical ability header
READ_ASCII ("%abil_off%" + 0x04 + ("%index%" * 0x38)) "icon" // use icon (BAM name)
PATCH_IF (("%icon%" STRING_EQUAL_CASE ~SPWI212B~) OR ("%icon%" STRING_EQUAL_CASE ~SPWI405B~)) BEGIN // Mirror Image or Improved Invisibility
WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "5" // school: Illusionist
WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "3" // secondary type: Illusionary Protections
END
END
END
BUT_ONLY_IF_IT_CHANGES
// Standardize the school and secondary type of items which cast abjuration spells
COPY_EXISTING ~staf11.itm~ ~override~ // Staff of the Magi
~wand18.itm~ ~override~ // Wand of Spell Striking
READ_LONG 0x64 "abil_off"
READ_SHORT 0x68 "abil_num"
FOR (index = 0; index < "%abil_num%"; index = index + 1) BEGIN // parse each ability
READ_BYTE ("%abil_off%" + ("%index%" * 0x38)) "abil_type" // determine ability type
PATCH_IF ("%abil_type%" = 3) BEGIN // only patch the magical ability header
READ_ASCII ("%abil_off%" + 0x04 + ("%index%" * 0x38)) "icon" // use icon (BAM name)
PATCH_IF ("%icon%" STRING_EQUAL_CASE ~SPWI902B~) BEGIN // Spell Trap
WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "1" // school: Abjurer
WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "1" // secondary type: Spell Protections
END
PATCH_IF (("%icon%" STRING_EQUAL_CASE ~SPWI513B~) OR ("%icon%" STRING_EQUAL_CASE ~SPWI608B~)) BEGIN // Breach or Pierce Magic
WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "1" // school: Abjurer
WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "4" // secondary type: Magic Attack
END
END
END
BUT_ONLY_IF_IT_CHANGES
// Assign the proper school and secondary type to the special ability of the Shield amulet
COPY_EXISTING ~amul15.itm~ ~override~ // Shield Amulet
READ_LONG 0x64 "abil_off"
READ_SHORT 0x68 "abil_num"
FOR (index = 0; index < "%abil_num%"; index = index + 1) BEGIN // parse each ability
READ_BYTE ("%abil_off%" + ("%index%" * 0x38)) "abil_type" // determine ability type
PATCH_IF ("%abil_type%" = 3) BEGIN // only patch the magical ability header
WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "6" // school: Invoker
WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "7" // secondary type: Combat Protections
END
END
BUT_ONLY_IF_IT_CHANGES
OTOH, this batch is more likely a candidate for a tweak mod. Heh, I might even include it in some future version of aTweaks.
// Standardize the school and secondary type of items which cast offensive spells
COPY_EXISTING ~staf13.itm~ ~override~ // Staff of Thunder and Lightning
~wand03.itm~ ~override~ // Wand of Magic Missiles
~wand05.itm~ ~override~ // Wand of Fire
~wand06.itm~ ~override~ // Wand of Frost
~wand07.itm~ ~override~ // Wand of Lightning
~wand11.itm~ ~override~ // Wand of the Heavens
~wand13.itm~ ~override~ // Wand of Cloudkill
READ_LONG 0x64 "abil_off"
READ_SHORT 0x68 "abil_num"
FOR (index = 0; index < "%abil_num%"; index = index + 1) BEGIN // parse each ability
READ_BYTE ("%abil_off%" + ("%index%" * 0x38)) "abil_type" // determine ability type
PATCH_IF ("%abil_type%" = 3) BEGIN // only patch the magical ability header
READ_ASCII ("%abil_off%" + 0x04 + ("%index%" * 0x38)) "icon" // use icon (BAM name)
PATCH_IF NOT (("%icon%" STRING_EQUAL_CASE ~SPWI103B~) OR ("%icon%" STRING_EQUAL_CASE ~SPWI104B~)) BEGIN // not Burning Hands or Charm
WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "6" // school: Invoker
WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "10" // secondary type: Offensive Damage
END
PATCH_IF ("%icon%" STRING_EQUAL_CASE ~SPWI103B~) BEGIN // Burning Hands
WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "8" // school: Transmuter
WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "10" // secondary type: Offensive Damage
END
PATCH_IF ("%icon%" STRING_EQUAL_CASE ~IWAND13~) BEGIN // Wand of Cloudkill
WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "6" // school: Invoker
WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "9" // secondary type: Battleground
END
END
END
BUT_ONLY_IF_IT_CHANGES
// Standardize the school and secondary type of items which cast alteration spells
COPY_EXISTING ~brac16.itm~ ~override~ // Bracers of Blinding Strike
~boot12.itm~ ~override~ // Gargoyle Boots
~ring29.itm~ ~override~ // Ring of Earth Control
~ring39.itm~ ~override~ // Ring of Gaxx
~staf16.itm~ ~override~ // Staff of Earth +2
~sw1h27.itm~ ~override~ // Arbane's Sword +2
~sw1h36.itm~ ~override~ // Namarra +2
READ_LONG 0x64 "abil_off"
READ_SHORT 0x68 "abil_num"
FOR (index = 0; index < "%abil_num%"; index = index + 1) BEGIN // parse each ability
READ_BYTE ("%abil_off%" + ("%index%" * 0x38)) "abil_type" // determine ability type
PATCH_IF ("%abil_type%" = 3) BEGIN // only patch the magical ability header
READ_ASCII ("%abil_off%" + 0x04 + ("%index%" * 0x38)) "icon" // use icon (BAM name)
PATCH_IF (("%icon%" STRING_EQUAL_CASE ~SPWI305B~) OR ("%icon%" STRING_EQUAL_CASE ~SPWI613B~) OR ("%icon%" STRING_EQUAL_CASE ~SPWI625B~)) BEGIN // Haste, Improved Haste or Stone to Flesh
WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "8" // school: Transmuter
WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "13" // secondary type: Non-Combat
END
PATCH_IF ("%icon%" STRING_EQUAL_CASE ~SPWI408B~) BEGIN // Stoneskin
WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "8" // school: Transmuter
WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "7" // secondary type: Combat Protections
END
PATCH_IF ("%icon%" STRING_EQUAL_CASE ~SPPR211B~) BEGIN // Silence 15' Radius
WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "8" // school: Transmuter
WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "11" // secondary type: Disabling
END
END
END
BUT_ONLY_IF_IT_CHANGES
// Standardize the school and secondary type of items which cast divination spells
COPY_EXISTING ~sw1h32.itm~ ~override~ // Dragonslayer
~sw1h34.itm~ ~override~ // Albruin +1
READ_LONG 0x64 "abil_off"
READ_SHORT 0x68 "abil_num"
FOR (index = 0; index < "%abil_num%"; index = index + 1) BEGIN // parse each ability
READ_BYTE ("%abil_off%" + ("%index%" * 0x38)) "abil_type" // determine ability type
PATCH_IF ("%abil_type%" = 3) BEGIN // only patch the magical ability header
READ_ASCII ("%abil_off%" + 0x04 + ("%index%" * 0x38)) "icon" // use icon (BAM name)
PATCH_IF ("%icon%" STRING_EQUAL_CASE ~SPWI203B~) BEGIN // Detect Invisibility
WRITE_BYTE ("%abil_off%" + 0x17 + ("%index%" * 0x38)) "3" // school: Diviner
WRITE_BYTE ("%abil_off%" + 0x19 + ("%index%" * 0x38)) "5" // secondary type: Divination Attack
END
END
END
BUT_ONLY_IF_IT_CHANGES
For reference, this code assigns schools and secondary types only to items which clearly state that they duplicate the respective spell in their description. Items which may confer similar effects through other means (i.e. the Jansen Spectroscopes Detect Invisibility ability) were deliberately left untouched. Similarly, items which cast the actual spells, rather than mimic their effects were not altered.
Edited by aVENGER_(RR), 27 February 2010 - 07:20 PM.












