Jump to content

Detectable spells (again)


DavidW

Recommended Posts

David, I just discovered a small bug in Detectable Spells. It appears that the wizard version of the True Sight spell erroneously sets the TRUE_SIGHT stat for its targets instead of merely for the caster. The error seems to come from SPPR950.SPL which SPWI609.SPL calls. For a practical demonstration of the problem, assign the following script to an opponent and place him near a fully unbuffed party:

 

 

IF
!GlobalTimerNotExpired("RR#Cast","LOCALS")
!CheckStatGT(Myself,0,TRUE_SIGHT)
THEN
RESPONSE #100
	SetGlobalTimer("RR#Cast","LOCALS",6)
	SpellNoDec(Myself,WIZARD_TRUE_SIGHT)
END

IF
!GlobalTimerNotExpired("RR#Cast","LOCALS")
See([GOODCUTOFF])
CheckStatGT(LastSeenBy(Myself),0,TRUE_SIGHT)
THEN
RESPONSE #100
	SetGlobalTimer("RR#Cast","LOCALS",6)
	SpellNoDec(LastSeenBy(Myself),WIZARD_DISPEL_MAGIC)
END

 

As you can see, the opponent erroneously thinks that the nearest party member is under the effects of True Sight which is actually not true. My temporary workaround is to simply use CLERIC_TRUE_SIGHT which doesn't seem to cause this problem.

Link to comment

As an aside, detecting (Minor) Globe of Invulnerability is one of several places where a scripting state dedicated to spell level immunity is particularly helpful (and then Minor Globe scripting blocks checkstat MINORGLOBE as well as SpellLevelImmunity GT2 LT4).

Link to comment

I have a small request for the future versions of Detectable Spells: could Mantle, Improved Mantle and Absolute Immunity modify the WIZARD_PROTECTION_FROM_NORMAL_WEAPONS stat to a non-zero value?

 

It feels kind of unnecessary to include three additional checks for these spells in cases where the primary concern would be: is my target immune to normal weapons?

Link to comment
Guest MoonElf
David, I just discovered a small bug in Detectable Spells. It appears that the wizard version of the True Sight spell erroneously sets the TRUE_SIGHT stat for its targets instead of merely for the caster. The error seems to come from SPPR950.SPL which SPWI609.SPL calls. For a practical demonstration of the problem, assign the following script to an opponent and place him near a fully unbuffed party:

 

 

IF
!GlobalTimerNotExpired("RR#Cast","LOCALS")
!CheckStatGT(Myself,0,TRUE_SIGHT)
THEN
RESPONSE #100
	SetGlobalTimer("RR#Cast","LOCALS",6)
	SpellNoDec(Myself,WIZARD_TRUE_SIGHT)
END

IF
!GlobalTimerNotExpired("RR#Cast","LOCALS")
See([GOODCUTOFF])
CheckStatGT(LastSeenBy(Myself),0,TRUE_SIGHT)
THEN
RESPONSE #100
	SetGlobalTimer("RR#Cast","LOCALS",6)
	SpellNoDec(LastSeenBy(Myself),WIZARD_DISPEL_MAGIC)
END

 

As you can see, the opponent erroneously thinks that the nearest party member is under the effects of True Sight which is actually not true. My temporary workaround is to simply use CLERIC_TRUE_SIGHT which doesn't seem to cause this problem.

 

I can't believe this bug is still around, I had thought it would be fixed. I noticed this bug myself some time ago in ascension and I think it was fixed for ascension itself but i guess other mods that used detectable spells didn't use the fix. http://forums.pocketplane.net/index.php/topic,17679.0.html

 

It is actually more disruptive than it would appear at first glance, if i remember correctly the scripting state changes made are permanent, and you can end up with a large amount of unnesesary effects attacthed to your character by the end of the game. In terms of its affect on the AI, any creature that is scripted to hold off casting illusions while their enemies are in true sight mode will actually never use those illusion spells. A good example is the Irenicus script in the final battle of ascension, that fails to cast project image, and this unfortunately removes one of the coolest and most challenging parts of that first fight. It is interesting though, that in my first run through ascension, which I think might have been the old non weidu package this problem didn't arise. Thats infact how I noticed the bug, I was looking foward to the Irenicus fight the whole game and was severly let down.

 

I hope that this will be fixed promptly and perhaps some way to ensure that older mods that are using the bugged version will be overriden could also be included. I was just preparing to have another run through BG2 with various mods installed but I think i'll hold off till this is in the clear. Any feedback about fixing this bug would be appreciated.

Link to comment

I've updated the version of Detectable Spells posted on this thread. The new version makes the following changes:

 

(a) changes to the core macro:

(i) a new run-once-only component strips out any old version of DS (such as the one you get if you install Ascension)

(ii) a couple of under-the-hood changes to sort out some bugs that might occur if you installed two copies of this version of DS.

 

