Jump to content

Detecting if a party member is casting and/or going to cast a spell?


suy

Recommended Posts

Is it possible to detect if a party member is casting and/or going to cast a spell on `Myself`? Or alternatively if is casting anything, or doing anything.

Basically, I want to avoid calling `Hide()` via the user AI script, by checking before if a party member is buffing/healing on `Myself`. If I'm unlucky, the combat might have stopped, and I'm proceeding to heal or buff a specific party member. If that party member has the script to hide constantly, it might turn invisible, and ruin the spell.

If needed, I can check on something else, like a list of actions, for all the PlayerX, but I don't see such thing either.

This is more or less the block that I use so far to hide:

IF
    Global("suy#fight","LOCALS",0)
    Global("suy#mode","LOCALS",1)
    ActionListEmpty()
    !GlobalTimerNotExpired("suy#hide","LOCALS")   
    OR(3)
        Class(Myself,THIEF_ALL)
        Class(Myself,RANGER_ALL)
        Class(Myself,MONK)
    !ModalState(DETECTTRAPS)
    !ModalState(STEALTH)
    !ModalState(TURNUNDEAD)
    !ModalState(BATTLESONG)
THEN
    RESPONSE #100
        SetGlobalTimer("suy#hide","LOCALS",ONE_ROUND)
        Hide()
END

Then I tried to add ObjectActionListEmpty(...) on all of Player1, Player2, etc., but still did not work, and it worked, but it's a bit too broad. Something more specific would be nice.

Some other idea?

Thank you.

Edited by suy
Amended after I've found ObjectActionListEmpty
Link to comment

Your options are three: 1) ObjectActionListEmpty, 2) patch all spells with global effects that put a spell state or, better, a unique combination of rare spell states on the caster, lasting in proportion to the casting time - casting time 9 is 6 seconds, and check for those on all party members, but you might get some false alarms there, because the caster might take off and not finish the spell but this script will still prevent hiding; 3) put up with that extravagant possibility of failure and move on to something else. Because you really expect too much from Infinity Engine scripting, if you want to cover such slim eventualities. Nor would that be a disaster if someone did, in fact, lose a spell... once in a blue moon.

Link to comment

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.

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.

×
×
  • Create New...