Jump to content

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


orbit

Recommended Posts

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

Link to comment

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?

Link to comment

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?)

Link to comment

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.

Link to comment

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...

Link to comment

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

Link to comment

Archived

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

×
×
  • Create New...