Jump to content

opcode 232 contingency condition "attacked" - how/when does it trigger?


Recommended Posts

I am looking at trying to make my shield bash feat more streamlined and reliable, it is acting a bit flaky right now. It is a once/round spell effect affecting a nearby attacker, and for the sake of efficiency I would like it to only fire when actually in combat.

I was thinking possible having one contingency check for the AttackedBy([ANYONE]) condition, setting a spellstate to signify you are being attacked; and then a second CheckSpellState(Myself,[spellstate]) condition to actually initiate the effects.

The CheckSpellState contingency is checked once epr round which is perfect; but the AttackedBy() condition says this in the IESDP:

 AttackedBy([ANYONE]) — Checked every time

Does anyone know what that means? In particular:

  • Does it return true only at the very beginning of combat? For purposes of setting the spellstate, that would mean I need to use a lengthy duration to make sure it stays true as long as combat is happening.
  • Does it only fire when someone attacks me? What if someone attacks another party member? (In my current game it seemed to be triggering whenever any kind of combat began... but it wasn't entirely clear to me what was happening.)
Link to comment

It's triggered by the same mechanics as the script trigger, for the character with the effect.  This includes every time an attack is performed against that character.  Attacks are counted according to red pixels in the attackers "RNDBASE#.BMP" file - cosmetic attacks do not count, fake attacks used to round out 1/2 APR values do count.

Most ranged attacks will trigger it twice, once when the attack is initiated, and again when(if) it damages them.  Melee attacks only trigger once because both events occur simultaneously.  An instantaneous ranged attack would similarly trigger it only once.

Link to comment

Okay got it. So I could do something like: while a shield is equipped -

  • contingency(AttackedBy):
  • ... 1) cast subspell1A, which applies a spellstate more or less permanently
  • contingency(CheckSpellState): do the following each round:
  • ... 1) cast subspell2A, which checks for specialization in sword'n'shield style
  • ... 2) 2A casts subspell2B, which has a small AoE projectile with the single-target flag and applies damage/sleep/wing buffet
  • ... 3) 2A also casts subspell2C, which op321 cancels subspell1A to remove the spellstate, but has the non-combat flag

So when you are attacked, the 2nd contingency will kick in and you will bash the nearest enemy once per round; but when combat is over the spellstate will disappear and the game will stop auto-casting the subspells. Next time you are attacked, the spellstate will be applied again and, etc.

Theoretically.

If that works it would be a lot cleaner than the method I have in place now.

Edited by subtledoctor
Link to comment

In addition to weapon attacks, I'm pretty sure that spells which either have the "hostile" flag or deal damage also trigger it; they certainly make NPCs get mad at you, and that's the script trigger. Some conditions like stun also set off "attacked". The spell has to actually hit, though it doesn't have to actually cause any effects. For example, Chaos is a hostile spell with a party-friendly projectile; it never "attacks" allies, but it always "attacks" enemies in its target area even if they fully save against the spell's effect.

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