(b) changes to the cddetect.2da list of spells: remove SPPR950, thus fixing the True Sight bug listed earlier.

 

© new macro shipped with Detectable Spells: this one converts any script on a pre-included list from the Ascension version of DS to this version. At the moment, that pre-included list includes everything in Ascension and Kelsey.

Link to comment

Thanks David!

 

Did this little bit make it into the latest release per chance?

 

I have a small request for the future versions of Detectable Spells: could Mantle, Improved Mantle and Absolute Immunity modify the WIZARD_PROTECTION_FROM_NORMAL_WEAPONS stat to a non-zero value?

 

BTW, it seems that you've accidentally uploaded the new DS archive with a full BACKUP folder.

Link to comment
Thanks David!

 

Did this little bit make it into the latest release per chance?

 

I have a small request for the future versions of Detectable Spells: could Mantle, Improved Mantle and Absolute Immunity modify the WIZARD_PROTECTION_FROM_NORMAL_WEAPONS stat to a non-zero value?

 

It didn't - sorry, I meant to comment on this.

 

My reason for not doing so was basically two-fold. It's partly that it makes it fiddly to detect the Protection from Normal Weapons spell unambiguously. That's not decisive (it can be worked around) but there's a kind of general DS principle, rightly or wrongly, to make individual spells, as opposed to effects of spells, as straightforwardly detectable as possible. But mostly it's conservatism: pretty much any DS-using mod uses roughly the current arrangement, and I'd rather minimise confusion.

 

... judgement call, I accept.

 

BTW, it seems that you've accidentally uploaded the new DS archive with a full BACKUP folder.

 

Oops, will fix. Thanks.

Link to comment
but there's a kind of general DS principle, rightly or wrongly, to make individual spells, as opposed to effects of spells, as straightforwardly detectable as possible.

 

Note that even the current version of DS sometimes uses a single stat for marking multiple spells (i.e. SCRIPTINGSTATE4). That's why I don't think that setting the WIZARD_PROTECTION_FROM_NORMAL_WEAPONS to (say) 3 in case of Mantle... etc. would neceserilly mess things up. As it stands right now, in order to check whether an opponent is protected from normal weapons, we have to use this block:

 

!CheckStatGT([GOODCUTOFF],0,WIZARD_PROTECTION_FROM_NORMAL_WEAPONS)  // not protected from normal weapons
!CheckStat([GOODCUTOFF],1,WIZARD_PROTECTION_FROM_MAGIC_WEAPONS)  // not under the effects of Mantle
!CheckStat([GOODCUTOFF],2,WIZARD_PROTECTION_FROM_MAGIC_WEAPONS)  // not under the effects of Improved Mantle
!CheckStat([GOODCUTOFF],3,PROTECTION_FROM_MAGIC_WEAPONS)  // not under the effects of Absolute Immunity

 

Now, if we'd set WIZARD_PROTECTION_FROM_NORMAL_WEAPONS straight from Mantle and the like we could go with just this:

 

!CheckStatGT([GOODCUTOFF],0,WIZARD_PROTECTION_FROM_NORMAL_WEAPONS)  // not protected from normal weapons

 

Isn't that much more efficient?

Link to comment

When the Enrage (SPCL321) expires it can't be used again for 30 seconds (SPCL321D). But character with CheckStat(Myself,0,SCRIPTINGSTATE4) in a script will try to recast it immediately after the first Enrage wears off.

 

So I think that the SPCL321D should have some scripting state too.

 

Tenser's Transformation has two scripting states, SCRIPTINGSTATE4 and WIZARD_TENSERS_TRANSFORMATION. One should be enough.

Link to comment

Okay... look, for lots of reasons (but mostly time) I don't want to sleepwalk into being Guardian of Detectable Spells! So I reply with some trepidation, but...

 

@Razfallow: The package I wrote is customisable so that if someone wants to add a state to (say) SPCL321D they can do so without damaging other mods that use the same DS package. (Obviously it gets a bit more complicated if there isn't a scripting state free - but you could set SCRIPTINGSTATE4 to 13 or some other high number.)

 

@Avenger: okay, sounds reasonable: your suggestion probably is more efficient. But I'm not convinced it's worth changing on the conservativeness grounds I was talking about earlier. Within reason, efficiency or lack thereof isn't going to make much difference to how fast the script goes.

(But to be fair, I'm used to coding in SSL, which is much more automated than BAF, so perhaps I'm underestimating the nuisance factor.)

Link to comment
Within reason, efficiency or lack thereof isn't going to make much difference to how fast the script goes.

 

Well, if you use a lot of targeting blocks in a script which depends on checking for protection from normal weapons (in some RR scripts I have about 30-40) using a single check instead of four separate checks definitively reduces the script size and the execution time by a small margin.

 

Since most SCS II scripts have even more targeting blocks than that, I think this would be useful to you as well. :thumbsup:

Link to comment

Archived

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

×
×
  • Create New...