Gamemacik Posted April 2, 2021 Share Posted April 2, 2021 (edited) A lot of scripts use Detect() with combination of objects eg. NearestEnemyOf(Myself), but Detect won't detect if enemy is fully invisible somehow. It works with with EA eg. ANYONE, GOODCUTOFF, EVILCUTOFF Priest18.BCS IF Detect(NearestEnemyOf(Myself)) !See(NearestEnemyOf(Myself)) HaveSpell(CLERIC_TRUE_SIGHT) // SPPR505.SPL (True Seeing) THEN RESPONSE #100 Spell(NearestEnemyOf(Myself),CLERIC_TRUE_SIGHT) // SPPR505.SPL (True Seeing) END Second script works (for nearest GOODCUTOFF invisible/improved invisibility target only) IF ActionListEmpty() Allegiance(Myself,ENEMY) Detect([GOODCUTOFF]) OR(3) !See(LastSeenBy(Myself)) StateCheck(LastSeenBy(Myself),STATE_INVISIBLE) StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY) HaveSpell(CLERIC_TRUE_SIGHT) // SPPR505.SPL (True Seeing) THEN RESPONSE #100 Spell(Myself,CLERIC_TRUE_SIGHT) // SPPR505.SPL (True Seeing) END Edited April 2, 2021 by Gamemacik Quote Link to comment
lynx Posted April 2, 2021 Share Posted April 2, 2021 So what did you try? You have non-trivial code there, so it's not clear that the problem is where you say it is. Eg. does this block also result in a cast when in your special invisibility state? IF Detect(NearestEnemyOf(Myself)) HaveSpell(CLERIC_TRUE_SIGHT) // SPPR505.SPL (True Seeing) THEN RESPONSE #100 Spell(NearestEnemyOf(Myself),CLERIC_TRUE_SIGHT) // SPPR505.SPL (True Seeing) END And are you sure NearestEnemyOf(Myself) is matching and matching who you expect? Quote Link to comment
Gamemacik Posted April 3, 2021 Author Share Posted April 3, 2021 (edited) 16 hours ago, lynx said: IF Detect(NearestEnemyOf(Myself)) HaveSpell(CLERIC_TRUE_SIGHT) // SPPR505.SPL (True Seeing) THEN RESPONSE #100 Spell(NearestEnemyOf(Myself),CLERIC_TRUE_SIGHT) // SPPR505.SPL (True Seeing) END I would not post untested code, i tested also this code (above) of course, i tested it today again, I spawned enemy orc shaman with this code attached to class script, tested with override script also, shaman just stand and does nothing. I tried also code without HaveSpell and with ForceSpell, result is same also. Shaman had only one script attached to avoid possible script conflicts, from my testing result is same as posted in my first post above. IF Detect(NearestEnemyOf(Myself)) THEN RESPONSE #100 ForceSpell(NearestEnemyOf(Myself),CLERIC_TRUE_SIGHT) // SPPR505.SPL (True Seeing) END Edited April 3, 2021 by Gamemacik Quote Link to comment
lynx Posted April 4, 2021 Share Posted April 4, 2021 For a more bulletproof test you'd have to use a message or ReallyForceSpell, but I doubt you'd get much different results. I still think your corner case is a problem in matching, not Detect though. And with the last two tests that could be in the action body as well. Quote Link to comment
Bubb Posted April 5, 2021 Share Posted April 5, 2021 (edited) To be clear, Detect() has no problem detecting invisible creatures, as evidenced by it working "correctly" when using object selectors, (eg. [ANYONE]). NearestEnemyOf(), however, will not match an invisible creature unless the caller is under op193 (Invisible Detection by Script). I suspect this is true for all/most of the Nearest objects. Edited April 5, 2021 by Bubb Quote Link to comment
kjeron Posted April 5, 2021 Share Posted April 5, 2021 @Bubb I may be remembering wrong, but: Isn't it only the 0x0### triggers that allow object selectors to include invisible objects (as well as a few other normally undetectable conditions). While the 0x4### triggers as well as all actions do not allow object selectors to include invisible objects without op193. Then their's ActionOverride(), which allows it's object specifier to include the active creature. Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.