orbit Posted November 19, 2012 Share Posted November 19, 2012 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? Link to comment
orbit Posted November 19, 2012 Author Share Posted November 19, 2012 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
DavidW Posted November 19, 2012 Share Posted November 19, 2012 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. Link to comment
orbit Posted November 20, 2012 Author Share Posted November 20, 2012 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
DavidW Posted November 20, 2012 Share Posted November 20, 2012 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
orbit Posted November 20, 2012 Author Share Posted November 20, 2012 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
orbit Posted November 20, 2012 Author Share Posted November 20, 2012 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
HerrSvensson Posted January 22, 2013 Share Posted January 22, 2013 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.