Jump to content

Detectable Spells


SimDing0

Recommended Posts

Allow me to be the single voice of dissent. Whatever.

I'd like to know your reasoning. Just because something has been proposed and even coded doesn't mean opinions can't be changed. :bday:

 

Oh, for the record:

 

PATCH_IF (expression) BEGIN

  PatchList

END ELSE PATCH_IF (expression) BEGIN

  PatchList

END

 

... and so on.

I didn't know we could do that--looks like Wes gave us a pseudo way to do elsifs after all. Thanks!

Link to comment

For scriptable spells, you have to be careful. Setting all innates to level 1 causes funkiness (the one I remeber is that Odren's scroll wouldn't work, because somehow the SpellCastInnate() trigger was failing). The current list I use is:

COPY_EXISTING_REGEXP ~^SPCL\(232\|41[24]\|[67]2[12]\|7[34][12]\|91[012]\|923\)\.SPL$~ ~OVERRIDE~
~^SPIN\(69[678]\|891\)\.SPL$~ ~OVERRIDE~
 WRITE_LONG 0x34 0x01
BUT_ONLY_IF_IT_CHANGES

Link to comment
I'd like to know your reasoning. Just because something has been proposed and even coded doesn't mean opinions can't be changed. :)
I'm simply not convinced that there is a bug here that needs fixing. Maybe I'm misunderstanding the goals here, but it seems to me that detectable spells fall outside the scope of the project.

 

Scriptable spells are good: These spells should be able to be used, and it is a bug that, when used in conjunction with certain scripting commands, they can crash the game. So including these is a plus as, even if they never provide any tangible benefit to the user, they give more freedom in the methods that can be used to fix more visible scripting bugs here, and they also will prevent this bug occuring if additional mods are installed that either don't force the installation of scriptable spells, or mistakenly omit them altogether.

 

Detectable spells, however, seem to me to be slated for inclusion for no other reason than because you can. There is no bug in that you are unable to detect via script whether a player is under of the effects of a certain spell, and no possible benefit to including these in a fix pack. If the reason to include these is simply to make sure everyone has them so that modders have one less thing to take care of, then the focus of the project needs to shift from a pure fix pack to a combination fix pack/modder's foundation pack. Even then, it will be of little benefit, as the modder will still have to account for the possibility that a user may not want to install this fix pack. So it ends up being even more of a headache.

 

I guess what I'm looking for is a reason why including these would be beneficial, and how they fit in with the current scope of the project. Until then, it's a little difficult to provide a more compelling argument.

Link to comment

I'm not prepared to cater for users who won't install the fixpack. It's like making mods which explicitly support the unpatched game. Even if my mods do happen to work without it, I'll be fairly inclined to do a file check and abort the install with a warning.

 

Why do we include the SpellRES actions? Because it's helpful to provide certain fundamental facilities, and standardization is an important step towards mod compatibility.

Link to comment
For scriptable spells, you have to be careful. Setting all innates to level 1 causes funkiness (the one I remeber is that Odren's scroll wouldn't work, because somehow the SpellCastInnate() trigger was failing). The current list I use is:
COPY_EXISTING_REGEXP ~^SPCL\(232\|41[24]\|[67]2[12]\|7[34][12]\|91[012]\|923\)\.SPL$~ ~OVERRIDE~
~^SPIN\(69[678]\|891\)\.SPL$~ ~OVERRIDE~
 WRITE_LONG 0x34 0x01
BUT_ONLY_IF_IT_CHANGES

Yeah, this is the same list as the current scriptable spells.

 

Incidentally, it appears SCRIPTINGSTATE10 is already used in ToB. Does DS try to reassign it?

Yes, SCRIPTINGSTATE 6 through 10 keep the same values but have different symbolic names. And I was mistaken earlier in that I thought DS changes the STONESKINGOLEM and LEVELDRAIN values; these are the same with or without the package.

Link to comment

I've been of two minds on this issue and devSin's comments got me thinking, particularly on the issue of subjectivity.

 

The bits of BD that I passionately hate are the Twisted Rune "enhancements"--Koshi's scroll telling you to go see Shangalar and the changes there. One of the reasons why I feel BD has been elevated to the level of Damn-Near-Official-Patch was that KD was able to remove most of the subjectivity regarding his bugfixes by sticking to items that are strictly bugs or by being able to contact the developers. The TR changes are the largest example of divergence from this, and it shows. Poorly. Not having access to the developers in our bug/nonbug determination, I think we need to be very careful of including anything that could be deemed subjective.

 

Some subjectivity is unavoidable. For example, a character coded LG may clearly be the wrong alignment--but is NE/CE/etc. correct? I think Kish, and by extension Oversight, has a good handle on alignment determination. Sim mentioned that we already add the various SpellRES actions to an SoA install. This is also something I don't mind including, as I justify it as porting expanded ToB functionality back to SoA. In one case a missing trigger means that you can not decompile an SoA script without ToB, which I consider a bug. (I readily concede extending that justification to all the ToB triggers and actions is a stretch, but one with which I'm comfortable.) I'm a little more iffy on, say, the addition of umpteen new entries in gtimes.ids but this seemed to be welcomed by most so in it went. One of the key roles we all play is in the determination of bug/nonbug, which is probably the most important subjective decision we have to make.

 

With this in mind, I think that scriptable spells should be included as it is, IMO, a bugfix for the same reasons devSin mentions. However, I have reversed course on DS--I think we should farm this back to Cierrek and individual modders.

Link to comment
the Twisted Rune "enhancements"
I think the reason this was so bad was not necessarily because it wasn't a bug, but because it made no sense at all. BioWare left in very little (I suspect they actually only worked on this a little, and what we see is all they did for it), so there wasn't really anything to restore. As somebody who passionately hates Baldurdash these days, I agree with you that this one was particularly bad.

 

addition of umpteen new entries in gtimes.ids
I said don't put 'em in, too. I didn't know about igi's site when I did these, so the only reason I had all those in was because I finally decided to figure out the game time -> real time formula. I was excited. Don't tell anyone. :p

 

One day, I'm going to make a fixpack my way, which will just include SO many undocumented changes and things being passed off as fixes when they're not really.
I already did that. It's not as cool as it sounds. You could put your name on it and see if it gets the response you expect, I guess. Nothing is documented, I promise. :)

 

You don't think it'd be better for everybody to use the same copy of Detectable Spells
I think a uniform Detectable Spells is definitely desirable (I'll even volunteer Cam to code it :p), but I'd rather the package remain separate. It's something that should be standard everywhere, and should replace the current distribution.

 

That said, not only does it fall outside of the scope of a fix pack, including it here will only introduce yet-another variation, and I don't see that as being beneficial to this project or any other.

 

rather than the RTW team distributing one from 1982?
I don't see how including Detectable Spells in *your* mod is going to make them update the version in *their* mod.
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.

 

 

Where's Spell Trap?

Link to comment

Archived

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

×
×
  • Create New...