Jump to content

More immunity effects batches


CamDawg

Recommended Posts

Sleep immunity was not always suppressing the 'sleep' string or portrait icon. Fixed:

 

COPY_EXISTING ~abazring.itm~ ~override~ // ring
             ~amul17.itm~   ~override~ // greenstone amulet
             ~barl.cre~     ~override~ // barl
             ~bhaalhp1.itm~ ~override~ // <invalid strref -1>
             ~bhaalimm.itm~ ~override~ // <invalid strref -1>
             ~chalcy3.itm~  ~override~ // greenstone amulet
             ~chalslay.itm~ ~override~ // ring
             ~chevil02.cre~ ~override~ // doppleganger
             ~chevil06.cre~ ~override~ // drow warrior
             ~chevil07.cre~ ~override~ // drow priestess
             ~chgood04.cre~ ~override~ // elven warrior
             ~chgood05.cre~ ~override~ // elven warrior
             ~chgood09.cre~ ~override~ // ellesime
             ~chwraith.itm~ ~override~ // <invalid strref -1>
             ~demilich.itm~ ~override~ // ring
             ~demogorg.itm~ ~override~ // <invalid strref -1>
             ~dragring.itm~ ~override~ // ring
             ~finmel01.itm~ ~override~ // <invalid strref -1>
             ~finsol04.cre~ ~override~ // fallen solar
             ~gorfirg.itm~  ~override~ // ring
             ~gorjelfu.itm~ ~override~ // ring
             ~gorjelgr.itm~ ~override~ // ring
             ~gormisti.itm~ ~override~ // ring
             ~gormistp.cre~ ~override~ // poison mist
             ~hgber01.itm~  ~override~ // two handed sword +1
             ~icbone01.cre~ ~override~ // bone golem
             ~immchs.itm~   ~override~ // <invalid strref -1>
             ~imoenhp1.itm~ ~override~ // imoen's belt
             ~innoc.itm~    ~override~ // ring
             ~ipsion.itm~   ~override~ // greenstone amulet
             ~irongol.itm~  ~override~ // <invalid strref -1>
             ~jondem05.cre~ ~override~ // glabrezu
             ~jonhp1.itm~   ~override~ // <invalid strref -1>
             ~killsw01.itm~ ~override~ // long sword +2
             ~lich.itm~     ~override~ // ring
             ~mel01.itm~    ~override~ // imoen's belt
             ~mindva01.cre~ ~override~ // vampiric illithid
             ~mindvam.cre~  ~override~ // vampiric illithid
             ~minhp1.itm~   ~override~ // <invalid strref -1>
             ~mistpo01.cre~ ~override~ // poison mist
             ~objring.itm~  ~override~ // ring
             ~palring.itm~  ~override~ // ring
             ~plytroll.itm~ ~override~ // attack
             ~ravag03.itm~  ~override~ // <invalid strref -1>
             ~ring92.itm~   ~override~ // ring
             ~ring94.itm~   ~override~ // ring
             ~ring95.itm~   ~override~ // ring
             ~ring98.itm~   ~override~ // ring
             ~ring99.itm~   ~override~ // ring
             ~ringkora.itm~ ~override~ // ring
             ~shalt01.itm~  ~override~ // ring
             ~spcl152.spl~  ~override~ // barbarian rage
             ~spcl321.spl~  ~override~ // enrage
             ~spin117.spl~  ~override~ // berserk
             ~spin783.spl~  ~override~ // slayer change
             ~spin823.spl~  ~override~ // slayer change
             ~spin852.spl~  ~override~ // slayer change
             ~spin872.spl~  ~override~ // <invalid strref -1>
             ~spin906.spl~  ~override~ // <invalid strref -1>
             ~sppr508.spl~  ~override~ // chaotic commands
             ~stalker.itm~  ~override~ // ring
             ~surehp1.itm~  ~override~ // ring
             ~sword01.cre~  ~override~ // magical sword
             ~telslav2.itm~ ~override~ // <invalid strref -1>
             ~torgal.cre~   ~override~ // torgal
             ~trollall.itm~ ~override~ // attack
             ~trollimm.itm~ ~override~ // ring
             ~udvamp.cre~   ~override~ // vampiric illithid
             ~vampreg.itm~  ~override~ // ring
             ~vampreg1.itm~ ~override~ // ring
             ~vampreg2.itm~ ~override~ // ring
 LAUNCH_PATCH_MACRO ~add_fx_batch_prep~ // defines vars for rest of patch
 PATCH_IF (SOURCE_SIZE >= min_size) BEGIN
   SET "new_fx" = 0
   FOR (index = (0 - global_loop) ; index < abil_num ; index = index + 1) BEGIN
     PATCH_IF ("%cosmetic%" = 1) BEGIN // if cosmetic effects needed
       SET "new_fx_2" = 0
     END ELSE BEGIN // if no cosmetic effects should be added
       SET "new_fx_2" = 1
     END
     SET "new_fx_1" = 0
     SET "new_fx_3" = 0
     PATCH_IF ("%index%" < 0) BEGIN // if loop through globals needed
       SET "abil_fx_idx" = 0
     END ELSE BEGIN // otherwise normal ability
       SET "counter_offset" = ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%"))
       READ_SHORT  ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
       SET "abil_fx_idx" = ("%abil_fx_idx%" + "%new_fx%")
       WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
     END
     READ_SHORT "%counter_offset%" "counter" // fx_num on global loop, otherwise abil_fx_num
     FOR (index2 = 0 ; index2 < counter ; index2 = index2 + 1) BEGIN
       READ_SHORT ("%fx_off%"        + (0x08 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "opcode"
       READ_LONG  ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param1"
       READ_LONG  ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param2"
       READ_ASCII ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "resref"
       PATCH_IF (("%opcode%" = 101) AND ("%param2%" = 39)) BEGIN // sleep immunity
         SET "new_fx_1" = 1
         READ_ASCII ("%fx_off%" +                             (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "template" ((0x30 + (0xd8 * "%fx_type%")))
       END ELSE
       PATCH_IF (("%opcode%" = 169) AND ("%param2%" = 14)) BEGIN // prevent sleep icon
         SET "new_fx_2" = 1
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 14001)) BEGIN // disable string "sleep"
         SET "new_fx_3" = 1
       END
     END
     PATCH_IF ("%new_fx_1%" = 1) BEGIN
       PATCH_IF ("%new_fx_2%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 169          // prevent portrait icon
           WRITE_LONG   ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 14           // sleep
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
       PATCH_IF ("%new_fx_3%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 14001        // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
     END
     WRITE_SHORT "%counter_offset%" "%counter%"
   END
   LAUNCH_PATCH_MACRO ~add_fx_batch_final~ // wrapup creature offset patching
 END
 BUT_ONLY_IF_IT_CHANGES

 

Petrification immunity was not always suppressing the 'petrified' string:

 

COPY_EXISTING ~balth02.spl~  ~override~ // lunar stance!
             ~bazdra02.cre~ ~override~ // draconis
             ~chaldt01.cre~ ~override~ // <charname>
             ~chalin01.cre~ ~override~ // <charname>
             ~chalslay.cre~ ~override~ // slayer
             ~chalslay.itm~ ~override~ // ring
             ~chwraith.itm~ ~override~ // <invalid strref -1>
             ~demogorg.itm~ ~override~ // <invalid strref -1>
             ~demosum4.cre~ ~override~ // cambion
             ~devaevil.cre~ ~override~ // fallen deva
             ~devagood.cre~ ~override~ // deva
             ~devast01.cre~ ~override~ // astral deva
             ~devmon01.cre~ ~override~ // monadic deva
             ~elemhydr.cre~ ~override~ // olhydra
             ~elemimix.cre~ ~override~ // imix
             ~elemogre.cre~ ~override~ // ogremoch
             ~elemsunn.cre~ ~override~ // sunnis
             ~elemzaam.cre~ ~override~ // zaaman rul
             ~fangel01.cre~ ~override~ // einhiris
             ~finsol01.cre~ ~override~ // solar
             ~finsol04.cre~ ~override~ // fallen solar
             ~golstone.itm~ ~override~ // ring
             ~gorair01.cre~ ~override~ // lesser air elemental
             ~gorair02.cre~ ~override~ // greater air elemental
             ~gorbat1.cre~  ~override~ // ka'rashur
             ~gorcamb.cre~  ~override~ // aesgareth
             ~gorstalk.cre~ ~override~ // guardian of air
             ~hgber01.itm~  ~override~ // two handed sword +1
             ~immcloud.itm~ ~override~ // <invalid strref -1>
             ~innoc.itm~    ~override~ // ring
             ~jonhp1.itm~   ~override~ // <invalid strref -1>
             ~mdk2gun.itm~  ~override~ // big gun
             ~mdk2ring.itm~ ~override~ // big gun
             ~minhp20.itm~  ~override~ // <invalid strref -1>
             ~objring.itm~  ~override~ // ring
             ~planet01.cre~ ~override~ // planetar
             ~planevil.cre~ ~override~ // fallen planetar
             ~plangood.cre~ ~override~ // planetar
             ~planwish.cre~ ~override~ // fallen planetar
             ~potn38.itm~   ~override~ // potion of mirrored eyes
             ~ppguy01.cre~  ~override~ // <invalid strref -1>
             ~ravag03.itm~  ~override~ // <invalid strref -1>
             ~ring94.itm~   ~override~ // ring
             ~ring98.itm~   ~override~ // ring
             ~ringkora.itm~ ~override~ // ring
             ~scrl15.itm~   ~override~ // protection from petrification
             ~shalt01.itm~  ~override~ // ring
             ~solar.cre~    ~override~ // solar
             ~solar01.cre~  ~override~ // solar
             ~spcl415.spl~  ~override~ // <invalid strref -1>
             ~spcl917.spl~  ~override~ // avoid death
             ~spin853.spl~  ~override~ // otiluke's resilient sphere
             ~spwi108.spl~  ~override~ // protection from petrification
             ~spwi853.spl~  ~override~ // otiluke's resilient sphere
             ~stalker.itm~  ~override~ // ring
             ~surehp1.itm~  ~override~ // ring
             ~sw1h71.itm~   ~override~ // hindo's doom +4
             ~sword01.cre~  ~override~ // magical sword
             ~telpit1.cre~  ~override~ // pit fiend
             ~telslav2.itm~ ~override~ // <invalid strref -1>
 LAUNCH_PATCH_MACRO ~add_fx_batch_prep~ // defines vars for rest of patch
 PATCH_IF (SOURCE_SIZE >= min_size) BEGIN
   SET "new_fx" = 0
   FOR (index = (0 - global_loop) ; index < abil_num ; index = index + 1) BEGIN
     SET "new_fx_1" = 0
     SET "new_fx_2" = 0
     PATCH_IF ("%index%" < 0) BEGIN // if loop through globals needed
       SET "abil_fx_idx" = 0
     END ELSE BEGIN // otherwise normal ability
       SET "counter_offset" = ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%"))
       READ_SHORT  ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
       SET "abil_fx_idx" = ("%abil_fx_idx%" + "%new_fx%")
       WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
     END
     READ_SHORT "%counter_offset%" "counter" // fx_num on global loop, otherwise abil_fx_num
     FOR (index2 = 0 ; index2 < counter ; index2 = index2 + 1) BEGIN
       READ_SHORT ("%fx_off%"        + (0x08 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "opcode"
       READ_LONG  ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param1"
       READ_LONG  ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param2"
       READ_ASCII ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "resref"
       PATCH_IF (("%opcode%" = 101) AND ("%param2%" = 134)) BEGIN // petrification immunity
         SET "new_fx_1" = 1
         READ_ASCII ("%fx_off%" +                             (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "template" ((0x30 + (0xd8 * "%fx_type%")))
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 14665)) BEGIN // disable string "petrified"
         SET "new_fx_2" = 1
       END
     END
     PATCH_IF ("%new_fx_1%" = 1) BEGIN
       PATCH_IF ("%new_fx_2%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 14665        // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
     END
     WRITE_SHORT "%counter_offset%" "%counter%"
   END
   SET "debug" = 1
   LAUNCH_PATCH_MACRO ~add_fx_batch_final~ // wrapup creature offset patching
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment
While you're at it, I recently noticed that Clay, Stone, Sand and Juggernaut Golems are not immune to sleep and morale failure.

 

OTOH, Ice, Iron and Adamantine Golems are properly immune to sleep but not to morale failure.

What's a complete golem immunity list? Fear (inc. morale failure, etc.), sleep, backstab, and poison? These seem to be the immunities scattered about the game's golem files.

 

For immunity batches, decided to go whole hog and check all immunities in the game since I know we'll end up doing them at some point regardless.

 

Immunity to Kill Target (13) should also suppress 'Death' and 'Vorpal Hit' strings:

 

// kill target
COPY_EXISTING ~ammonk07.cre~ ~override~ // monk
             ~ammonk08.cre~ ~override~ // monk
             ~bazdra01.cre~ ~override~ // draconis
             ~bazdra02.cre~ ~override~ // draconis
             ~bhaalhp1.itm~ ~override~ // <invalid strref -1>
             ~bhaalimm.itm~ ~override~ // <invalid strref -1>
             ~chalrv01.cre~ ~override~ // the ravager
             ~chalslay.cre~ ~override~ // slayer
             ~demilich.cre~ ~override~ // demi-lich
             ~demogorg.itm~ ~override~ // <invalid strref -1>
             ~finmel01.itm~ ~override~ // <invalid strref -1>
             ~golice01.cre~ ~override~ // ice golem
             ~gorchr.itm~   ~override~ // ring
             ~gorsal.cre~   ~override~ // saladrex
             ~hgmnd2.cre~   ~override~ // shambling mound
             ~hgmound.cre~  ~override~ // shambling mound
             ~holdring.itm~ ~override~ // ring
             ~imoenhp1.itm~ ~override~ // imoen's belt
             ~invulner.itm~ ~override~ // ring
             ~jonhp1.itm~   ~override~ // <invalid strref -1>
             ~mel01.itm~    ~override~ // imoen's belt
             ~minhp1.itm~   ~override~ // <invalid strref -1>
             ~sengua04.itm~ ~override~ // <invalid strref -1>
             ~shararm.itm~  ~override~ // darkmail +3
             ~spcl917.spl~  ~override~ // avoid death
             ~sw1h71.itm~   ~override~ // hindo's doom +4
             ~tstatue.itm~  ~override~ // <invalid strref -1>
             ~yaga01.cre~   ~override~ // yaga-shura
 LAUNCH_PATCH_MACRO ~add_fx_batch_prep~ // defines vars for rest of patch
 PATCH_IF (SOURCE_SIZE >= min_size) BEGIN
   SET "new_fx" = 0
   FOR (index = (0 - global_loop) ; index < abil_num ; index = index + 1) BEGIN
     SET "new_fx_1" = 0
     SET "new_fx_2" = 0
     SET "new_fx_3" = 0
     PATCH_IF ("%index%" < 0) BEGIN // if loop through globals needed
       SET "abil_fx_idx" = 0
     END ELSE BEGIN // otherwise normal ability
       SET "counter_offset" = ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%"))
       READ_SHORT  ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
       SET "abil_fx_idx" = ("%abil_fx_idx%" + "%new_fx%")
       WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
     END
     READ_SHORT "%counter_offset%" "counter" // fx_num on global loop, otherwise abil_fx_num
     FOR (index2 = 0 ; index2 < counter ; index2 = index2 + 1) BEGIN
       READ_SHORT ("%fx_off%"        + (0x08 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "opcode"
       READ_LONG  ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param1"
       READ_LONG  ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param2"
       READ_ASCII ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "resref"
       PATCH_IF (("%opcode%" = 101) AND ("%param2%" = 13)) BEGIN // kill target immunity
         SET "new_fx_1" = 1
         READ_ASCII ("%fx_off%" +                             (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "template" ((0x30 + (0xd8 * "%fx_type%")))
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 64285)) BEGIN // disable string "vorpal hit"
         SET "new_fx_2" = 1
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 14026)) BEGIN // disable string "death"
         SET "new_fx_3" = 1
       END
     END
     PATCH_IF ("%new_fx_1%" = 1) BEGIN
       PATCH_IF ("%new_fx_2%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 64285        // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
       PATCH_IF ("%new_fx_3%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 14026        // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
     END
     WRITE_SHORT "%counter_offset%" "%counter%"
   END
   LAUNCH_PATCH_MACRO ~add_fx_batch_final~ // wrapup creature offset patching
 END
 BUT_ONLY_IF_IT_CHANGES

 

Immunity to invisibility (20) should suppress 'Invisible' string:

 

// invisibility
COPY_EXISTING ~bazpatrg.itm~ ~override~ // ring
             ~fsspir.itm~   ~override~ // ring
             ~gorchr.itm~   ~override~ // ring
             ~holdring.itm~ ~override~ // ring
             ~invulner.itm~ ~override~ // ring
             ~surehp1.itm~  ~override~ // ring
 LAUNCH_PATCH_MACRO ~add_fx_batch_prep~ // defines vars for rest of patch
 PATCH_IF (SOURCE_SIZE >= min_size) BEGIN
   SET "new_fx" = 0
   FOR (index = (0 - global_loop) ; index < abil_num ; index = index + 1) BEGIN
     SET "new_fx_1" = 0
     SET "new_fx_2" = 0
     PATCH_IF ("%index%" < 0) BEGIN // if loop through globals needed
       SET "abil_fx_idx" = 0
     END ELSE BEGIN // otherwise normal ability
       SET "counter_offset" = ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%"))
       READ_SHORT  ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
       SET "abil_fx_idx" = ("%abil_fx_idx%" + "%new_fx%")
       WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
     END
     READ_SHORT "%counter_offset%" "counter" // fx_num on global loop, otherwise abil_fx_num
     FOR (index2 = 0 ; index2 < counter ; index2 = index2 + 1) BEGIN
       READ_SHORT ("%fx_off%"        + (0x08 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "opcode"
       READ_LONG  ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param1"
       READ_LONG  ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param2"
       READ_ASCII ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "resref"
       PATCH_IF (("%opcode%" = 101) AND ("%param2%" = 20)) BEGIN // int bonus immunity
         SET "new_fx_1" = 1
         READ_ASCII ("%fx_off%" +                             (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "template" ((0x30 + (0xd8 * "%fx_type%")))
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 14773)) BEGIN // disable string "invisible"
         SET "new_fx_2" = 1
       END
     END
     PATCH_IF ("%new_fx_1%" = 1) BEGIN
       PATCH_IF ("%new_fx_2%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 14773        // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
     END
     WRITE_SHORT "%counter_offset%" "%counter%"
   END
   LAUNCH_PATCH_MACRO ~add_fx_batch_final~ // wrapup creature offset patching
 END
 BUT_ONLY_IF_IT_CHANGES

 

Immunity to Silence (38) should suppress the Silenced portrait icon and the 'Silence' and 'Silenced' strings:

 

// silence
COPY_EXISTING ~ammonk07.cre~ ~override~ // monk
             ~ammonk08.cre~ ~override~ // monk
             ~amul21.itm~   ~override~ // amulet of power
             ~amul28.itm~   ~override~ // amulet of the master harper
             ~dragring.itm~ ~override~ // ring
             ~firlch01.cre~ ~override~ // fire lich
             ~gorair01.cre~ ~override~ // lesser air elemental
             ~gorair02.cre~ ~override~ // greater air elemental
             ~gorstalk.cre~ ~override~ // guardian of air
             ~helljon.cre~  ~override~ // jon irenicus
             ~helljon2.cre~ ~override~ // jon irenicus
             ~hgber01.itm~  ~override~ // two handed sword +1
             ~hllich.cre~   ~override~ // elemental lich
             ~hlshade.cre~  ~override~ // shade lich
             ~lichel01.cre~ ~override~ // elemental lich
             ~mage20.cre~   ~override~ // mage
             ~mage20b.cre~  ~override~ // mage
             ~mage20c.cre~  ~override~ // mage
             ~minhp1.itm~   ~override~ // <invalid strref -1>
             ~ppireni2.cre~ ~override~ // jon irenicus
             ~sendai7.cre~  ~override~ // sendai
             ~sengua04.itm~ ~override~ // <invalid strref -1>
             ~sewyag04.cre~ ~override~ // yaga-shura mage
             ~spwi219.spl~  ~override~ // vocalize
             ~sujon.cre~    ~override~ // jon irenicus
             ~sujon2.cre~   ~override~ // jon irenicus
             ~suraam.cre~   ~override~ // raamilat
             ~susuneer.cre~ ~override~ // suneer
             ~sw1h50.itm~   ~override~ // shazzellim +1
             ~telqua1.cre~  ~override~ // quasit
             ~telqua2.cre~  ~override~ // quasit
             ~tstatue.itm~  ~override~ // <invalid strref -1>
             ~uddrow50.cre~ ~override~ // drow wizard
 LAUNCH_PATCH_MACRO ~add_fx_batch_prep~ // defines vars for rest of patch
 PATCH_IF (SOURCE_SIZE >= min_size) BEGIN
   SET "new_fx" = 0
   FOR (index = (0 - global_loop) ; index < abil_num ; index = index + 1) BEGIN
     SET "new_fx_1" = 0
     SET "new_fx_2" = 0
     SET "new_fx_3" = 0
     PATCH_IF ("%cosmetic%" = 1) BEGIN // if cosmetic effects needed
       SET "new_fx_4" = 0
     END ELSE BEGIN // if no cosmetic effects should be added
       SET "new_fx_4" = 1
     END
     PATCH_IF ("%index%" < 0) BEGIN // if loop through globals needed
       SET "abil_fx_idx" = 0
     END ELSE BEGIN // otherwise normal ability
       SET "counter_offset" = ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%"))
       READ_SHORT  ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
       SET "abil_fx_idx" = ("%abil_fx_idx%" + "%new_fx%")
       WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
     END
     READ_SHORT "%counter_offset%" "counter" // fx_num on global loop, otherwise abil_fx_num
     FOR (index2 = 0 ; index2 < counter ; index2 = index2 + 1) BEGIN
       READ_SHORT ("%fx_off%"        + (0x08 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "opcode"
       READ_LONG  ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param1"
       READ_LONG  ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param2"
       READ_ASCII ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "resref"
       PATCH_IF (("%opcode%" = 101) AND ("%param2%" = 38)) BEGIN // silence immunity
         SET "new_fx_1" = 1
         READ_ASCII ("%fx_off%" +                             (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "template" ((0x30 + (0xd8 * "%fx_type%")))
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 14002)) BEGIN // disable string "silence"
         SET "new_fx_2" = 1
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 14676)) BEGIN // disable string "silenced"
         SET "new_fx_3" = 1
       END ELSE
       PATCH_IF (("%opcode%" = 169) AND ("%param2%" = 34)) BEGIN // prevent silenced icon
         SET "new_fx_4" = 1
       END
     END
     PATCH_IF ("%new_fx_1%" = 1) BEGIN
       PATCH_IF ("%new_fx_2%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 14002        // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
       PATCH_IF ("%new_fx_3%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 14676        // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
       PATCH_IF ("%new_fx_4%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 169          // prevent portrait icon
           WRITE_LONG   ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 34           // silenced
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
     END
     WRITE_SHORT "%counter_offset%" "%counter%"
   END
   LAUNCH_PATCH_MACRO ~add_fx_batch_final~ // wrapup creature offset patching
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment

Stun immunity should suppress the Stun icon as well as the 'Stun' and 'Stunned' strings. Also adjusted the OBC Free Action Prevents Stun component and Free Action immunity batch as neither were accounting for the plain 'Stun' string.

 

// stun
COPY_EXISTING ~abazring.itm~ ~override~ // ring
             ~aldeth.itm~   ~override~ // ring of free action
             ~amul17.itm~   ~override~ // greenstone amulet
             ~beholder.itm~ ~override~ // ring
             ~bhaalhp1.itm~ ~override~ // <invalid strref -1>
             ~bhaalimm.itm~ ~override~ // <invalid strref -1>
             ~chalcy3.itm~  ~override~ // greenstone amulet
             ~chaldt01.cre~ ~override~ // <charname>
             ~chalin01.cre~ ~override~ // <charname>
             ~chalslay.cre~ ~override~ // slayer
             ~cuphaer.cre~  ~override~ // phaere
             ~demogorg.itm~ ~override~ // <invalid strref -1>
             ~dragring.itm~ ~override~ // ring
             ~drow05.cre~   ~override~ // drow
             ~elearb11.cre~ ~override~ // apparition
             ~elemhydr.cre~ ~override~ // olhydra
             ~elemimix.cre~ ~override~ // imix
             ~elemogre.cre~ ~override~ // ogremoch
             ~elemsunn.cre~ ~override~ // sunnis
             ~elemzaam.cre~ ~override~ // zaaman rul
             ~finmel01.itm~ ~override~ // <invalid strref -1>
             ~finsol04.cre~ ~override~ // fallen solar
             ~firlch01.cre~ ~override~ // fire lich
             ~freering.itm~ ~override~ // ring of free action
             ~gorfirg.itm~  ~override~ // ring
             ~gorjelfu.itm~ ~override~ // ring
             ~gorjelgr.itm~ ~override~ // ring
             ~gormisti.itm~ ~override~ // ring
             ~gormistp.cre~ ~override~ // poison mist
             ~helljon.cre~  ~override~ // jon irenicus
             ~helljon2.cre~ ~override~ // jon irenicus
             ~hgber01.itm~  ~override~ // two handed sword +1
             ~hllich.cre~   ~override~ // elemental lich
             ~hlshade.cre~  ~override~ // shade lich
             ~hslaywpn.itm~ ~override~ // <invalid strref -1>
             ~imoenhp1.itm~ ~override~ // imoen's belt
             ~invulner.itm~ ~override~ // ring
             ~ipsion.itm~   ~override~ // greenstone amulet
             ~jwsuper.itm~  ~override~ // ring of free action
             ~killsw01.itm~ ~override~ // long sword +2
             ~lichel01.cre~ ~override~ // elemental lich
             ~mage05.itm~   ~override~ // ring of free action
             ~mage20.cre~   ~override~ // mage
             ~mage20b.cre~  ~override~ // mage
             ~mage20c.cre~  ~override~ // mage
             ~mel01.itm~    ~override~ // imoen's belt
             ~minhp1.itm~   ~override~ // <invalid strref -1>
             ~mistpo01.cre~ ~override~ // poison mist
             ~npsw01.itm~   ~override~ // sword of arvoreen
             ~objring.itm~  ~override~ // ring
             ~palring.itm~  ~override~ // ring
             ~plytroll.itm~ ~override~ // attack
             ~ppireni2.cre~ ~override~ // jon irenicus
             ~ravag03.itm~  ~override~ // <invalid strref -1>
             ~ring95.itm~   ~override~ // ring
             ~ring99.itm~   ~override~ // ring
             ~rossring.itm~ ~override~ // ring of free action
             ~sendai7.cre~  ~override~ // sendai
             ~sengua04.itm~ ~override~ // <invalid strref -1>
             ~sewyag04.cre~ ~override~ // yaga-shura mage
             ~shalt01.itm~  ~override~ // ring
             ~shararm.itm~  ~override~ // darkmail +3
             ~slayerwp.itm~ ~override~ // <invalid strref -1>
             ~spcl152.spl~  ~override~ // barbarian rage
             ~spcl321.spl~  ~override~ // enrage
             ~spcl542a.spl~ ~override~ // <invalid strref -1>
             ~spcl920a.spl~ ~override~ // <invalid strref -1>
             ~spin783.spl~  ~override~ // slayer change
             ~spin852.spl~  ~override~ // slayer change
             ~spin872.spl~  ~override~ // <invalid strref -1>
             ~spin906.spl~  ~override~ // <invalid strref -1>
             ~sppr508.spl~  ~override~ // chaotic commands
             ~stalker.itm~  ~override~ // ring
             ~sujon.cre~    ~override~ // jon irenicus
             ~sujon2.cre~   ~override~ // jon irenicus
             ~suraam.cre~   ~override~ // raamilat
             ~surehp1.itm~  ~override~ // ring
             ~susuneer.cre~ ~override~ // suneer
             ~sw2h06.itm~   ~override~ // spider's bane
             ~sword01.cre~  ~override~ // magical sword
             ~torgal.cre~   ~override~ // torgal
             ~trollall.itm~ ~override~ // attack
             ~tstatue.itm~  ~override~ // <invalid strref -1>
             ~uddrow50.cre~ ~override~ // drow wizard
             ~udphae01.cre~ ~override~ // phaere
             ~udsilver.cre~ ~override~ // adalon
             ~udsola01.cre~ ~override~ // solaufein
 LAUNCH_PATCH_MACRO ~add_fx_batch_prep~ // defines vars for rest of patch
 PATCH_IF (SOURCE_SIZE >= min_size) BEGIN
   SET "new_fx" = 0
   FOR (index = (0 - global_loop) ; index < abil_num ; index = index + 1) BEGIN
     SET "new_fx_1" = 0
     SET "new_fx_2" = 0
     SET "new_fx_3" = 0
     PATCH_IF ("%cosmetic%" = 1) BEGIN // if cosmetic effects needed
       SET "new_fx_4" = 0
     END ELSE BEGIN // if no cosmetic effects should be added
       SET "new_fx_4" = 1
     END
     PATCH_IF ("%index%" < 0) BEGIN // if loop through globals needed
       SET "abil_fx_idx" = 0
     END ELSE BEGIN // otherwise normal ability
       SET "counter_offset" = ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%"))
       READ_SHORT  ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
       SET "abil_fx_idx" = ("%abil_fx_idx%" + "%new_fx%")
       WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
     END
     READ_SHORT "%counter_offset%" "counter" // fx_num on global loop, otherwise abil_fx_num
     FOR (index2 = 0 ; index2 < counter ; index2 = index2 + 1) BEGIN
       READ_SHORT ("%fx_off%"        + (0x08 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "opcode"
       READ_LONG  ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param1"
       READ_LONG  ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param2"
       READ_ASCII ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "resref"
       PATCH_IF (("%opcode%" = 101) AND ("%param2%" = 45)) BEGIN // immunity to stun
         SET "new_fx_1" = 1
         READ_ASCII ("%fx_off%" +                             (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "template" ((0x30 + (0xd8 * "%fx_type%")))
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 1280)) BEGIN // disable string "stunned"
         SET "new_fx_2" = 1
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 14043)) BEGIN // disable string "stun"
         SET "new_fx_3" = 1
       END ELSE
       PATCH_IF (("%opcode%" = 169) AND ("%param2%" = 55)) BEGIN // prevent stunned icon
         SET "new_fx_4" = 1
       END
     END
     PATCH_IF ("%new_fx_1%" = 1) BEGIN
       PATCH_IF ("%new_fx_2%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 1280         // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
       PATCH_IF ("%new_fx_3%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 14043        // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
       PATCH_IF ("%new_fx_4%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 169          // prevent portrait icon
           WRITE_LONG   ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 55           // stun
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
     END
     WRITE_SHORT "%counter_offset%" "%counter%"
   END
   LAUNCH_PATCH_MACRO ~add_fx_batch_final~ // wrapup creature offset patching
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment

Blindness immunity should suppress the icon and 'blind' and 'blinded' strings. Did anyone know that Jan's goggles prevent blindness?

 

// blindness
COPY_EXISTING ~sword01.cre~ ~override~
             ~npmisc1.itm~ ~override~
 LAUNCH_PATCH_MACRO ~add_fx_batch_prep~ // defines vars for rest of patch
 PATCH_IF (SOURCE_SIZE >= min_size) BEGIN
   SET "new_fx" = 0
   FOR (index = (0 - global_loop) ; index < abil_num ; index = index + 1) BEGIN
     SET "new_fx_1" = 0
     SET "new_fx_2" = 0
     SET "new_fx_3" = 0
     PATCH_IF ("%cosmetic%" = 1) BEGIN // if cosmetic effects needed
       SET "new_fx_4" = 0
     END ELSE BEGIN // if no cosmetic effects should be added
       SET "new_fx_4" = 1
     END
     PATCH_IF ("%index%" < 0) BEGIN // if loop through globals needed
       SET "abil_fx_idx" = 0
     END ELSE BEGIN // otherwise normal ability
       SET "counter_offset" = ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%"))
       READ_SHORT  ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
       SET "abil_fx_idx" = ("%abil_fx_idx%" + "%new_fx%")
       WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
     END
     READ_SHORT "%counter_offset%" "counter" // fx_num on global loop, otherwise abil_fx_num
     FOR (index2 = 0 ; index2 < counter ; index2 = index2 + 1) BEGIN
       READ_SHORT ("%fx_off%"        + (0x08 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "opcode"
       READ_LONG  ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param1"
       READ_LONG  ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param2"
       READ_ASCII ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "resref"
       PATCH_IF (("%opcode%" = 101) AND ("%param2%" = 74)) BEGIN // immunity to blindness
         SET "new_fx_1" = 1
         READ_ASCII ("%fx_off%" +                             (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "template" ((0x30 + (0xd8 * "%fx_type%")))
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 1474)) BEGIN // disable string "blind"
         SET "new_fx_2" = 1
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 14674)) BEGIN // disable string "blinded"
         SET "new_fx_3" = 1
       END ELSE
       PATCH_IF (("%opcode%" = 169) AND ("%param2%" = 8)) BEGIN // prevent blind icon
         SET "new_fx_4" = 1
       END
     END
     PATCH_IF ("%new_fx_1%" = 1) BEGIN
       PATCH_IF ("%new_fx_2%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 1474        // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
       PATCH_IF ("%new_fx_3%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 14674        // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
       PATCH_IF ("%new_fx_4%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 169          // prevent portrait icon
           WRITE_LONG   ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 8            // blind
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
     END
     WRITE_SHORT "%counter_offset%" "%counter%"
   END
   LAUNCH_PATCH_MACRO ~add_fx_batch_final~ // wrapup creature offset patching
 END
 BUT_ONLY_IF_IT_CHANGES

 

Deaf immunity should suppress the 'deaf' string and icon.

 

// deafness
COPY_EXISTING ~sword01.cre~ ~override~
 LAUNCH_PATCH_MACRO ~add_fx_batch_prep~ // defines vars for rest of patch
 PATCH_IF (SOURCE_SIZE >= min_size) BEGIN
   SET "new_fx" = 0
   FOR (index = (0 - global_loop) ; index < abil_num ; index = index + 1) BEGIN
     SET "new_fx_1" = 0
     SET "new_fx_2" = 0
     PATCH_IF ("%cosmetic%" = 1) BEGIN // if cosmetic effects needed
       SET "new_fx_3" = 0
     END ELSE BEGIN // if no cosmetic effects should be added
       SET "new_fx_3" = 1
     END
     PATCH_IF ("%index%" < 0) BEGIN // if loop through globals needed
       SET "abil_fx_idx" = 0
     END ELSE BEGIN // otherwise normal ability
       SET "counter_offset" = ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%"))
       READ_SHORT  ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
       SET "abil_fx_idx" = ("%abil_fx_idx%" + "%new_fx%")
       WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
     END
     READ_SHORT "%counter_offset%" "counter" // fx_num on global loop, otherwise abil_fx_num
     FOR (index2 = 0 ; index2 < counter ; index2 = index2 + 1) BEGIN
       READ_SHORT ("%fx_off%"        + (0x08 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "opcode"
       READ_LONG  ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param1"
       READ_LONG  ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param2"
       READ_ASCII ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "resref"
       PATCH_IF (("%opcode%" = 101) AND ("%param2%" = 80)) BEGIN // immunity to deafness
         SET "new_fx_1" = 1
         READ_ASCII ("%fx_off%" +                             (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "template" ((0x30 + (0xd8 * "%fx_type%")))
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 54318)) BEGIN // disable string "deaf"
         SET "new_fx_2" = 1
       END ELSE
       PATCH_IF (("%opcode%" = 169) AND ("%param2%" = 112)) BEGIN // prevent deaf icon
         SET "new_fx_3" = 1
       END
     END
     PATCH_IF ("%new_fx_1%" = 1) BEGIN
       PATCH_IF ("%new_fx_2%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 54318        // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
       PATCH_IF ("%new_fx_3%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 169          // prevent portrait icon
           WRITE_LONG   ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 112          // deaf
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
     END
     WRITE_SHORT "%counter_offset%" "%counter%"
   END
   SET "debug" = 1
   LAUNCH_PATCH_MACRO ~add_fx_batch_final~ // wrapup creature offset patching
 END
 BUT_ONLY_IF_IT_CHANGES

 

Some special creatures have immunity to invisibility detection. Anal retentively, they should also suppress the 'detect invisible' string.

 

// detect invisible
COPY_EXISTING ~swordi.itm~   ~override~ // <invalid strref -1>
             ~ucounter.cre~ ~override~ // <invalid strref -1>
             ~uhostile.cre~ ~override~ // <invalid strref -1>
 LAUNCH_PATCH_MACRO ~add_fx_batch_prep~ // defines vars for rest of patch
 PATCH_IF (SOURCE_SIZE >= min_size) BEGIN
   SET "new_fx" = 0
   FOR (index = (0 - global_loop) ; index < abil_num ; index = index + 1) BEGIN
     SET "new_fx_1" = 0
     SET "new_fx_2" = 0
     PATCH_IF ("%index%" < 0) BEGIN // if loop through globals needed
       SET "abil_fx_idx" = 0
     END ELSE BEGIN // otherwise normal ability
       SET "counter_offset" = ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%"))
       READ_SHORT  ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
       SET "abil_fx_idx" = ("%abil_fx_idx%" + "%new_fx%")
       WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
     END
     READ_SHORT "%counter_offset%" "counter" // fx_num on global loop, otherwise abil_fx_num
     FOR (index2 = 0 ; index2 < counter ; index2 = index2 + 1) BEGIN
       READ_SHORT ("%fx_off%"        + (0x08 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "opcode"
       READ_LONG  ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param1"
       READ_LONG  ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param2"
       READ_ASCII ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "resref"
       PATCH_IF (("%opcode%" = 101) AND ("%param2%" = 116)) BEGIN // immunity to detect invisible
         SET "new_fx_1" = 1
         READ_ASCII ("%fx_off%" +                             (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "template" ((0x30 + (0xd8 * "%fx_type%")))
       END ELSE
       PATCH_IF (("%opcode%" = 267) AND ("%param1%" = 14109)) BEGIN // disable string "dispel invisible"
         SET "new_fx_2" = 1
       END
     END
     PATCH_IF ("%new_fx_1%" = 1) BEGIN
       PATCH_IF ("%new_fx_2%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 267          // disable string
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 54318        // strref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
     END
     WRITE_SHORT "%counter_offset%" "%counter%"
   END
   LAUNCH_PATCH_MACRO ~add_fx_batch_final~ // wrapup creature offset patching
 END
 BUT_ONLY_IF_IT_CHANGES

 

Creatures immune to polymorph were a bit harder, because polymorph spells are usually coupled to a whole mess of other, general effects. In this case, immunity to polymorph meant protections against the only spells usable by the party to polymorph an enemy: Polymorph Other, Chaos Shield, and the Polymorph Other wild surge.

 

// polymorph
COPY_EXISTING ~bazdra02.cre~ ~override~ // draconis
             ~bazdra03.cre~ ~override~ // fll'yissetat
             ~bhaalhp1.itm~ ~override~ // <invalid strref -1>
             ~bhaalimm.itm~ ~override~ // <invalid strref -1>
             ~chaldt01.cre~ ~override~ // <charname>
             ~chalin01.cre~ ~override~ // <charname>
             ~chalslay.cre~ ~override~ // slayer
             ~demilich.itm~ ~override~ // ring
             ~demogorg.itm~ ~override~ // <invalid strref -1>
             ~demsuc01.cre~ ~override~ // succubus
             ~deriny01.cre~ ~override~ // erinyes
             ~finmel01.itm~ ~override~ // <invalid strref -1>
             ~finsol04.cre~ ~override~ // fallen solar
             ~gorbat1.cre~  ~override~ // ka'rashur
             ~gorbat2.cre~  ~override~ // erinyes
             ~gorcamb.cre~  ~override~ // aesgareth
             ~gormistp.cre~ ~override~ // poison mist
             ~gorsuc01.cre~ ~override~ // succubus
             ~gortan2.cre~  ~override~ // succubus
             ~imoenhp1.itm~ ~override~ // imoen's belt
             ~jonhp1.itm~   ~override~ // <invalid strref -1>
             ~lich.itm~     ~override~ // ring
             ~mel01.itm~    ~override~ // imoen's belt
             ~minhp1.itm~   ~override~ // <invalid strref -1>
             ~mistpo01.cre~ ~override~ // poison mist
             ~ravag03.itm~  ~override~ // <invalid strref -1>
             ~ringdemn.itm~ ~override~ // <invalid strref -1>
             ~sengua04.itm~ ~override~ // <invalid strref -1>
             ~spcl415.spl~  ~override~ // <invalid strref -1>
             ~spin853.spl~  ~override~ // otiluke's resilient sphere
             ~spwi853.spl~  ~override~ // otiluke's resilient sphere
             ~sword01.cre~  ~override~ // magical sword
             ~telpit1.cre~  ~override~ // pit fiend
             ~tstatue.itm~  ~override~ // <invalid strref -1>
 LAUNCH_PATCH_MACRO ~add_fx_batch_prep~ // defines vars for rest of patch
 PATCH_IF (SOURCE_SIZE >= min_size) BEGIN
   SET "new_fx" = 0
   FOR (index = (0 - global_loop) ; index < abil_num ; index = index + 1) BEGIN
     SET "new_fx_1" = 0
     SET "new_fx_2" = 0
     SET "new_fx_3" = 0
     SET "new_fx_4" = 0
     PATCH_IF ("%index%" < 0) BEGIN // if loop through globals needed
       SET "abil_fx_idx" = 0
     END ELSE BEGIN // otherwise normal ability
       SET "counter_offset" = ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%"))
       READ_SHORT  ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
       SET "abil_fx_idx" = ("%abil_fx_idx%" + "%new_fx%")
       WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
     END
     READ_SHORT "%counter_offset%" "counter" // fx_num on global loop, otherwise abil_fx_num
     FOR (index2 = 0 ; index2 < counter ; index2 = index2 + 1) BEGIN
       READ_SHORT ("%fx_off%"        + (0x08 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "opcode"
       READ_LONG  ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param1"
       READ_LONG  ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param2"
       READ_ASCII ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "resref"
       PATCH_IF (("%opcode%" = 101) AND ("%param2%" = 135)) BEGIN // immunity to polymorph
         SET "new_fx_1" = 1
         READ_ASCII ("%fx_off%" +                             (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "template" ((0x30 + (0xd8 * "%fx_type%")))
       END ELSE
       PATCH_IF (("%opcode%" = 206) AND ("%resref%" STRING_COMPARE_CASE "spwi711" = 0)) BEGIN // protection from spell, sphere of chaos
         SET "new_fx_2" = 1
       END ELSE
       PATCH_IF (("%opcode%" = 206) AND ("%resref%" STRING_COMPARE_CASE "spwi415" = 0)) BEGIN // protection from spell, polymorph other
         SET "new_fx_3" = 1
       END ELSE
       PATCH_IF (("%opcode%" = 206) AND ("%resref%" STRING_COMPARE_CASE "spwm113" = 0)) BEGIN // protection from spell, wild surge polymorph
         SET "new_fx_4" = 1
       END
     END
     PATCH_IF ("%new_fx_1%" = 1) BEGIN
       PATCH_IF ("%new_fx_2%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template7%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 206          // protection from spell
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 0xffffffff   // no string
           WRITE_ASCII  ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) ~spwi711~ #8 // resref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
       PATCH_IF ("%new_fx_3%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template7%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 206          // protection from spell
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 0xffffffff   // no string
           WRITE_ASCII  ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) ~spwi415~ #8 // resref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
       PATCH_IF ("%new_fx_4%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template7%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 206          // protection from spell
           WRITE_LONG   ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 0xffffffff   // no string
           WRITE_ASCII  ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) ~spwm113~ #8 // resref
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
     END
     WRITE_SHORT "%counter_offset%" "%counter%"
   END
   LAUNCH_PATCH_MACRO ~add_fx_batch_final~ // wrapup creature offset patching
 END
 BUT_ONLY_IF_IT_CHANGES

 

Opcodes investigated and not needing immunity batches:

 

  3 - berserking
 6 - CHR modifier
10 - constitution modifier
15 - dex modifer
19 - int modifier
43 - stone to flesh
44 - strength modification
49 - wisdom bonus
55 - slay - lichel01.itm causes dying icon, but slay immunity isn't available to party regardless
93 - fatigue
94 - intoxication
115 -know alignment
165 - pause caster
209 - pw Kill
210 - pw stun
211 - imprisonment
213 - maze
220 - pw sleep
222 - teleport field
224 - restoration
235 - wing buffet
238 - disintegrate
241 - control creature

 

Other fun notes: sleep immunity batch should also include protection from opcode 217 (power word sleep aka unconsciousness 20hp); stun immunity should also include opcode 210 (power word stun aka stun 90hp).

Link to comment
Opcodes investigated and not needing immunity batches:

 

 55 - slay - lichel01.itm causes dying icon, but slay immunity isn't available to party regardless

 

Avoid Death rogue HLA gives immunity:slay.

Death Ward priest spell gives immunity:slay.

Link to comment

Yeah, my mistake. Added for slay:

 

// slay
COPY_EXISTING ~balth02.spl~ ~override~ // lunar stance!
             ~spcl415.spl~ ~override~ // <invalid strref -1>
             ~spcl917.spl~ ~override~ // avoid death
             ~spin853.spl~ ~override~ // otiluke's resilient sphere
             ~sppr409.spl~ ~override~ // death ward
             ~spwi853.spl~ ~override~ // otiluke's resilient sphere
             ~sw1h71.itm~  ~override~ // hindo's doom +4
 LAUNCH_PATCH_MACRO ~add_fx_batch_prep~ // defines vars for rest of patch
 PATCH_IF (SOURCE_SIZE >= min_size) BEGIN
   SET "new_fx" = 0
   FOR (index = (0 - global_loop) ; index < abil_num ; index = index + 1) BEGIN
     SET "new_fx_1" = 0
     PATCH_IF ("%cosmetic%" = 1) BEGIN // if cosmetic effects needed
       SET "new_fx_2" = 0
     END ELSE BEGIN // if no cosmetic effects should be added
       SET "new_fx_2" = 1
     END
     PATCH_IF ("%index%" < 0) BEGIN // if loop through globals needed
       SET "abil_fx_idx" = 0
     END ELSE BEGIN // otherwise normal ability
       SET "counter_offset" = ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%"))
       READ_SHORT  ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
       SET "abil_fx_idx" = ("%abil_fx_idx%" + "%new_fx%")
       WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) ("%abil_fx_idx%")
     END
     READ_SHORT "%counter_offset%" "counter" // fx_num on global loop, otherwise abil_fx_num
     FOR (index2 = 0 ; index2 < counter ; index2 = index2 + 1) BEGIN
       READ_SHORT ("%fx_off%"        + (0x08 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "opcode"
       READ_LONG  ("%fx_off%" + 0x04 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param1"
       READ_LONG  ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "param2"
       READ_ASCII ("%fx_off%" + 0x14 + (0x14 * "%fx_type%") + (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "resref"
       PATCH_IF (("%opcode%" = 101) AND ("%param2%" = 55)) BEGIN // immunity to slay
         SET "new_fx_1" = 1
         READ_ASCII ("%fx_off%" +                             (("%abil_fx_idx%" + "%index2%") * (0x30 + (0xd8 * "%fx_type%")))) "template" ((0x30 + (0xd8 * "%fx_type%")))
       END ELSE
       PATCH_IF (("%opcode%" = 169) AND ("%param2%" = 51)) BEGIN // prevent dying icon
         SET "new_fx_2" = 1
       END
     END
     PATCH_IF ("%new_fx_1%" = 1) BEGIN
       PATCH_IF ("%new_fx_2%" = 0) BEGIN
         INSERT_BYTES   ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) (0x30 + (0xd8 * "%fx_type%"))
           WRITE_ASCIIE ("%fx_off%"                               + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) "%template%" // clones immunity effect
           WRITE_SHORT  ("%fx_off%"        + (0x08 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 169          // prevent portrait icon
           WRITE_LONG   ("%fx_off%" + 0x08 + (0x10 * "%fx_type%") + ("%abil_fx_idx%" * (0x30 + (0xd8 * "%fx_type%")))) 51           // deaf
         SET "new_fx" = ("%new_fx%" + 1)
         SET "counter" = ("%counter%" + 1)
       END
     END
     WRITE_SHORT "%counter_offset%" "%counter%"
   END
   LAUNCH_PATCH_MACRO ~add_fx_batch_final~ // wrapup creature offset patching
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment

Thanks for that, avenger.

 

Intoxication bonus (94) 	ITM 	SCRL08 	Protection from Poison

 

Hehe. So Prot. from Poison scroll prevents you from getting drunk? Useful :)

(Other poison immunity Stuff doesn't seem to.)

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...