Jump to content
Sign in to follow this  
orbit

How to detect an enemy's "True Sight" spell?

Recommended Posts

How can I detect an enemy's true sight spell through scripting?

 

CheckStatGT(LastSeenBy(Myself),0,SEEINVISIBLE)

 

This doesn't seem to work with true sight spells. How can I do it?

Share this post


Link to post

Why doesn't this work?

 

 

// Detect True Sight
IF
 ActionListEmpty()
 Global("GBBackStab","LOCALS",1)
 OR(2)
   See(NearestEnemyOfType([0.0.0.CLERIC_ALL.0.0.0]))
   See(NearestEnemyOfType([0.0.0.MAGE_ALL.0.0.0]))
 OR(2)
   SpellCast(LastSeenBy(Myself), CLERIC_TRUE_SIGHT)
   SpellCast(LastSeenBy(Myself), WIZARD_TRUE_SIGHT)
 CheckStatGT(Myself,1,BACKSTABDAMAGEMULTIPLIER)
THEN
   RESPONSE #100
   SetGlobalTimer("TempDisableInvis","LOCALS",45)
   SetGlobal("DisableInvis","LOCALS",1)
   DisplayStringHead(Myself,12096)
END
IF
 ActionListEmpty()
 Global("GBBackStab","LOCALS",1)
 Global("DisableInvis","LOCALS",1)
 GlobalTimerExpired("TempDisableInvis","LOCALS")
 CheckStatGT(Myself,1,BACKSTABDAMAGEMULTIPLIER)
THEN
   RESPONSE #100
   SetGlobal("DisableInvis","LOCALS",0)
   DisplayStringHead(Myself,27984)
END

Edited by orbit

Share this post


Link to post

It fails if (e.g.) the enemy cleric who just cast truesight is not the closest enemy spellcaster to you, or if you're doing something else (so your ActionList is not Empty()) during the script round when the truesight is cast.

Share this post


Link to post

This works:

 

// Detect True Sight, disable Invisibility Spells
IF
Global("DisableInvis","LOCALS",0)
!GlobalTimerNotExpired("TempDisableInvis","LOCALS")
OR(2)
  SpellCast([EVILCUTOFF],WIZARD_TRUE_SIGHT)
  SpellCastPriest([EVILCUTOFF],CLERIC_TRUE_SIGHT)
THEN
 RESPONSE #100
    SetGlobalTimer("TempDisableInvis","LOCALS",18)
    SetGlobal("DisableInvis","LOCALS",1)
    DisplayStringHead(Myself,12096)
END
// Reenable Invisibility Spells after Timer expired
IF
Global("DisableInvis","LOCALS",1)
GlobalTimerExpired("TempDisableInvis","LOCALS")
THEN
 RESPONSE #100
    SetGlobal("DisableInvis","LOCALS",0)
    DisplayStringHead(Myself,27984)
END

 

 

However, in case the enemy mage/priest dies, the timer is still running. How can I determine if the one who cast the "True Sight" spell is dead?

Edited by orbit

Share this post


Link to post

This really isn't a good way of doing what you want. Get Detectable Spells (bundled with, e.g., SCS), and then check the nearest half-dozen enemies with a !CheckStatGT(XthNearestEnemyOf(Myself),0,TRUESIGHT) [or whatever, this is from memory] before casting an invisibility spell.What you have is going to be very clunky and brittle (what if TrueSight is dispelled?)

Share this post


Link to post

Yes it's very clunky, however my goal is to make an universal script that doesn't need any additional modification. A script for vanilla bg2/Tob.

 

This is the only way I could think of as a solution.

 

 

... (what if TrueSight is dispelled?)

 

Dispelled or Dead, thats the problem here. Maybe I'll figure it out at some point.

Edited by orbit

Share this post


Link to post

Interestingly, the "CLERIC_TRUE_SIGHT" spell triggers SpellCastPriest() with each "True Sight" burst, which means I could perfectly time it.

 

That only leaves me with "WIZARD_TRUE_SIGHT". Maybe I can figure out something with !See(LastSeenBy(Myself)) or similar...

Share this post


Link to post

Here is an old script of mine I know works for checking if TRUE_SIGHT is active for my inquisitor. I had Detectable spells installed.

 

// True sight in combat
IF
ActionListEmpty()
!GlobalTimerNotExpired("BUSY_MAGIC", "LOCALS")
OR(3)
 Detect([ENEMY.0.0.BARD_ALL])
 Detect([ENEMY.0.0.MAGE_ALL])
 Detect([ENEMY.0.0.THIEF_ALL])
CheckStat(Myself, 0, 167)   // TRUE_SIGHT
HaveSpell(4232) // INQUIS_TRUE_SIGHT
THEN
RESPONSE #100
 Spell(Myself, 4232)
 SetGlobalTimer("BUSY_MAGIC", "LOCALS", 6)
END

Share this post


Link to post
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...