Jump to content

Detectable Spells


SimDing0

Recommended Posts

I think we should include them.

 

However, it MAY render us incompatible with the Big Picture. I don't know whether that's of major concern. I figure if people can play BP, they can live with bugs in BG2. However, if we're to totally replace Baldurdash, it's something to consider.

 

Either way, I think we could do with properly WeiDU-ing Detectable and Scriptable Spells.

Link to comment

BP's the only one I'm aware of that changes them so drastically that it'd be incompatible. But really, the whole idea of including them here is to eliminate all those different fucking versions. If we're incompatible with them, they're incompatible with each other, and that's far worse. Mod authors should update.

Link to comment

No, unless Horred's changed something since we worked on creature AI, it won't solve the compatibility issue with BP. Let me explain:

 

BP might use SCRIPTINGSTATE9 to represent Spell Turning. Conventional Detectable Spells uses SCRIPTINGSTATE8 (an example; I'm not sure what it really uses), and so do Mang0's Hip Hop Mod and Mang0's Public Nudity Mod. We go with the latter, and after installing our mod, either the spell sets both scripting states, and all the mods get moderately broken, or we opt to remove the original effect and replace it with our own, in which case all the BP scripts get totally broken.

 

Does that make any sense? Of course, if it turns out Horred actually did turn back to convensional Detectable Spells, there's no problem.

Link to comment

Having taken a look at detectable spells, WeiDU-ing and including them should be fairly straightforward--all DS does is add a scripting state effect to every ability. Using the un-stackable spell patch I just bodged together, it should be just a matter of adding the right parameter to the right spell.

 

Sim, whom should we be contacting re: permission? I think it's Cierrek, but I'm not sure. I'd also like to release the changes back to the author so they can still offer them as a separate download.

Link to comment

There are already various different versions of it around, which decreases the number of people who install it.

I think having it available for download in 2 places would decrese the number of people who would install it.

I think making it an optional component would decrease the number of people installing it.

I think saying "it doesn't do anything for you, but helps modders" would decrease the number of people installing it.

 

I think, given the above, anyone would be mad to make a mod requiring it.

 

If we're (i.e. Cam) is going to do it, make sure it works, make sure it's universally compatible, make it compulsary, and insist we get installed before any other mod.

Link to comment
Having taken a look at detectable spells, WeiDU-ing and including them should be fairly straightforward--all DS does is add a scripting state effect to every ability. Using the un-stackable spell patch I just bodged together, it should be just a matter of adding the right parameter to the right spell.

I suggest we investigate Horred's claims that changing certain scripting states causes foot circles to vanish and stuff before we slap it into the fixpack.

 

Sim, whom should we be contacting re: permission? I think it's Cierrek, but I'm not sure. I'd also like to release the changes back to the author so they can still offer them as a separate download.

Cirerrek's the guy who takes care of them these days, yeh, although I think they're pretty much open domain so far as inclusion in mods goes.

 

If Detectable and Scriptable Spells (the latter should be included too) are in Baldurdash, a secondary package of them is unnecessary.

Link to comment

I'll build them in a separate pack so we can perform testing. I should have looked at Cierrek's site sooner--he documents everything he's added, which makes my job much, much easier. Idobek had already helped him make scriptable spells non-overwriting, so it's a trivial addition and something I would consider a bugfix anyway. :bday:

Link to comment

In theory the spell patching should have the exact same result as the current package. As DS seems to be in use by several mods without bug reports (sans Horred's comments), I don't think we're going to need extreme testing. That being said, confirming/denying Horred's issues with DS is very much a priority.

 

My sole concern is the stat.ids changes. For the most part, these can be handled by APPENDs, however, some are outright changes. LEVELDRAIN and STONESKINGOLEM change values, and SCRIPTINGSTATE6 and above are renamed. We could add duplicate entries for the SCRIPTINGSTATEs to address that, but I think we need to take a closer look and see where, if anywhere, these are used in existing dialogues and scripts. I did a half-assed search this morning and turned up two places where these states are used, so we may need to couple this with script/dialogue changes for consistency.

Link to comment

And this should do it.

 

BEGIN ~Detectable and Scriptable Spells~

APPEND ~stats.ids~ ~166 PROTECTION_FROM_EVIL~
               UNLESS ~PROTECTION_FROM_EVIL~

APPEND ~stats.ids~ ~167 TRUE_SIGHT~
               UNLESS ~TRUE_SIGHT~

APPEND ~stats.ids~ ~168 CLERIC_CHAOTIC_COMMANDS~
               UNLESS ~CLERIC_CHAOTIC_COMMANDS~

APPEND ~stats.ids~ ~169 CLERIC_MAGIC_RESISTANCE~
               UNLESS ~CLERIC_MAGIC_RESISTANCE~

APPEND ~stats.ids~ ~170 CLERIC_INSECT_PLAGUE~
               UNLESS ~CLERIC_INSECT_PLAGUE~

APPEND ~stats.ids~ ~171 CLERIC_BLADE_BARRIER~
               UNLESS ~CLERIC_BLADE_BARRIER~

APPEND ~stats.ids~ ~172 CLERIC_PHYSICAL_MIRROR~
               UNLESS ~CLERIC_PHYSICAL_MIRROR~

APPEND ~stats.ids~ ~173 CLERIC_SHIELD_OF_THE_ARCHONS~
               UNLESS ~CLERIC_SHIELD_OF_THE_ARCHONS~

APPEND ~stats.ids~ ~174 CLERIC_REGENERATION~
               UNLESS ~CLERIC_REGENERATION~

APPEND ~stats.ids~ ~175 CLERIC_CREEPING_DOOM~
               UNLESS ~CLERIC_CREEPING_DOOM~

APPEND ~stats.ids~ ~176 WIZARD_PROTECTION_FROM_PETRIFICATION~
               UNLESS ~WIZARD_PROTECTION_FROM_PETRIFICATION~

APPEND ~stats.ids~ ~177 WIZARD_SPELL_SHIELD~
               UNLESS ~WIZARD_SPELL_SHIELD~

APPEND ~stats.ids~ ~178 WIZARD_RESIST_FEAR~
               UNLESS ~WIZARD_RESIST_FEAR~

APPEND ~stats.ids~ ~179 WIZARD_PROTECTION_FROM_NORMAL_MISSILES~
               UNLESS ~WIZARD_PROTECTION_FROM_NORMAL_MISSILES~

APPEND ~stats.ids~ ~180 WIZARD_GREATER_MALISON~
               UNLESS ~WIZARD_GREATER_MALISON~

APPEND ~stats.ids~ ~181 WIZARD_PROTECTION_FROM_NORMAL_WEAPONS~
               UNLESS ~WIZARD_PROTECTION_FROM_NORMAL_WEAPONS~

APPEND ~stats.ids~ ~182 WIZARD_TENSERS_TRANSFORMATION~
               UNLESS ~WIZARD_TENSERS_TRANSFORMATION~

APPEND ~stats.ids~ ~183 WIZARD_PROTECTION_FROM_MAGIC_ENERGY~
               UNLESS ~WIZARD_PROTECTION_FROM_MAGIC_ENERGY~

APPEND ~stats.ids~ ~184 WIZARD_MISLEAD~
               UNLESS ~WIZARD_MISLEAD~

APPEND ~stats.ids~ ~185 WIZARD_PROTECTION_FROM_MAGIC_WEAPONS~
               UNLESS ~WIZARD_PROTECTION_FROM_MAGIC_WEAPONS~

APPEND ~stats.ids~ ~186 WIZARD_SPELL_IMMUNITY~
               UNLESS ~WIZARD_SPELL_IMMUNITY~

APPEND ~stats.ids~ ~187 WIZARD_PROTECTION_FROM_THE_ELEMENTS~
               UNLESS ~WIZARD_PROTECTION_FROM_THE_ELEMENTS~

// many spells stack with themselves and should not
COPY_EXISTING ~spcl144.spl~  ~override~ // kai
             ~spcl152.spl~  ~override~ // barbarian rage
             ~spcl213.spl~  ~override~ // paladin protection from evil
             ~spcl232.spl~  ~override~ // inquisitor true sight
             ~spcl321.spl~  ~override~ // berserker enrage
             ~spcl321d.spl~ ~override~ // berserker enrage cooldown
             ~spcl732.spl~  ~override~ // helm true sight
             ~spcl741.spl~  ~override~ // boon of lathander
             ~spin117.spl~  ~override~ // minsc’s berserk
             ~spin121.spl~  ~override~ // innate protection from evil
             ~spin676.spl~  ~override~ // mazzy’s invoke courage
             ~spin686.spl~  ~override~ // protection from magic weapons
             ~spin710.spl~  ~override~ // spell deflection
             ~spin920.spl~  ~override~ // beholder minor spell turning
             ~sppr107.spl~  ~override~ // protection from evil
             ~sppr202.spl~  ~override~ // barkskin
             ~sppr408.spl~  ~override~ // protection from evil 10’
             ~sppr505.spl~  ~override~ // true sight
             ~sppr508.spl~  ~override~ // chaotic commands
             ~sppr509.spl~  ~override~ // magic resistance
             ~sppr517.spl~  ~override~ // insect plague
             ~sppr603.spl~  ~override~ // blade barrier
             ~sppr613.spl~  ~override~ // physical mirror
             ~sppr698.spl~  ~override~ // npc blade barrier
             ~sppr701.spl~  ~override~ // shield of the archons
             ~sppr711.spl~  ~override~ // regeneration
             ~sppr717.spl~  ~override~ // creeping doom
             ~spwi102.spl~  ~override~ // armor
             ~spwi108.spl~  ~override~ // protection from petrification
             ~spwi113.spl~  ~override~ // protection from evil
             ~spwi114.spl~  ~override~ // shield
             ~spwi210.spl~  ~override~ // resist fear
             ~spwi311.spl~  ~override~ // protection from normal missiles
             ~spwi317.spl~  ~override~ // ghost armor
             ~spwi318.spl~  ~override~ // minor spell deflection
             ~spwi412.spl~  ~override~ // greater malison
             ~spwi414.spl~  ~override~ // spirit armor
             ~spwi511.spl~  ~override~ // protection from normal weapons
             ~spwi519.spl~  ~override~ // spell shield
             ~spwi522.spl~  ~override~ // minor spell turning
             ~spwi590.spl~  ~override~ // spell immunity: abjuration
             ~spwi591.spl~  ~override~ // spell immunity: conjuration
             ~spwi592.spl~  ~override~ // spell immunity: divination
             ~spwi593.spl~  ~override~ // spell immunity: enchantment
             ~spwi594.spl~  ~override~ // spell immunity: illusionist
             ~spwi595.spl~  ~override~ // spell immunity: invocation
             ~spwi596.spl~  ~override~ // spell immunity: necromancy
             ~spwi597.spl~  ~override~ // spell immunity: alteration
             ~spwi603.spl~  ~override~ // tenser’s transformation
             ~spwi606.spl~  ~override~ // protection from magic energy
             ~spwi607.spl~  ~override~ // mislead
             ~spwi609.spl~  ~override~ // true sight
             ~spwi611.spl~  ~override~ // protection from magic weapons
             ~spwi618.spl~  ~override~ // spell deflection
             ~spwi701.spl~  ~override~ // spell turning
             ~spwi702.spl~  ~override~ // proection from the elements
             ~spwi708.spl~  ~override~ // mantle
             ~spwi802.spl~  ~override~ // spell deflection
             ~spwi803.spl~  ~override~ // protection from energy
             ~spwi808.spl~  ~override~ // improved mantle
             ~spwi902.spl~  ~override~ // spell trap
             ~spwi907.spl~  ~override~ // absolute immunity
             ~spwi921.spl~  ~override~ // improved alacrity
             ~spcl900.spl~  ~override~ // whirlwind
             ~spcl901.spl~  ~override~ // greater whirlwind
 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // protects against invalid files
   SET "value" = 1
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spcl152" = 0) BEGIN // boon of lathander
     SET "stat"  = 2 // scriptingstate3
   END ELSE BEGIN
   PATCH_IF (("%SOURCE_RES%" STRING_COMPARE_CASE "spcl321" = 0) OR     // berserker enrage
             ("%SOURCE_RES%" STRING_COMPARE_CASE "spcl321d" = 0) OR    // berserker enrage cooldown
             ("%SOURCE_RES%" STRING_COMPARE_CASE "spcl741" = 0) OR     // barbarian rage
             ("%SOURCE_RES%" STRING_COMPARE_CASE "spin117" = 0)) BEGIN // Minsc’s Berserk
     SET "stat"  = 3 // scriptingstate4
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spcl144" = 0) BEGIN // kai
     SET "stat"  = 3 // scriptingstate4
     SET "value" = 2
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spin676" = 0) BEGIN // mazzy’s invoke courage
     SET "stat"  = 3 // scriptingstate4
     SET "value" = 3
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spcl900" = 0) BEGIN // whirlwhind
     SET "stat"  = 3 // scriptingstate4
     SET "value" = 4
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spcl901" = 0) BEGIN // greater whirlwind
     SET "stat"  = 3 // scriptingstate4
     SET "value" = 5
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "sppr202" = 0) BEGIN // barkskin
     SET "stat"  = 4 // scriptingstate5
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi114" = 0) BEGIN // wizard shield
     SET "stat"  = 4 // scriptingstate5
     SET "value" = 2
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi102" = 0) BEGIN // wizard armor
     SET "stat"  = 4 // scriptingstate5
     SET "value" = 3
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi317" = 0) BEGIN // wizard ghost armor
     SET "stat"  = 4 // scriptingstate5
     SET "value" = 4
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi414" = 0) BEGIN // wizard spirit armor
     SET "stat"  = 4 // scriptingstate5
     SET "value" = 5
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi318" = 0) BEGIN // wizard minor spell deflection
     SET "stat"  = 5 // wizard_spell_deflection
   END ELSE BEGIN
   PATCH_IF (("%SOURCE_RES%" STRING_COMPARE_CASE "spin710" = 0) OR     // spell deflection
             ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi618" = 0) OR     // wizard spell deflection
             ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi802" = 0)) BEGIN // wizard spell deflection
     SET "stat"  = 5 // wizard_spell_deflection
     SET "value" = 2
   END ELSE BEGIN
   PATCH_IF (("%SOURCE_RES%" STRING_COMPARE_CASE "spin920" = 0) OR     // beholder minor spell turning
             ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi522" = 0)) BEGIN // wizard minor spell turning
     SET "stat"  = 6 // wizard_spell_turning
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi701" = 0) BEGIN // wizard spell turning
     SET "stat"  = 6 // wizard_spell_turning
     SET "value" = 2
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi803" = 0) BEGIN // wizard protection from energy
     SET "stat"  = 7 // wizard_protection_from_energy
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi902" = 0) BEGIN // wizard spell trap
     SET "stat"  = 8 // wizard_spell_trap
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi921" = 0) BEGIN // wizard improved alacrity
     SET "stat"  = 9 // wizard_improved_alacrity
   END ELSE BEGIN
   PATCH_IF (("%SOURCE_RES%" STRING_COMPARE_CASE "spcl213" = 0) OR     // paladin protection from evil
             ("%SOURCE_RES%" STRING_COMPARE_CASE "spin121" = 0) OR     // innate protection from evil 
             ("%SOURCE_RES%" STRING_COMPARE_CASE "sppr107" = 0) OR     // cleric protection from evil
             ("%SOURCE_RES%" STRING_COMPARE_CASE "sppr408" = 0) OR     // cleric protection from evil 10’
             ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi113" = 0)) BEGIN // wizard protection from evil 
     SET "stat"  = 10 // protection_from_evil
   END ELSE BEGIN
   PATCH_IF (("%SOURCE_RES%" STRING_COMPARE_CASE "spcl232" = 0) OR     // inquisitor true sight
             ("%SOURCE_RES%" STRING_COMPARE_CASE "spcl732" = 0) OR     // helm true sight
             ("%SOURCE_RES%" STRING_COMPARE_CASE "sppr505" = 0) OR     // cleric true sight
             ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi609" = 0)) BEGIN // wizard true sight
     SET "stat"  = 11 // true_sight
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "sppr508" = 0) BEGIN // cleric chaotic commands
     SET "stat"  = 12 // cleric_chaotic_commands
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "sppr509" = 0) BEGIN // cleric magic resistance
     SET "stat"  = 13 // cleric_magic_resistance
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "sppr517" = 0) BEGIN // cleric insect plague
     SET "stat"  = 14 // cleric_insect_plague
   END ELSE BEGIN
   PATCH_IF (("%SOURCE_RES%" STRING_COMPARE_CASE "sppr603" = 0) OR     // cleric blade barrier
             ("%SOURCE_RES%" STRING_COMPARE_CASE "sppr698" = 0)) BEGIN // npc blade barrier
     SET "stat"  = 15 // cleric_blade_barrier
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "sppr613" = 0) BEGIN // cleric physical mirror
     SET "stat"  = 16 // cleric_physical_mirror
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "sppr701" = 0) BEGIN // cleric shield of the archons
     SET "stat"  = 17 // cleric_shield_of_the_archons
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "sppr711" = 0) BEGIN // cleric regeneration
     SET "stat"  = 18 // cleric_regeneration
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "sppr717" = 0) BEGIN // cleric creeping doom
     SET "stat"  = 19 // cleric_creeping_doom
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi108" = 0) BEGIN // wizard protection from petrification
     SET "stat"  = 20 // wizard_protection_from_petrification
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi519" = 0) BEGIN // wizard spell shield
     SET "stat"  = 21 // wizard_spell_shield
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi210" = 0) BEGIN // wizard resist fear
     SET "stat"  = 22 // wizard_resist_fear
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi311" = 0) BEGIN // wizard protection from normal missiles
     SET "stat"  = 23 // wizard_protection_from_normal_missiles
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi412" = 0) BEGIN // wizard greater malison
     SET "stat"  = 24 // wizard_greater_malison
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi511" = 0) BEGIN // wizard protection from normal weapons
     SET "stat"  = 25 // wizard_protection_from_normal_weapons
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi603" = 0) BEGIN // wizard tenser’s transformation
     SET "stat"  = 26 // wizard_tensers_transformation
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi606" = 0) BEGIN // wizard protection from magic energy
     SET "stat"  = 27 // wizard_protection_from_magic_energy
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi607" = 0) BEGIN // wizard mislead
     SET "stat"  = 28 // wizard_mislead
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi708" = 0) BEGIN // wizard mantle
     SET "stat"  = 29 // wizard_protection_from_magic_weapons
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi808" = 0) BEGIN // wizard improved mantle
     SET "stat"  = 29 // wizard_protection_from_magic_weapons
     SET "value" = 2
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi907" = 0) BEGIN // wizard absolute immunity
     SET "stat"  = 29 // wizard_protection_from_magic_weapons
     SET "value" = 3
   END ELSE BEGIN
   PATCH_IF (("%SOURCE_RES%" STRING_COMPARE_CASE "spin686" = 0) OR     // protection from magic weapons 
             ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi611" = 0)) BEGIN // wizard protection from magic weapons
     SET "stat"  = 29 // wizard_protection_from_magic_weapons
     SET "value" = 4
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi590" = 0) BEGIN // wizard spell immunity: abjuration
     SET "stat"  = 30 // wizard_spell_immunity abjuration
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi591" = 0) BEGIN // wizard spell immunity: conjuration
     SET "stat"  = 30 // wizard_spell_immunity
     SET "value" = 2  // conjuration
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi592" = 0) BEGIN // wizard spell immunity: divination
     SET "stat"  = 30 // wizard_spell_immunity
     SET "value" = 3  // divination
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi593" = 0) BEGIN // wizard spell immunity: enchantment
     SET "stat"  = 30 // wizard_spell_immunity
     SET "value" = 4  // enchantment
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi594" = 0) BEGIN // wizard spell immunity: illusionist
     SET "stat"  = 30 // wizard_spell_immunity
     SET "value" = 5  // illusionist
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi595" = 0) BEGIN // wizard spell immunity: invocation
     SET "stat"  = 30 // wizard_spell_immunity
     SET "value" = 6  // invocation
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi596" = 0) BEGIN // wizard spell immunity: necromancy
     SET "stat"  = 30 // wizard_spell_immunity
     SET "value" = 7  // necromancy
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi597" = 0) BEGIN // wizard spell immunity: alteration
     SET "stat"  = 30 // wizard_spell_immunity
     SET "value" = 8  // alteration
   END ELSE BEGIN
   PATCH_IF ("%SOURCE_RES%" STRING_COMPARE_CASE "spwi702" = 0) BEGIN // wizard protection from the elements
     SET "stat"  = 31 // wizard_protection_from_the_elements
   END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END END
   // though not obvious from the tabbing, those patch_ifs were all nested

   READ_LONG  0x64 "abil_off"
   READ_SHORT 0x68 "abil_num"
   READ_LONG  0x6a "fx_off"
   SET "loops" = 0
   SET "delta" = 0
   WHILE ("%loops%" < "%abil_num%") BEGIN
     READ_SHORT ("%abil_off%" + 0x1e + (0x28 * "%loops%")) "abil_fx_num"
     READ_SHORT ("%abil_off%" + 0x20 + (0x28 * "%loops%")) "abil_fx_idx"
     SET "abil_fx_idx" = ("%abil_fx_idx%" + "%delta%")
     WRITE_SHORT ("%abil_off%" + 0x20 + (0x28 * "%loops%")) "%abil_fx_idx%"
     SET "subloops" = "%abil_fx_num%"
     WHILE ("%subloops%" > 0) BEGIN
       SET "subloops" = ("%subloops%" - 1)
       READ_SHORT ("%fx_off%" +        (0x30 * ("%abil_fx_idx%" + "%subloops%"))) "opcode"
       READ_LONG  ("%fx_off%" + 0x0e + (0x30 * ("%abil_fx_idx%" + "%subloops%"))) "duration"
       PATCH_IF (("%duration%" > 5) AND ("%opcode%" = 142)) BEGIN // display portrait icon and duration greater than a round
         READ_BYTE  ("%fx_off%" + 0x0c + (0x30 * ("%abil_fx_idx%" + "%subloops%"))) "timing"
         READ_BYTE  ("%fx_off%" + 0x02 + (0x30 * ("%abil_fx_idx%" + "%subloops%"))) "target"
         READ_BYTE  ("%fx_off%" + 0x0d + (0x30 * ("%abil_fx_idx%" + "%subloops%"))) "bypass"
         SET "subloops" = 0 // kills WHILE loop so that the current values get passed to the INSERT
       END
     END
     INSERT_BYTES  ("%fx_off%" +        (0x30 * "%abil_fx_idx%")) 0x30
       WRITE_SHORT ("%fx_off%" +        (0x30 * "%abil_fx_idx%")) 282            // modify script state
       WRITE_BYTE  ("%fx_off%" + 0x02 + (0x30 * "%abil_fx_idx%")) "%target%"     // inherits target
       WRITE_BYTE  ("%fx_off%" + 0x03 + (0x30 * "%abil_fx_idx%")) 4              // power
       WRITE_LONG  ("%fx_off%" + 0x04 + (0x30 * "%abil_fx_idx%")) "%value%"      // value
       WRITE_LONG  ("%fx_off%" + 0x08 + (0x30 * "%abil_fx_idx%")) "%stat%"       // script state
       WRITE_BYTE  ("%fx_off%" + 0x0c + (0x30 * "%abil_fx_idx%")) "%timing%"     // inherits timing
       WRITE_BYTE  ("%fx_off%" + 0x0d + (0x30 * "%abil_fx_idx%")) "%bypass%"     // inherits dispel/MR
       WRITE_LONG  ("%fx_off%" + 0x0e + (0x30 * "%abil_fx_idx%")) "%duration%"   // inherits duration
       WRITE_BYTE  ("%fx_off%" + 0x12 + (0x30 * "%abil_fx_idx%")) 100            // probability
     SET "delta1" = 1
     SET "delta" = ("%delta%" + "%delta1%")
     WRITE_SHORT ("%abil_off%" + 0x1e + (0x28 * "%loops%")) ("%abil_fx_num%" + "%delta1%")
     SET "loops" = ("%loops%" + 1)
   END
 END

// scriptable spells
COPY_EXISTING ~SPCL232.spl~ ~override~
             ~SPCL412.spl~ ~override~
             ~SPCL414.spl~ ~override~
             ~SPCL621.spl~ ~override~
             ~SPCL721.spl~ ~override~
             ~SPCL722.spl~ ~override~
             ~SPCL731.spl~ ~override~
             ~SPCL732.spl~ ~override~
             ~SPCL741.spl~ ~override~
             ~SPCL742.spl~ ~override~
             ~SPCL910.spl~ ~override~
             ~SPCL911.spl~ ~override~
             ~SPCL912.spl~ ~override~
             ~SPCL923.spl~ ~override~
             ~SPIN696.spl~ ~override~
             ~SPIN697.spl~ ~override~
             ~SPIN698.spl~ ~override~
             ~SPIN891.spl~ ~override~
 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // protects against invalid files
   WRITE_LONG 0x34 1
 END
 BUT_ONLY_IF_IT_CHANGES

 

I think the END END ... END may be the best tp2 line I've had yet.

Link to comment

Archived

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

×
×
  • Create New...