Jump to content

Grammarsalad

Modders
  • Posts

    664
  • Joined

  • Last visited

Posts posted by Grammarsalad

  1.  

     

    That's why kreso suggested to get rid of the spell altogether, and I suggested replacing it with a watered-down Simulacrum. With a Simulacrum you don't have this concern of "is my PC frozen in place, am I being damaged, is there anything I can do about it?"

    Simluacrum is bugged in beta 14 (haven't tested beta 15 yet), so unless its script got fixed, this would replace one problematic clone with another.

     

    I posted a fix for the Simulacrum bug, it's somewhere on the Beamdog forums. I imagine you could google subtledoctor and simulacrum and fix, and you would probably find it.

     

    And my version of Simulacrum (4 different variants, in the Tome & Blood mod) does not suffer from that bug.

    It looks like this can be found here:

     

    https://forums.beamdog.com/discussion/63139/anyone-has-a-fix-for-disappearing-simulacrums-similar-abilities

  2. Are the beta's available now? We just got a bug report where the user said that they were using IWDEE version 2.5.1(?)

     

    "Oh, this probably matters as well, my IWDEE version is 2.5.1 (so the shaman is playable)."

     

    https://forums.beamdog.com/discussion/43174/faiths-and-powers-gods-of-the-realms-kitpack-and-divine-caster-spell-tweaks/p80

     

    5th post from the top

  3.  

    Oh, this is great! Any chance for a 'shawdowed' option (i.e. like shades or shadow monsters in iwdee)?

    Eh, didn't expect such a response to a relatively simple function. Is nobody interested in my erase-journal-o-matic for BGT? :-)

     

    And yeah, writing variants should not be too hard, if I'd know what makes a monster a shade or shadow. Here's a variant that makes the monster illusionary.

     

     

     

    DEFINE_PATCH_FUNCTION make_illusion
      INT_VAR   power_level   = 1
    BEGIN
      WRITE_LONG 0x0010 THIS | BIT1      // No corpse
      WRITE_LONG 0x0014 0                // XP
      WRITE_LONG 0x0018 power_level
      WRITE_LONG 0x001c 0                // Gold
      WRITE_BYTE 0x0270 IDS_OF_SYMBOL("ea" "neutral")
    
      WRITE_BYTE  0x0275 IDS_OF_SYMBOL("gender" "illusionary")
    
      // Add unstealable&undroppable flags to carried items
      GET_OFFSET_ARRAY itm_array CRE_V10_ITEMS
      PHP_EACH itm_array AS int => itm_offset
      BEGIN
        WRITE_LONG (itm_offset + 0x0010) (THIS | (BIT1 | BIT3))
      END
    END

     

     

     

     

     

    Oh, I love all of these! I just have a specific issue that this will help with. Basically, I have some bugs with a couple of summoning spells. I think the issue has something to do with imported animations. I'm just going to convert existing creatures, and this'll help. It's great timing.

     

    I had to look up what made a creature 'shadow-like'. I think the only thing required is that the creature has TRANS60.ITM equipped (I'm pretty sure). That's easy enough for me to add, though. Thanks...

     

    Edit: as for illusionary creatures, I'll probably use it just because it's right there!

  4. Another small one, turn a creature into a summoned creature. This sets the XP- and gold stats to zero, sets the bit to leave no corpse, sets affinity to "neutral", and sets the creature's gender to "summoned".

     

    There is one parameter, power_level. This should only be set if this creature will be used with opcode #127, it is used to determine how many instances of this creature will be summoned. The number here (default 1) will be written to 0x0018 in the creature file.

     

     

     

    DEFINE_PATCH_FUNCTION make_summon
      INT_VAR   power_level   = 1
    BEGIN
      WRITE_LONG 0x0010 THIS | BIT1      // No corpse
      WRITE_LONG 0x0014 0                // XP
      WRITE_LONG 0x0018 power_level
      WRITE_LONG 0x001c 0                // Gold
      WRITE_BYTE 0x0270 IDS_OF_SYMBOL("ea" "neutral")
    
      // Play nice with Remove Summoning Cap from D0Tweak
      PATCH_IF FILE_EXISTS "override/no_summoning_cap.d0"
      BEGIN
        WRITE_BYTE  0x0275 20       // D0Tweak alt. value
      END
      ELSE
      BEGIN
        WRITE_BYTE  0x0275 IDS_OF_SYMBOL("gender" "summoned")
      END
    
      // Add unstealable&undroppable flags to carried items
      GET_OFFSET_ARRAY itm_array CRE_V10_ITEMS
      PHP_EACH itm_array AS int => itm_offset
      BEGIN
        WRITE_LONG (itm_offset + 0x0010) (THIS | (BIT1 | BIT3))
      END
    END

     

     

    Example of use, to make a summonable version of an ochre jelly:

    COPY_EXISTING "jeloch01.cre" "override/jelochsu.cre"
      LAUNCH_PATCH_FUNCTION make_summon END
    
    Oh, this is great! Any chance for a 'shawdowed' option (i.e. like shades or shadow monsters in iwdee)?
  5. Cam, this is something of a tutorial for using this batch, at least as I plan to use it. It seems relevant and useful, but let me know if this is out of place, of if I am leading others astray with my stupidity, or similar and I'll delete it or change it as necessary. I'm just really excited about this tool!

     

    Okay, so I wanted to drop a note about how awesome these macros are for me. Maybe they can be awesome for you, too!

     

    I am creating a mod that adds A LOT of new spells to the game via ADD_SPELL (all IWDEE spells to BG(2)EE and SoD for starters).

     

    This creates a couple of problems that are easily solvable with this code (et al. I will get into some of those details in the hopes of aiding other fledgling modders with these issues).

     

    Problem 1: some of my added spells protect against or otherwise interact with other added spells. But, where two added spells interact, I have no way of knowing ahead of time the filenames of those particular spells. I have some really messy code to do this, but with this code I can erase most of it (I'm sure that a better coder would not have such issues, but alas!)

     

    Problem 2: In a given install, other mods may install spells that should interact with my spells. I can do checks for specific spells that I know about in advance, but this code allows me to send a wide net to catch more spells easier.

     

    Okay, so let me give a concrete example. One spell that I am adding from IWDEE is the wizard spell Emotion: Fear. Another spell I'm adding is Blood Rage. Now, blood rage has been the bane of my existence because it protects against so many spells, but anyway it protects against, and removes fear effects. I'll go into fear removal as an example of one way (not the only way, I'm sure) to use this code to make your life a little bit easier.

     

    Here is the beauty of the system: I don't have to specifically worry about Blood Rage anymore. All I need to do is alter the cd_fear_removal_arrays to suit my needs, add my relevant spells to an array, alter the and then, at the very end of my install, run a regexp inside an ACTION_PHP_EACH, apply cd_fear_removal_arrays, use other relevant commands like ALTER_EFFECT, and then Boom! The targeted spells will add the relevant effects and I can get on with my life!

     

    The above is very general because, it turns out, you can do SO MUCH. But, let's get concrete and specific.

     

    The original cd_fear_removal_arrays has, as it's key, effect 161 (cure: fear). That's probably all you need for they key batch; any spell that is going to cure fear should use this opcode, no? So, let's move on.

     

    In the extra batches, I will add this line:

     

          321, "-10", "-10", "FEAR_R", 1, 0, "same" => 1 // remove spell effects: generic
    

    Opcode 321 is EE specific, so don't use this in a non EE game. Honestly, I forget how vanilla fear removal goes, but be sure to use whatever effect that uses to remove the effects of a given spell. Anyway, 321 is just the effect I need to remove my custom spls. "FEAR_R" is just a placeholder that will be ALTERed in the regexp to my spell using an array variable.

     

    Okay, now, for the array. There are a number of ways to create a custom array, I'm sure, but here is the way I do it. After I add my spell, there is this wonderful Weidu command RES_NUM_OF_SPELL_NAME which allows one to save the filename of the spell you have just added to a variable. You can then use that variable to add the filename to an array which can then be called. So, this is what I do at some point after I add a fear spell (here, I'll use emotion: fear as an example):

     

    ADD_SPELL ~Spells/data/iwd_spells/wizard_4/b_w428.spl~ 2 4 ~WIZARD_EMOTION_FEAR~ //
    //...stuff
    
    
    //to clear earlier versions of the spell
    LAF RES_NUM_OF_SPELL_NAME
      STR_VAR spell_name = ~WIZARD_EMOTION_FEAR~
      RET spell_res
    END
    //more stuff...
    //fear immunity list
    ACTION_DEFINE_ASSOCIATIVE_ARRAY prot BEGIN
    
    
    ~%spell_res%~ => fear
    
    
    END

    Top to bottom: When I add the spell the spell will have the internal name, WIZARD_EMOTION_FEAR written to SPELL.ids. (you otherwise name the spell just as per COPY). When it comes to save my (unknown) filename to a variable, I use RES_NUM_OF_SPELL_NAME exactly as written. The only thing that would be different is the ~WIZARD_EMOTION_FEAR~, which would just be ~YOUR_INTERNAL_SPELLNAME~. Your file name will be saved as the variable spell_res.

     

    Okay, now the next part is where your filename gets added to your array.

     

    ACTION_DEFINE_ASSOCIATIVE_ARRAY prot BEGIN

     

    assigns a name to your array which will be called for later. Here, my name is "prot", but you can name it whatever works for you.

     

    ~%spell_res%~ => fear
    This line is where your filename gets added to the array. Your array will actually be <file name> => fear. Note that the 'fear' part can be whatever you want, and you can use it to define different kinds of effects to apply to different kinds of uses (e.g. I use ~%spell_res%~ => fear for fear removal/protection, ~%spell_res%~ => death for death protection, etc. all in my prot array).
    END is just END for that particular array :)
    Okay, now for the exciting part (for me, anyway). Here, we need to call for the array, and then use regexp to apply the right effects to the right spells.
    A couple of things to note: There is already a warning in the code, but don't use this with cd_immunity_free_action_arrays
    As it says in the comments, "...unlike other batches, do *not* use this one in a regexp--it'll turn a small web immunity into fullblown FA."
    Also, the code I'm going to give is very bare bones to illustrate what I'm doing. It is very likely that the final code should contain other relevant PATCH_IF's (e.g. it will copy ALL spl's, including innates, bard songs, and so on. Not all of the spls it copies may be appropriate and these should be excluded with PATCH_IF or similar):
    ACTION_PHP_EACH prot AS block => rock BEGIN   //
      ACTION_IF (~%rock%~ STRING_EQUAL ~fear~) BEGIN  //
    
    
      COPY_EXISTING_REGEXP GLOB ~.*\.spl~ ~override~ //copy over all spl files
       PATCH_IF (SOURCE_SIZE > 0x71) BEGIN // avoid crashing on empty items //
         LPF cd_apply_batch STR_VAR array_name = cd_fear_removal_arrays END //fear removal arrays (modified for 321 with "FEAR_R" for generic spls)
           LPF ALTER_EFFECT INT_VAR match_opcode = 321 STR_VAR match_resource = ~FEAR_R~ resource = EVAL ~%block%~ END
       END //
      BUT_ONLY//
    
    
     END
    END

    I've put spaces between the ARRAY code and the regexp code (the spaces aren't necessary).

     

    ACTION_PHP_EACH prot AS block => rock BEGIN

     

    This does a couple of things. First, it calls your array (here, my "prot" array), and applies the variables "block" and "rock" for your <file name> and 'fear' denotation, respectively. This is what allows me to do this in the next line:

     

    ACTION_IF (~%rock%~ STRING_EQUAL ~fear~) BEGIN

     

    Remember how I said that I use the same array for multiple protection types? Well, here, only the ones designated 'fear' will be considered (as opposed to 'death' etc.) That is, only my fear spells will be applied to the relevant fear removal spells.

    This is just normal regexp stuff:

     

    COPY_EXISTING_REGEXP GLOB ~.*\.spl~ ~override~ //copy over all spl files
    PATCH_IF (SOURCE_SIZE > 0x71) BEGIN // avoid crashing on empty items //

    This line:
    LPF cd_apply_batch STR_VAR array_name = cd_fear_removal_arrays END //fear removal arrays (modified for 321 with "FEAR_R" for generic spls)
    Applies the (altered) fear removal array. Because the array checks for any spell that has the 161 effect, and only when it detects such an effect does it add the extra stuff, including my 'dummy' 321 effect, I can then do this:
    LPF ALTER_EFFECT INT_VAR match_opcode = 321 STR_VAR match_resource = ~FEAR_R~ resource = EVAL ~%block%~ END
    This little beauty will look for any 321 opcode that has "FEAR_R" in it's resource key, and will then replace that text with the value of 'block' (which will be the filename of your spell).
    Note that the BUT_ONLY is essential if you don't want to copy ALL spl files into the override!
    This code will iterate through all spl files for each 'member' of 'fear' in your prot array, add the 'dummy' 321 effect, and then change it to the relevant file name.
  6. ...

     

    EDIT: Turns out that in BG2, the level drain icon is set by the engine when opcode 216 is used. So, don't set it ourselves as it won't be removed.

     

     

    EFINE_PATCH_FUNCTION add_energy_drain
    INT_VAR
    levels_drained			= 1
    BEGIN
      READ_ASCII 0x0000 signature (4)
      PATCH_MATCH "%signature%"
      WITH
      "ITM " WHEN ENGINE_IS "bg1 totsc iwd1 how totlm"
      BEGIN
        LAUNCH_PATCH_FUNCTION ADD_ITEM_EFFECT
          INT_VAR
          type			= 1	// Melee
          opcode			= 18	// HP: Maximum HP Modifier
          target			= 2	// Pre-target
          duration			= 2400
          parameter1		= ((0 - 5) * levels_drained)
        END
    
        LAUNCH_PATCH_FUNCTION ADD_ITEM_EFFECT
          INT_VAR
          type			= 1	// Melee
          opcode			= 54	// Stat: THAC0 Modifier
          target			= 2	// Pre-target
          duration			= 2400
          parameter1		= ((0 - 2) * levels_drained)
        END
    
        LAUNCH_PATCH_FUNCTION ADD_ITEM_EFFECT
          INT_VAR
          type			= 1	// Melee
          opcode			= 142	// Graphics: Display Special Effect Icon
          target			= 2	// Pre-target
          duration			= 2400
          parameter2		= 53
        END
      END
    
      "ITM "
      BEGIN
        LAUNCH_PATCH_FUNCTION ADD_ITEM_EFFECT
          INT_VAR
          type			= 1	// Melee
          opcode			= 216	// Spell Effect: Level Drain
          target			= 2	// Pre-target
          timing			= 1	// Permanent
          parameter1		= levels_drained
        END
      END
    
      "SPL " WHEN ENGINE_IS "bg1 totsc iwd1 how totlm"
      BEGIN
        LAUNCH_PATCH_FUNCTION ADD_SPELL_EFFECT
          INT_VAR
          opcode			= 18	// HP: Maximum HP Modifier
          target			= 2	// Pre-target
          duration			= 2400
          parameter1		= ((0 - 5) * levels_drained)
        END
    
        LAUNCH_PATCH_FUNCTION ADD_SPELL_EFFECT
          INT_VAR
          opcode			= 54	// Stat: THAC0 Modifier
          target			= 2	// Pre-target
          duration			= 2400
          parameter1		= ((0 - 2) * levels_drained)
        END
    
        LAUNCH_PATCH_FUNCTION ADD_SPELL_EFFECT
          INT_VAR
          opcode			= 142	// Graphics: Display Special Effect Icon
          target			= 2	// Pre-target
          duration			= 2400
          parameter2		= 53
        END
      END
    
      "SPL "
      BEGIN
        LAUNCH_PATCH_FUNCTION ADD_SPELL_EFFECT
          INT_VAR
          type			= 1	// Melee
          opcode			= 216	// Spell Effect: Level Drain
          target			= 2	// Pre-target
          timing			= 1	// Permanent
          parameter1		= levels_drained
        END
      END
      DEFAULT
        PATCH_FAIL "add_energy_drain() used on incompatible file!"
      END
    END
    

     

     

     

    ...

    Just a slight copy/paste typo. "EFINE_PATCH_FUNCTION add_energy_drain" needs to be changed to "DEFINE_PATCH_FUNCTION add_energy_drain"

  7. Cool.

     

    (These are EE only. A few adjustments will need to be made to use with non-ee versions. I believe/assume that the string references are the same...)

     

    I created this one just for Exaltation (and, possibly, spells like it) The description says that it protects against the effects it cures, but it doesn't protect against berserk. That doesn't really matter in the standard game--there are possible exceptions--but it potentially matters if you have any spells with these effects. So...

     

    (edited to remove unnecessary protections from different games)

     

     

    REVISED FOR ALL EE GAMES

     

    (Only added altered batches. Mind the "...". Those represent gaps...

    // turns slow immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_slow_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101,  "-10", 40, "same",  "-10",  "-10", "same" => 1 // immunity to slow
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        206, "-1",  "-10", "spwm164",  "-10", "-10", "same" => 1 // protection from spell, slow
        206, "-1",  "-10", "spin977",  "-10", "-10", "same" => 1 // protection from spell, golem slow
        206, "-1",  "-10", "spin983",  "-10", "-10", "same" => 1 // protection from spell, slow
        206, "-1",  "-10", "spwish25", "-10", "-10", "same" => 1 // protection from spell, slow
        206, "-1",  "-10", "spwi312",  "-10", "-10", "same" => 1 // protection from spell, slow
        206, "-1",  "-10", "spin575",  "-10", "-10", "same" => 1 // protection from spell, vortex web
        267, 14000, "-10",    "",  "-10", "-10", "same" => 1 // protection from string "slow"  (BG2EE)   In IWDEE and BGEE...not sure if it's used  
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10", 41, "same", "-10", "-10", "same" => 1 // prevent slow icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
         267, 31772, "-10",     "",  "-10", "-10", "same" => 1 // protection from string slowed (BGEE)
        END
      END
      PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN    
         267, 14668, "-10",    "",  "-10", "-10", "same" => 1 // protection from string "slowed" (BG2EE/IWDEE)
        END
      END
      PATCH_IF GAME_IS ~eet~ BEGIN   //just in case...
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
         267, 11799, "-10",    "",  "-10", "-10", "same" => 1 // protection from string "slow" (EET)--Used?  Just in case
        END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN   //just in case...
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
         267, 37787, "-10",    "",  "-10", "-10", "same" => 1 // protection from string "slowed" (IWDEE)  Just in case
         267, 37638, "-10",    "",  "-10", "-10", "same" => 1 // protection from string "slow" (IWDEE)  Just in case
        END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
      END // nothing to delete...except there is...
      PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
         267, 31772, "-10",     "",  "-10", "-10", "same" => 1 // protection from string slowed (BGEE)
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
         267, 14668, "-10",    "",  "-10", "-10", "same" => 1 // protection from string "slowed" (BG2EE/IWDEE)
        END
      END
    END
    
    
    
    // turns confusion immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_confusion_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101,  "-10", 128, "same",  "-10",  "-10", "same" => 1 // immunity to confusion
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        296, "-10", "-10", "spconfus",  "-10", "-10", "same" => 1 // confusion visuals
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10",  2, "same", "-10", "-10", "same" => 1 // prevent rigid thinking icon
          169, "-10",  3, "same", "-10", "-10", "same" => 1 // prevent confused icon
          169, "-10", 47, "same", "-10", "-10", "same" => 1 // prevent chaos icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
         267, 25807, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (BGEE)
         267, 26184, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (BGEE)
        END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
         267, 14782, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused"      (BG2EE)
         267, 14791, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (BG2EE)
        END
      END
      PATCH_IF GAME_IS ~eet~ BEGIN   //just in case...
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
         267, 17394, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused"      (EET)
         267, 17393, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (EET)
        END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
         267, 37604, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (IWDEE)
         267, 37603, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (IWDEE)
        END
      END
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
    END // nothing to delete ...except
      PATCH_IF GAME_IS ~bgee~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
         267, 37604, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (IWDEE)
         267, 37603, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (IWDEE)
         267, 14782, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused"       (BG2EE)
         267, 14791, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (BG2EE)
        END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
         267, 37604, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (IWDEE)
         267, 37603, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (IWDEE)
         267, 25807, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (BGEE)
         267, 26184, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (BGEE)
        END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
         267, 14782, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (BG2EE)
         267, 14791, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (BG2EE)
         267, 25807, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "confused" (BGEE)
         267, 26184, "-10",     "",  "-10", "-10", "same" => 1 // protection from string "Rigid Thinking" (BGEE)
        END
      END
    END
    
    
    
    // turns level drain immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_level_drain_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101,  "-10", 216, "same",  "-10",  "-10", "same" => 1 // immunity to level drain
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10", 59, "same", "-10", "-10", "same" => 1 // prevent level drain icon
          142, "-10", 90, "same", "-10", "-10", "same" => 1 // display npp icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN  //
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          267, 25802, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"   (BGEE)
          267, 25803, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"   (BGEE)
          267, 25804, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"  (BGEE)
          267, 25805, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (BGEE)
          267, 25806, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"   (BGEE)
        END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          267, 41495, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"   (BG2EE)
          267, 40968, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"  (BG2EE)
          267, 40969, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"  (BG2EE)
          267, 40979, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (BG2EE)
          267, 41616, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"  (BG2EE)
        END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN  //FIND OTHER STRINGS!
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          267, 35498, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"  (IWDEE)
          267, 35497, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"    (IWDEE)
          267, 35496, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"   (IWDEE)
          267, 35472, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (IWDEE)
          267, 35495, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"   (IWDEE)
        END
      END
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
    END // nothing to delete ...not
      PATCH_IF GAME_IS ~bgee~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
          267, 35498, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"  (IWDEE)
          267, 35497, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"    (IWDEE)
          267, 35496, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"   (IWDEE)
          267, 35472, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (IWDEE)
          267, 35495, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"   (IWDEE)
          267, 41495, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"   (BG2EE)
          267, 40968, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"  (BG2EE)
          267, 40969, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"  (BG2EE)
          267, 40979, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (BG2EE)
          267, 41616, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"  (BG2EE)
        END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
          267, 35498, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"  (IWDEE)
          267, 35497, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"    (IWDEE)
          267, 35496, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"   (IWDEE)
          267, 35472, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (IWDEE)
          267, 35495, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"   (IWDEE)
          267, 25802, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"   (BGEE)
          267, 25803, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"   (BGEE)
          267, 25804, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"  (BGEE)
          267, 25805, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (BGEE)
          267, 25806, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"   (BGEE)
        END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
          267, 41495, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"   (BG2EE)
          267, 40968, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"  (BG2EE)
          267, 40969, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"  (BG2EE)
          267, 40979, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (BG2EE)
          267, 41616, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"  (BG2EE)
          267, 25802, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "one level drained"   (BGEE)
          267, 25803, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "two levels drained"   (BGEE)
          267, 25804, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "three levels drained"  (BGEE)
          267, 25805, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "four levels drained"   (BGEE)
          267, 25806, "-10",     "same",  "-10", "-10", "same" => 1 // protection from string "five levels drained"   (BGEE)
        END
      END
    END
    
    ...
    
    // turns hold immunity into full immunity
    // should run cd_immunity_hold_special_arrays before this
    DEFINE_PATCH_MACRO ~cd_immunity_hold_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101,  "-10", 109, "",  "-10",  "-10", "same" => 1 // immunity to paralyzation
        101,  "-10", 175, "",  "-10",  "-10", "same" => 1 // immunity to hold
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        296, "-10", "-10",     "spmindat", "-10", "-10", "same" => 1 // protection from animation
        296, "-10", "-10",     "spflayer", "-10", "-10", "same" => 1 // protection from animation
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10", 13, "", "-10", "-10", "same" => 1 // prevent hold icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 25866, "-10", "", "-10", "-10", "same"  => 1 // protection from string "held" (BGEE)
        267, 31799, "-10", "", "-10", "-10", "same"  => 1 // protection from string "held" (BGEE)
        267, 14650, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Paralyzed" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 14102, "-10",     "",     "-10", "-10", "same" => 1 // protection from string "held" (BG2EE/IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
      END // nothing to delete
      PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 31799, "-10", "", "-10", "-10", "same"  => 1 // protection from string "held" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 14102, "-10", "", "-10", "-10", "same" => 1 // protection from string "held" (BG2EE/IWDEE)
       END
      END
    END
    
    
    ...
    
    // turns fear immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_fear_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN // these three go last so they don't block their own extras effects
    //    101,  "-10",  23, "same",  "-10",  "-10", "last" => 1 // immunity to cure horror?
        101,  "-10",  24, "same",  "-10",  "-10", "last" => 1 // immunity to horror
        101,  "-10", 106, "same",  "-10",  "-10", "last" => 1 // immunity to morale break modifier
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
         23, "-10", "-10",     "same",     1,     0, "first" => 1 // reset morale
        161, "-10", "-10",     "same",     1,     0, "same"  => 1 // remove fear
        296, "-10", "-10", "cdhorror", "-10", "-10", "same"  => 1 // protection from animation
        106, "-10",     1,     "same",     1,     0, "first" => 1 // morale break
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10", 36, "same", "-10", "-10", "same" => 1 // prevent panic icon
          240, "-10", 36, "same", "-10", "-10", "same" => 1 // remove panic icon
          142, "-10", 37, "same", "-10", "-10", "same" => 1 // display resist fear icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 25818, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"                 (BGEE)
        267, 20568, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Morale Failure: Panic" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 14007, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (BG2EE)
        267, 17427, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 20568, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Morale Failure: Panic"   (IWDEE)
        267, 35484, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (IWDEE)
       END
      END
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 14007, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (BG2EE)
        267, 17427, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (BG2EE)
        267, 25818, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"                 (BGEE)
        267, 20568, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Morale Failure: Panic" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 20568, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Morale Failure: Panic"   (IWDEE)
        267, 35484, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (IWDEE)
        267, 25818, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"                 (BGEE)
        267, 20568, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Morale Failure: Panic" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 20568, "-10", "", "-10", "-10", "same"  => 1 // protection from string "Morale Failure: Panic"   (IWDEE)
        267, 35484, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (IWDEE)
        267, 14007, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (BG2EE)
        267, 17427, "-10", "", "-10", "-10", "same"  => 1 // protection from string "panic"   (BG2EE)
       END
      END
    END
    
    
    
    // turns charm immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_charm_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101,  "-10",  5, "same",  "-10",  "-10", "same" => 1 // immunity to charm
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        296, "-10", "-10", "spnwchrm", "-10", "-10", "same"  => 1 // protection from animation
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10",  0, "same", "-10", "-10", "same" => 1 // prevent charm icon
          169, "-10",  1, "same", "-10", "-10", "same" => 1 // prevent dire charm icon
          169, "-10", 43, "same", "-10", "-10", "same" => 1 // prevent domination icon
          142, "-10", 52, "same", "-10", "-10", "same" => 1 // display mind shield icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 26206, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated" (BGEE)
        267, 31787, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"  (BGEE)
        267, 14780, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dire charmed" (BG2EE/BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  8364, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated"  (BG2EE)
        267, 14672, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"     (BG2EE)
        267, 14780, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dire charmed"  (BG2EE/BGEE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 35544, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated"  (IWDEE)
        267, 37801, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"     (IWDEE)
        267, 17392, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dire charmed"  (IWDEE)
       END
      END
     DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
     END //
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 35544, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated"  (IWDEE)
        267, 37801, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"     (IWDEE)
        267,  8364, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated"  (BG2EE)
        267, 14672, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"     (BG2EE)
        267, 17392, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dire charmed"  (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 26206, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated" (BGEE)
        267, 31787, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"  (BGEE)
        267, 35544, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated"  (IWDEE)
        267, 37801, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"     (IWDEE)
        267, 17392, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dire charmed"  (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  8364, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated"  (BG2EE)
        267, 14672, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"     (BG2EE)
        267, 14780, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dire charmed"  (BG2EE/BGEE)
        267, 26206, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "dominated" (BGEE)
        267, 31787, "-10",     "same", "-10", "-10", "same"  => 1 // protection from string "charmed"  (BGEE)
       END
      END
    END
    
            
    
    // turns haste immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_haste_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101,  "-10", 16, "same",  "-10",  "-10", "same" => 1 // immunity to haste
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        206,     0,  "-10", "spin572",  "-10", "-10", "same" => 1 // protection from spell, haste
        206,     0,  "-10", "spin828",  "-10", "-10", "same" => 1 // protection from spell, haste
        206,     0,  "-10", "spra301",  "-10", "-10", "same" => 1 // protection from spell, haste
        206,     0,  "-10", "spwi305",  "-10", "-10", "same" => 1 // protection from spell, haste
        // explicit blocking of imp haste (spwi613) not needed as its relevant effects are blocked with other immunities in the batch
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10", 38, "same", "-10", "-10", "same" => 1 // prevent haste icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 26019, "-10",    "same",  "-10", "-10", "same" => 1 // protection from string "hasted" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 14023, "-10",    "same",  "-10", "-10", "same" => 1 // protection from string "hasted" (BG2EE/IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
      END // nothing to delete
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 14023, "-10",    "same",  "-10", "-10", "same" => 1 // protection from string "hasted" (BG2EE/IWDEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 26019, "-10",    "same",  "-10", "-10", "same" => 1 // protection from string "hasted" (BGEE)
       END
      END
    END
    
    
    
    // turns disease immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_disease_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101,  "-10", 78, "same",  "-10",  "-10", "same" => 1 // immunity to disease
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10", 7, "same", "-10", "-10", "same" => 1 // prevent diseased icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 31238, "-10", "",  "-10", "-10", "same" => 1 // protection from string "Diseased" (BGEE)
        267, 26453, "-10", "",  "-10", "-10", "same" => 1 // protection from string "Stricken by a foul disease" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 39752, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "stricken by a foul disease"  (BG2EE/IWDEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 54337, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "diseased"   (BG2EE/ALso EET)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 35593, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "diseased"  (IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
      END // nothing to delete
      PATCH_IF GAME_IS ~bgee~ BEGIN  //that's a lie!!!
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 35593, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "diseased"  (IWDEE)
        267, 39752, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "stricken by a foul disease"  (BG2EE/IWDEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 31238, "-10", "",  "-10", "-10", "same" => 1 // protection from string "Diseased" (BGEE)
        267, 26453, "-10", "",  "-10", "-10", "same" => 1 // protection from string "Stricken by a foul disease" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 35593, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "diseased"  (IWDEE)
       END
      END
    END
    
    
    
    // turns poison immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_poison_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101,  "-10", 25, "same",  "-10",  "-10", "same" => 1 // immunity to poison
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10",   6, "same", "-10", "-10", "same" => 1 // prevent poison icon
          169, "-10", 137, "same", "-10", "-10", "same" => 1 // prevent bleeding icon //Should this be here???
          142, "-10",  30, "same", "-10", "-10", "same" => 1 // display protection from poison icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 25425, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (BGEE)
        267, 26215, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 14662, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (BG2EE)
        267, 14017, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison"   (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 37607, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (IWDEE)
        267, 36317, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison"   (IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 37607, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (IWDEE)
        267, 36317, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison"   (IWDEE)
        267, 14662, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (BG2EE)
        267, 14017, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison"   (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 37607, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (IWDEE)
        267, 36317, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison"   (IWDEE)
        267, 25425, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (BGEE)
        267, 26215, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 14662, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (BG2EE)
        267, 14017, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison"   (BG2EE)
        267, 25425, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poisoned" (BGEE)
        267, 26215, "-10", "same",  "-10", "-10", "same" => 1 // protection from string "poison" (BGEE)
       END
      END
    END
    
    
    
    
    ...
    
    
    
    // turns petrification immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_petrification_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101, "-10", 134, "same",  "-10",  "-10", "same" => 1 // immunity to petrification
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  25863, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  14665, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  38043, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
      END // nothing to delete
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  14665, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (BG2EE)
        267,  38043, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  25863, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (BGEE)
        267,  38043, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  25863, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (BGEE)
        267,  14665, "-10", "same", "-10",  "-10", "same" => 1 // disable string "petrified"   (BG2EE)
       END
      END
    END
    
    
    
    
    // turns kill target immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_kill_target_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101, "-10", 13, "same",  "-10",  "-10", "same" => 1 // immunity to kill target
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
    //    267,  64285, "-10", "same", "-10",  "-10", "same" => 1 // disable string "vorpal hit" (BGEE?)
        267,  25282, "-10", "same", "-10",  "-10", "same" => 1 // disable string "death"      (BGEE)
        267,  31250, "-10", "same", "-10",  "-10", "same" => 1 // disable string "undead destroyed"   (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  64285, "-10", "same", "-10",  "-10", "same" => 1 // disable string "vorpal hit"       (BG2EE)
        267,  14026, "-10", "same", "-10",  "-10", "same" => 1 // disable string "death"            (BG2EE)
        267,  10554, "-10", "same", "-10",  "-10", "same" => 1 // disable string "undead destroyed" (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  35592, "-10", "same", "-10",  "-10", "same" => 1 // disable string "vorpal hit"    (IWDEE)
        267,  35591, "-10", "same", "-10",  "-10", "same" => 1 // disable string "death"         (IWDEE)
        267,  35600, "-10", "same", "-10",  "-10", "same" => 1 // disable string "undead destroyed"  (IWDEE)
        267,  40195, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Outer planar destroyed"  (IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
    END
    
    
    
    
    // turns invisibility immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_invisibility_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101, "-10", 20, "same",  "-10",  "-10", "same" => 1 // immunity to invisibility
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  31747, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"   (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  14773, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"  (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  37762, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"  (IWDEE)
       END
      END
    DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END //
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  14773, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"  (BG2EE)
        267,  37762, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"  (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  31747, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"   (BGEE)
        267,  37762, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"  (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  31747, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"   (BGEE)
        267,  14773, "-10", "same", "-10",  "-10", "same" => 1 // disable string "invisible"  (BG2EE)
       END
      END
    END
    
    
    
    
    // turns silence immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_silence_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101, "-10", 38, "same",  "-10",  "-10", "same" => 1 // immunity to silence
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10", 34, "same", "-10", "-10", "same" => 1 // prevent silenced icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  31791, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (BGEE)
        267,  17425, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  14002, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (BG2EE)
        267,  14676, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  37805, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (IWDEE)
        267,  37633, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  37805, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (IWDEE)
        267,  37633, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (IWDEE)
        267,  14002, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (BG2EE)
        267,  14676, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  31791, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (BGEE)
        267,  17425, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (BGEE)
        267,  37805, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (IWDEE)
        267,  37633, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  31791, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (BGEE)
        267,  17425, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (BGEE)
        267,  14002, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silence"  (BG2EE)
        267,  14676, "-10", "same", "-10",  "-10", "same" => 1 // disable string "silenced" (BG2EE)
       END
      END
    END
    
    
    
    // turns blindness immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_blindness_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101, "-10", 74, "same",  "-10",  "-10", "same" => 1 // immunity to blindness
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  14674, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blinded"   (BG2EE--Also, protects vs. batch added blindness string--i.e. for ALL games)
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10", 8, "same", "-10", "-10", "same" => 1 // prevent blindness icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  31786, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blinded"   (BGEE)
        267,  26352, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blindness"   (BGEE)
        267,  17399, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blind"   (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,   1474, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"  (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,   37800, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blinded"  (IWDEE)
        267,   37608, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blind"  (IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN // these alts don't appear to be used...
      /*
        267,   1474, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"
        267,  14071, "-10", "same", "-10",  "-10", "same" => 1 // display 'blindness' string
        267,  12015, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"
        267,  12948, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"
        267,  13017, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"
        267,  17399, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"   
     */
      END // nothing to delete
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,   1474, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"  (BG2EE)
        267,   37800, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blinded"  (IWDEE)
        267,   37608, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blind"  (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  31786, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blinded"   (BGEE)
        267,  26352, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blindness"   (BGEE)
        267,  17399, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blind"   (BGEE)
        267,   37800, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blinded"  (IWDEE)
        267,   37608, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blind"  (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,   1474, "-10", "same", "-10",  "-10", "same" => 1 // disable string "blind"  (BG2EE)
        267,   37800, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blinded"  (IWDEE)
        267,   37608, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Blind"  (IWDEE)
       END
      END
    END
    
    
    // turns deafness immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_deafness_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101, "-10", 80, "same",  "-10",  "-10", "same" => 1 // immunity to deafneas
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10", 112, "same", "-10", "-10", "same" => 1 // prevent deaf icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  30258, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deafness"   (BGEE)
        267,  25102, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deaf"   (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  54318, "-10", "same", "-10",  "-10", "same" => 1 // disable string "deaf" (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  14073, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deafness"   (IWDEE)
        267,  35952, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deaf"   (IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  14073, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deafness"   (IWDEE)
        267,  35952, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deaf"   (IWDEE)
        267,  54318, "-10", "same", "-10",  "-10", "same" => 1 // disable string "deaf" (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  14073, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deafness"   (IWDEE)
        267,  35952, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deaf"   (IWDEE)
        267,  30258, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deafness"   (BGEE)
        267,  25102, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deaf"   (BGEE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  54318, "-10", "same", "-10",  "-10", "same" => 1 // disable string "deaf" (BG2EE)
        267,  30258, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deafness"   (BGEE)
        267,  25102, "-10", "same", "-10",  "-10", "same" => 1 // disable string "Deaf"   (BGEE)
       END
      END
    END
    
    
    
    ...
    
    // turns invisible detection immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_invisible_detection_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101, "-10", 116, "same",  "-10",  "-10", "same" => 1 // immunity to detect invisible
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  26179, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  14109, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  36282, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  14109, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (BG2EE)
        267,  36282, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  26179, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (BGEE)
        267,  36282, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  26179, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (BGEE)
        267,  14109, "-10", "same", "-10",  "-10", "same" => 1 // disable string "dispel invisible" (BG2EE)
       END
      END
    END
    
    ...
    
    // turns sleep immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_sleep_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101, "-10",  39, "same",  "-10",  "-10", "same" => 1 // immunity to sleep
        101, "-10", 217, "same",  "-10",  "-10", "same" => 1 // immunity to pw: sleep
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10", 14, "same", "-10", "-10", "same" => 1 // prevent sleep icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  26371, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  14001, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep" (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,  37613, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep"  (IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  14001, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep" (BG2EE)
        267,  37613, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep"  (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  37613, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep"  (IWDEE)
        267,  26371, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep" (BGEE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,  14001, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep" (BG2EE)
        267,  26371, "-10", "same", "-10",  "-10", "same" => 1 // disable string "sleep" (BGEE)
       END
      END
    END
    
    // turns stun immunity into full immunity
    DEFINE_PATCH_MACRO ~cd_immunity_stun_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101, "-10",  45, "same",  "-10",  "-10", "same" => 1 // immunity to stun
        101, "-10", 210, "same",  "-10",  "-10", "same" => 1 // immunity to pw: stun
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
      END
      PATCH_IF cosmetic = 1 BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
          169, "-10", 55, "same", "-10", "-10", "same" => 1 // prevent stun icon
        END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,   26050, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"  (BGEE)
        267,   25862, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"  (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,   1280, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"   (BG2EE)
        267,  14043, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"      (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267,   35568, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"  (IWDEE)
        267,   35567, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"  (IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END // nothing to delete
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,   1280, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"   (BG2EE)
        267,  14043, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"      (BG2EE)
        267,   35568, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"  (IWDEE)
        267,   35567, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"  (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,   26050, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"  (BGEE)
        267,   25862, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"  (BGEE)
        267,   35568, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"  (IWDEE)
        267,   35567, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"  (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267,   26050, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"  (BGEE)
        267,   25862, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"  (BGEE)
        267,   1280, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stunned"   (BG2EE)
        267,  14043, "-10", "same", "-10",  "-10", "same" => 1 // disable string "stun"      (BG2EE)
       END
      END
    END
    
    // ensures stun is always accompanied by string and icon
    DEFINE_PATCH_MACRO ~cd_full_stun_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        45, "-10", "-10", "same",  "-10",  "-10", "same" => 1 // blindness
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        142, "-10",    55, "same", "-10", "-10", "same" => 1 // display 'stun' icon
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        139,  26050, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string  (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        139,  1280, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string   (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        139,  35568, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string   (IWDEE)
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        139,  1280, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string   (BG2EE)
        139,  35568, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string   (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        139,  26050, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string  (BGEE)
        139,  35568, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string   (IWDEE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        139,  26050, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string  (BGEE)
        139,  1280, "-10", "same",     1,     0, "same" => 1 // display 'stunned' string   (BG2EE)
       END
      END
    END
    
    
    
    ...
    
    
    

     

    NEW BATCHES

    //berserk immunity
    DEFINE_PATCH_MACRO ~b_immunity_berserk_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101,  "-10", "-10", "same",  "-10",  "-10", "same" => 1 //Exaltation doesn't protect vs berserk despite description
        101,  "-10", 3, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
        101,  "-10", 245, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
        101,  "-10", 246, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
        101,  "-10", 247, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN //nope
        169, "-10", 4, "", "-10", "-10", "same" => 1 // prevent berserk icon
      END
    PATCH_IF GAME_IS ~iwdee~ BEGIN //well...
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        324, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // protection from spell, animal rage
        324, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // protection from spell, blood rage
        169, "-10", 173, "", "-10", "-10", "same" => 1 // protection from animal rage icon
        169, "-10", 176, "", "-10", "-10", "same" => 1 // protection from blood rage icon
      END
    END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
      END // nadda but...
    PATCH_IF NOT GAME_IS ~iwdee~ BEGIN //well...
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        324, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // protection from spell, animal rage
        324, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // protection from spell, blood rage
        169, "-10", 173, "", "-10", "-10", "same" => 1 // protection from animal rage icon
        169, "-10", 176, "", "-10", "-10", "same" => 1 // protection from blood rage icon
      END
    END
    
    
    END

    Rage/Berserk removal...
    //Rage/berserk removal
    DEFINE_PATCH_MACRO ~b_removal_rage_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        4,  "-10", "-10", "same",  "-10",  "-10", "same" => 1 //cure: berserking
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        321, "0", "0", "spcl152",  "-10", "-10", "same" => 1 // remove spell, barbi rage
        240, "-10", 138, "", "-10", "-10", "same" => 1 // remove barbi rage icon
        240, "-10", 4, "", "-10", "-10", "same" => 1 // remove berserk icon
        321, "0", "0", "b_tem03",  "-10", "-10", "same" => 1 // remove spell, Tempus incite rage special
        240, "-10", 141, "",   "-10",  "-10", "same" => 1 // remove enrage icon
        321, "0", "0", "spcl321",  "-10", "-10", "same" => 1 // remove spell,  enrage special
      END
    PATCH_IF GAME_IS ~iwdee~ BEGIN  //iwdee specific icons--handle IWDification/B_Spells a different way
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        321, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // remove spell, animal rage
        321, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // remove spell, blood rage
        240, "-10", 173, "", "-10", "-10", "same" => 1 // remove animal rage icon
        240, "-10", 176, "", "-10", "-10", "same" => 1 // remove blood rage icon
      END
    END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
      END // nadda...except
    PATCH_IF NOT GAME_IS ~iwdee~ BEGIN  //
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        321, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // remove spell, animal rage
        321, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // remove spell, blood rage
        240, "-10", 173, "", "-10", "-10", "same" => 1 // remove animal rage icon
        240, "-10", 176, "", "-10", "-10", "same" => 1 // remove blood rage icon
      END
    END
    END
    

    Rage/Berserk immunity

     

    //Rage/berserk immunity
    DEFINE_PATCH_MACRO ~b_immunity_rage_arrays~ BEGIN
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_key BEGIN
        101,  "-10", 3, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
        101,  "-10", 245, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
        101,  "-10", 246, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
        101,  "-10", 247, "same",  "-10",  "-10", "same" => 1 // immunity to berserk state
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        169, "-10", 138, "", "-10", "-10", "same" => 1 // prevent barbi rage icon
        169, "-10", 4, "", "-10", "-10", "same" => 1 // prevent berserk icon
        324, "0", "0", "spcl152",  "-10", "-10", "same" => 1 // protection from spell, barbi rage special
        324, "0", "0", "b_tem03",  "-10", "-10", "same" => 1 // protection from spell, Tempus incite rage
        169, "-10", 141, "", "-10", "-10", "same" => 1 // prevent enrage icon
        324, "0", "0", "spcl321",  "-10", "-10", "same" => 1 // protection from spell, enrage special
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
        DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 25829, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (BGEE)
      END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 20723, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (BG2EE)
       END
      END
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_extras BEGIN
        267, 36021, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (IWDEE)
        324, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // protection from spell, animal rage
        324, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // protection from spell, blood rage
        169, "-10", 173, "", "-10", "-10", "same" => 1 // protection from animal rage icon
        169, "-10", 176, "", "-10", "-10", "same" => 1 // protection from blood rage icon
       END
      END
      DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN 
      END // nadda er....
      PATCH_IF GAME_IS ~iwdee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 20723, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (BG2EE)
        267, 25829, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (BGEE)
       END
      END
      PATCH_IF GAME_IS ~bg2ee eet~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 25829, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (BGEE)
        267, 36021, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (IWDEE)
        324, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // protection from spell, animal rage
        324, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // protection from spell, blood rage
        169, "-10", 173, "", "-10", "-10", "same" => 1 // protection from animal rage icon
        169, "-10", 176, "", "-10", "-10", "same" => 1 // protection from blood rage icon
      END
      END
      PATCH_IF GAME_IS ~bgee~ BEGIN
       DEFINE_ASSOCIATIVE_ARRAY cd_immunity_batches_delete BEGIN
        267, 20723, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (BG2EE)
        267, 36021, "-10",     "",  "-10", "-10", "same" => 1 // protection from string re rage (IWDEE)
        324, "0", "0", "sppr522",  "-10", "-10", "same" => 1 // protection from spell, animal rage
        324, "0", "0", "sppr422",  "-10", "-10", "same" => 1 // protection from spell, blood rage
        169, "-10", 173, "", "-10", "-10", "same" => 1 // protection from animal rage icon
        169, "-10", 176, "", "-10", "-10", "same" => 1 // protection from blood rage icon
       END
      END
    END

     

     

    NEW BATCHES

  8. I have a few questions, if ya don't mind!

     

    1) I assume that "cosmetic" is a variable set by the BG2 Fixpack (is this correct)? Assuming so, is this variable set in any (or all) of the EE's? I assume not, but ya never know!

     

    2) Do you want us to share our custom created batches (i'll call them)? So far, I've created both a rage/berserk removal and immunity batch for a few custom spells. It's not much--I'll be adding quite a few more--but someone might find them useful.

     

    2.1) Also, I notice that these batches seem to be bg2/bg2ee specific, especially string references. For example, it looks like the haste immunity batch protects against string "14023", which is the 'hasted' notification in bg2ee (I assume it is the same in bg2), but does not protect against "26019", which is the 'hasted' notification in BGEE (and maybe BG1). I'll be altering them to check for the game engine and then protect against the relevant strings. Would it be useful if I share these?

     

    ...I guess that's it

  9. A bit off-topic, but, might it not be better to code some of the transformation's effects (disabled casting, stat bonuses, the like) as equipping effects in the claw/fist item? Then all the "return to human form" ability has to do is, shapeshift human + remove claw/fist.

    That can be done with this code. I've been fiddling with it for the last few days. Good Fun! I'm rewriting a lot of my spell stuff around this (as i slowly eeify it). I'll upload the results on github when it's in a presentable state

     

    Edit: i really like this idea. It seems 'cleaner'. I think I'm going to use it

  10.  

    I'm having an issue with cd_spell_transformation_human_arrays.

    Let us see your code and sort it out ... we can't help you if you don't give us things to see with our eyes.

    Sure...

     

     

     

    I'm having an issue with cd_spell_transformation_human_arrays. I'm creating a priest spell that polymorphs the caster into a shambling mound. The spell disables casting, but grants an innate that ends the spell, transforming the caster back into their original form and gives them back their casting ability. I'm running the macro as I create the innate from SPIN124. I notice that, helpfully, the macro creates a number of 279 effects. However, when I install it in BG2EE, the resource contains SPWI491. Unaltered, the innate does not re-enable casting for characters using my spell. I notice that if I remove SPWI491 from the resource, the innate re-enables the correct buttons.

     

    At first I thought that the effect will only re-enable button use if it was removed by the spell in the resource key. However, when I clone the 279 effects and put my own spell in the resource key, it still does not work. I might be doing something wrong, or there might be something else going on, but I figured I would bring it up in case it is a real issue.

    I'm not sure I completely follow. If it's for the shift into shambling mound, you want cd_spell_transformation_arrays instead. The only thing that should always be done in the shift away from human form is clearing out the abilities from other transformations, and that includes spwi491 and other return-to-human abilities. If you don't clear them out before granting a new one, you'll have them accumulating, like the old bug with the ranger tracking ability. Just make sure the granting of the return-to-human innate is the last effect.

    Sorry if I'm unclear. The spell is similar to druid shape change in that it gives the character an innate to end the spell early if they like (regaining the use of their spell buttons via 279)

     

    This is the relevant code:

     

    //cancel innate
    COPY_EXISTING ~SPIN124.spl~ ~override/%spell_res%A.spl~
      LPF cd_apply_batch STR_VAR array_name = cd_spell_transformation_human_arrays END //
      LPF CLONE_EFFECT INT_VAR match_opcode = 172 multi_match = 1 STR_VAR resource = EVAL ~%spell_res%~ END  //removes my spell
      LPF ALTER_EFFECT INT_VAR match_opcode = 279 STR_VAR match_resource = ~SPWI491~ resource = EVAL ~~ END  //These are 279 effects created by the macro.  I have to clear out the resource for them to work.
    I have to do that last ALTER_EFFECT because, while the macro creates the 279 effects, it puts SPWI491 in the resource key (and so, the effect doesn't work for my innate--i.e. button use is not restored with SPWI491 in the resource key but button use is restored once I clear it)

     

    This is the entire spell if its important:

     

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //____________________________________________________________Nature's Wrath____________________________________________________________________________//
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    //Projectile
    //VVC
    //bam
    //animations
    //3d animation
    //cre
    COPY ~Spells/data/new_spells/priest_6/SMOUNDSU.cre~ ~override~   //adds resistances (which, apparently, are only in IWDEE???)
            SAY NAME1 @73700002
            SAY NAME2 @73700002
    //sounds
    COPY ~spells/spheres/spells/death/#EFF_P04.wav~ ~override~ //
    //effs
    //itm
    COPY ~Spells/data/new_spells/priest_6/B4-32M3.itm~ ~override~   //
        LPF cd_apply_batch STR_VAR array_name = cd_immunity_free_action_arrays END
    //itm bam
    COPY ~Spells/data/new_spells/priest_6/ISHAPE07.BAM~ ~override~   //
    //eff for text notification
    COPY ~Spells/data/new_spells/priest_6/B4-32M3.eff~ ~override~   //
      SAY 0x1c @73700003   //Entangled Notification
    //Spell itself
    ADD_SPELL ~Spells/data/new_spells/priest_6/b_Pr601.spl~ 1 6 ~CLERIC_NATURES_WRATH~ //
            SAY NAME1 @51401
            SAY NAME2 @51401
            SAY UNIDENTIFIED_DESC @51402
    SAY DESC @51402
    
    
    //to clear earlier versions of the spell
    LAF RES_NUM_OF_SPELL_NAME
      STR_VAR spell_name = ~CLERIC_NATURES_WRATH~
      RET spell_res
    END
    COPY_EXISTING ~%spell_res%.spl~ ~override~
      LPF CLONE_EFFECT
          INT_VAR match_opcode = 172 STR_VAR match_resource = ~B_PR601~ resource = EVAL ~%spell_res%A~ END
      LPF ALTER_EFFECT
          INT_VAR match_opcode = 172 STR_VAR match_resource = ~B_PR601~ resource = EVAL ~%spell_res%~ END
      LPF ALTER_EFFECT
          INT_VAR match_opcode = 171 STR_VAR resource = EVAL ~%spell_res%A~ END
    //Just in case
    LPF cd_apply_batch STR_VAR array_name = cd_spell_transformation_arrays END
    
    
    //add icons and projectile
    
    
    /* NEED TO CREATE UNIQUE SPELL ICON
    COPY_EXISTING ~%spell_res%.spl~ ~override~
      LPF ALTER_SPELL_HEADER INT_VAR STR_VAR icon = EVAL  ~%spell_res%B~ END
    COPY ~spells/spheres/spells/charm/b_c201a.bam~ ~override/%spell_res%a.bam~
    COPY ~spells/spheres/spells/charm/b_c201b.bam~ ~override/%spell_res%b.bam~
    COPY ~spells/spheres/spells/charm/b_c201c.bam~ ~override/%spell_res%c.bam~
    //add bams to spl
    COPY_EXISTING ~%spell_res%.spl~ ~override~
      WRITE_EVALUATED_ASCII 0x003a ~%spell_res%C~
    */
    //cancel ability
    COPY_EXISTING ~SPIN124.spl~ ~override/%spell_res%A.spl~
      LPF cd_apply_batch STR_VAR array_name = cd_spell_transformation_human_arrays END //
      LPF CLONE_EFFECT INT_VAR match_opcode = 172 multi_match = 1 STR_VAR resource = EVAL ~%spell_res%~ END  //
      LPF ALTER_EFFECT INT_VAR match_opcode = 279 STR_VAR match_resource = ~SPWI491~ resource = EVAL ~~ END  //
    
    
    //Other polymorphy spells...
    ACTION_IF FILE_EXISTS_IN_GAME ~spinhum.spl~ BEGIN
    COPY_EXISTING ~spinhum.spl~ ~override~
      LPF CLONE_EFFECT INT_VAR match_opcode = 172 multi_match = 1 STR_VAR resource = EVAL ~%spell_res%A~ END
      LPF CLONE_EFFECT INT_VAR match_opcode = 172 multi_match = 1 STR_VAR resource = EVAL ~%spell_res%~ END
    END
    ACTION_IF FILE_EXISTS_IN_GAME ~spwi491.spl~ BEGIN
    COPY_EXISTING ~spwi491.spl~ ~override~
      LPF CLONE_EFFECT INT_VAR match_opcode = 172 multi_match = 1 STR_VAR resource = EVAL ~%spell_res%A~ END
      LPF CLONE_EFFECT INT_VAR match_opcode = 172 multi_match = 1 STR_VAR resource = EVAL ~%spell_res%~ END
    END
    ACTION_IF FILE_EXISTS_IN_GAME ~spin122.spl~ BEGIN
    COPY_EXISTING ~spin122.spl~ ~override~
      LPF CLONE_EFFECT INT_VAR match_opcode = 172 multi_match = 1 STR_VAR resource = EVAL ~%spell_res%A~ END
      LPF CLONE_EFFECT INT_VAR match_opcode = 172 multi_match = 1 STR_VAR resource = EVAL ~%spell_res%~ END
    END
    ACTION_IF FILE_EXISTS_IN_GAME ~spin123.spl~ BEGIN
    COPY_EXISTING ~spin123.spl~ ~override~
      LPF CLONE_EFFECT INT_VAR match_opcode = 172 multi_match = 1 STR_VAR resource = EVAL ~%spell_res%A~ END
      LPF CLONE_EFFECT INT_VAR match_opcode = 172 multi_match = 1 STR_VAR resource = EVAL ~%spell_res%~ END
    END
    ACTION_IF FILE_EXISTS_IN_GAME ~spin124.spl~ BEGIN
    COPY_EXISTING ~spin124.spl~ ~override~
      LPF CLONE_EFFECT INT_VAR match_opcode = 172 multi_match = 1 STR_VAR resource = EVAL ~%spell_res%A~ END
      LPF CLONE_EFFECT INT_VAR match_opcode = 172 multi_match = 1 STR_VAR resource = EVAL ~%spell_res%~ END
    END
    //finally, polymorph immunity (other possible created spells)
    INCLUDE ~spells/lib/poly_list.tpa~
  11. I'm having an issue with cd_spell_transformation_human_arrays. I'm creating a priest spell that polymorphs the caster into a shambling mound. The spell disables casting, but grants an innate that ends the spell, transforming the caster back into their original form and gives them back their casting ability. I'm running the macro as I create the innate from SPIN124. I notice that, helpfully, the macro creates a number of 279 effects. However, when I install it in BG2EE, the resource contains SPWI491. Unaltered, the innate does not re-enable casting for characters using my spell. I notice that if I remove SPWI491 from the resource, the innate re-enables the correct buttons.

    At first I thought that the effect will only re-enable button use if it was removed by the spell in the resource key. However, when I clone the 279 effects and put my own spell in the resource key, it still does not work. I might be doing something wrong, or there might be something else going on, but I figured I would bring it up in case it is a real issue.

  12. ...Can a crit on hit effect affect the attacker? What if one eff or spl, however it works, targets the attacker with a 1 second effect that halves their damage output? Maybe that would effectively negate the extra damage(?)

  13.  

     

    I think AI mages are always desperate; who wouldn't be when a full adventuring party appears in view? I do like the idea of a chance of the summoned fiend turning on the enemy caster too, though. A nice bit of entertaining randomness there.

    I support this as well.

    Agreed
  14.  

     

    I think AI mages are always desperate; who wouldn't be when a full adventuring party appears in view? I do like the idea of a chance of the summoned fiend turning on the enemy caster too, though. A nice bit of entertaining randomness there.

    I support this as well.

    Agreed
  15. ...

    SPPR609 False Dawn - should being blind prevent this? The problem is that this spell actually blinds stuff....

     

     

    I really don't think so. I think of the damage as mainly due to creatures being exposed to 'purifying light', similar to a vampire being burned by the sun. It still burns, even if you can't see it.

     

    SPPR610 Dolorous Decay - pro disease?

     

     

    I feel like that shouldn't work. This is like a reverse regeneration. Iirc, this spell is the reverse of regeneration in 2e, if not ad&d. The opposite of regeneration is not disease per se (regeneration doesn't even cure disease).

  16.  

    I've just checked Tactics code, it's very simple and it preforms a mass patch going through creature animations - if it finds any of the troll variants, it will strip away their junk items. While this could be used (I'd be 100% for it) I'm not sure SR should delve into such stuff....

     

    P.P.S.

    Is Gauth/Beholder summon too crazy?

    I think it's worth making a simple little standalone mod for the troll thing. Even submitting it as a component for Tweaks Anthology.

     

    I think Demi once said that trying to script a party-friendly beholder would be a total nightmare.

    This.

     

    And yeah, it is a total nightmare!!!

×
×
  • Create New...