Jump to content

Dispel magic behavior (BG2)


Recommended Posts

I guess we should have some consensus between the BG1 and BG2 Fixpacks. My view is that Dispel Magic wasn't intended to remove all spell weapon effects (like Flame Blade) at 100% probability. This was probably just the developer tool default and wasn't checked too heavily. The description says the base chance for dispel is 50%, and varies based on differences between caster levels. But it is never 100%; there is always a chance of failure. Since we can't implement a level check on the weapon removals, we can leave it at the base chance.

 

The other option is to correct the descriptions so it says the spell removes all magically-created weapons at 100%. A rather lame option if you ask me. No action is not an option :).

 

Not sure about the CRE below - it might be unused, but I fixed it anyway.

BEGIN ~Dispel Fixer~
//Correct and copy Flame Blade
COPY_EXISTING ~FBLADE.ITM~ ~override~
 WRITE_BYTE 0x1c 0x14 //Item type (small sword > large sword; 3' long per desc)
 WRITE_BYTE 0x31 0x5f //Proficiency (longsword > scimitar per description)
BUT_ONLY_IF_IT_CHANGES
COPY_EXISTING ~FBLADE.ITM~ ~override/fblade1.itm~

//Correct CREs and assign undispellable Flame Blade
COPY_EXISTING ~SAHBEH03.CRE~ ~override~ //Sziltar's Apparition
 WRITE_BYTE 0x272 0x85 //Race (spectre; it's not human whatever it is)
 WRITE_BYTE 0x273 0xab //Class (spectre, was no class)
 WRITE_ASCII 0x2cc ~SAHBEH01~ #8 //Dialog (dunno about this, but SAHBEH03 doesn't exist)
 REPLACE_CRE_ITEM ~FBLADE1~ #0 #0 #0 ~UNSTEALABLE~ ~WEAPON1~ EQUIP
BUT_ONLY_IF_IT_CHANGES

//Correct Dispel Magic
COPY_EXISTING ~spcl231.spl~ ~override~
		  ~spin112.spl~ ~override~
		  ~spin703.spl~ ~override~
		  ~spin866.spl~ ~override~
		  ~sppr303.spl~ ~override~
		  ~spwi302.spl~ ~override~
		  ~spwi326.spl~ ~override~
		  ~sw2h10dm.spl~ ~override~
 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN
READ_LONG  0x64 hf //Header offset
READ_SHORT 0x68 hc //Header count
READ_LONG  0x6a ff //Effect offset
FOR (i1 = 0x0; i1 < (hc * 0x28); i1 += 0x28) BEGIN
  READ_SHORT (hf + i1 + 0x1e) nf //Number of effects
  READ_SHORT (hf + i1 + 0x20) tf //Index of effects
  FOR (i2 = (tf * 0x30); i2 < ((tf + nf) * 0x30); i2 += 0x30) BEGIN
	READ_SHORT (ff + i2) pc //Opcode
	READ_LONG (ff + i2 + 0x8) t1 //Ignore level
	READ_BYTE (ff + i2 + 0x12) p1 //Probability 1
	PATCH_IF ((pc = 58) AND (t1 = 0)) THEN BEGIN
	  WRITE_LONG (ff + i2 + 0x8) 1 //Use caster's level
	END
	PATCH_IF (((pc = 112) OR (pc = 177)) AND (p1 = 100)) THEN BEGIN
	  WRITE_BYTE (ff + i2 + 0x12) 50 //Chance to dispel spelled weapons
	END
  END
END
 END
BUT_ONLY_IF_IT_CHANGES

Link to comment

For the BG2 engine at least, my solution was to rip out all of the item removal effects (they're at best redundant, the dispel opcode does this already - at worst they dispel when the dispel should have failed).

 

I don't know that the BG1 engine works quite the same here.

Link to comment
For the BG2 engine at least, my solution was to rip out all of the item removal effects (they're at best redundant, the dispel opcode does this already - at worst they dispel when the dispel should have failed).
If that's truly the case, then yes, let's get rid of the cruft. I'd like to think there's some good reason they added all these specific items in BG1 *and then* tacked even more of them on in the BG2 engine, but perhaps not.

 

Where is this "my solution" stuff anyway - is there a Nythrun Fixpack somewhere? :)

Link to comment

Like all true visionaries (i.e., me), Nythrun maintains her own collection of personal fixes and tweaks. :D

 

She's just better at passing stuff along once she's done.

 

She's correct that the dispel opcode will already remove all magically-created weapons when it's supposed to. But I'm still not terribly hot about changing it at this point.

Link to comment

Illusionary creatures need to be handled specifically, yes. Illusionary effects just get dispelled when the dispel is successful (assuming they're dispellable).

 

Feeblemind probably gets dispelled, but it's better to play it safe and have it insta-cure and clean up the icon.

Link to comment

It's probably best that Dispel Magic have some chance of failing, even if relative caster level can't be taken into account for summoned weapons.

 

On the other hand, things like a ghoul's hand couls also be dispelled, couldn't they? That shouldn't be doable, if it can be avoided.

Link to comment

Real ghoul hands are copied to another weapon (ghoul1.itm) so they shouldn't be affected. Plus, they're wielded in a normal weapon slot, not the magic weapon slot.

 

I did some more testing here in both engines (BG1 and BG2/Tutu). In neither one does a generic dispel magic (with the remove item flags stripped out) remove magically created weapons like Flame Blade and Ghoul Touch, unless they're in the magic weapon slot (i.e., spell-created). In both BG1 and BG2, a successful Dispel Magic does seem to destroy whatever's in the magic weapon slot. I think the extra weapon removals were just put in there as a sloppy stopgap measure. As Nythrun says, they should not be necessary, and moreover, an unsuccessful dispel will remove them, making some rather wimpy spells even wimpier.

 

A generic Dispel Magic (without a specific feeblemind-removal flag) will remove both the feebleminded state and icon, in both BG1 and BG2. However, Feeblemind, if not successful, will still add an enfeebled icon to the character's portrait. Though I didn't check if this was fixed in the Fixpack, or even fixable. Maybe that's why Dispel Magic has the remove feeble state/icon effect - more sloppiness if you ask me. So, probably more redundant cruft we can easily dispense with.

Link to comment
Or maybe they wanted Dispel Magic to be a ready, permanent cure for Feeblemind. The same with clone destruction.
Nowhere is that stated in the description, not at 100%. To repeat myself once again, it says it always has a chance for failure.
Don't be so quick to proclaim things we can dispense with, easily or not.
Bah. Delete first, ask questions later. :)
Link to comment
For the BG2 engine at least, my solution was to rip out all of the item removal effects (they're at best redundant, the dispel opcode does this already - at worst they dispel when the dispel should have failed).
So what I gathered from this is that the dispel opcode automatically destroys spell-created items like sgrasp, chillt, fblade, etc.

 

Suppose I'm making a new spell that is a mod of another; for example, Freezing Grasp based on Shocking Grasp. And that creates an special item based on the caster's level for the spell.

 

I take it the dispel opcode would not automatically get rid of those as it would sgrasp etc.? So I'd have to add all 20 fgrasp items to all variations of dispel magic spells? :p

Link to comment

If you want them to always dispel (regardless of whether the dispel was successful or not). Otherwise, there's no need to alter the spell (if a magical weapon is granted via the same effect as shocking grasp or whatever, it should get cleaned up on successful dispel automatically).

Link to comment

Quick notes before this gets relegated to No Action:

  • Of all the Remove Item opcodes in Dispel Magic, only two are notable. It cleans up fblade.itm, which is wielded by the (unused) sahbeh02.cre, and stardart.itm, the darts created by the Cloak of the Stars. Outside of stardart.itm they're all redundant; however they have no effect in the game regardless because the items can not be created outside of spells (and hence in the always-dispelled magical weapon slot).
  • All of Feeblemind's effects have the same saves and MR checks, so unless there's some hardcoded funk in the feeblemind opcode it's not possible to get the icon without the actual effect.

Link to comment
however they have no effect in the game regardless because the items can not be created outside of spells (and hence in the always-dispelled magical weapon slot).
I think this last (bolded) bit was the objectionable part originally - spell-created weapons should not get dispelled by an unsuccessful dispel.

 

Nythrun said she fixed this locally by stripping the flags out, so perhaps her code is more solid than mine. Though I've also been using mine without noticing any weirdness yet. Or are you saying an unsuccessful Dispel will remove spell-created weapons even without the specific flags? I would think my testing and Nythrun's argued against that but I can't really remember at this point. On reading it again, I do know that a successful Dispel did destroy spell-created items without the specific weapon removal flags - not sure if I tested the reverse.

 

This is more of a major bug in BG1/Tutu (and I suppose BGT by that extension unless Ascension64's fixed it) since we have helmed/battle horrors with fblade.itm that can get whacked with even an unsuccessful Dispel and be rendered pretty powerless.

Link to comment

Archived

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

×
×
  • Create New...