Jump to content

Opcodes #146 and #148

Recommended Posts

OOps, i was wrong. "there is no way the opcode will ever touch player A." is not true :D

Actually, it uses the source of opcode 146 (player A) for a lot of things.


It would use player B as source only if it is coming from a save or something like that.

Now i can only hope it is still the same as in the original, because i have my name all over this part of the code :wallbash:

Link to comment

Well I'm glad we have clarity :lol:


To complicate matters, I've been finding that the definition of "target" when setting contingencies with opcode 232 is incredibly vague...


All Objects and Triggers are in relevance to the effect target of opcode 232.

For parameter1: // Cast Resource on Object:

0 : Myself

1 : LastHitter

2 : NearestEnemyOf

3 : NearestNotSelf

For Parameter2: // Trigger:

0 : HitBy([ANYONE]) Every time
1 : See(NearestEnemyOf(Myself)) Once per Round
2 : HPPercentLT(Myself, 50) Once per Round
3 : HPPercentLT(Myself, 25) Once per Round
4 : HPPercentLT(Myself, 10) Once per Round
5 : StateCheck(Myself,STATE_HELPLESS) Once per Round
6 : StateCheck(Myself,STATE_POISONED) Once per Round
7 : AttackedBy([ANYONE]) Every time
8 : Range([ANYONE],4) Once per Round
9 : Range([ANYONE],10) Once per Round
11 : TookDamage() Every time
12 : Killed([ANYONE]) Every time
13 : TimeOfDay('Special') Once per Round
14 : Range([ANYONE],'Special') Once per Round
15 : StateCheck(Myself,'Special') Once per Round
16 : Died(Myself) Every time
17 : Died([ANYONE]) Every time
18 : TurnedBy([ANYONE]) Every time
19 : HPLT(Myself,'Special') Once per Round
20 : HPPercentLT(Myself,'Special') Once per Round
21 : CheckSpellState(Myself,'Special') Once per Round


The triggers and objects are still limited to their normal detection range, i.e. "Died([ANYONE])" won't see someone dying on the other side of the map.

"NearestEnemyOf", and "LastHitter" must be currently valid objects in order to trigger.

Excluding the Range() checks, [ANYONE] includes "Myself".


The [Resource] is cast using a similar structure to opcode 146[P2=1]:

"Self" affects the creature with opcode 232.

"Preset" affects the [Object] that [Resource] is cast on.

"Original Caster" affects the creature with opcode 232.

However, that [Object] must be within range of the [Resource] or the whole spell will fail.


edit - this forum butchers formatting.

Edited by kjeron
Link to comment


I need some help with opcode #232. I need to apply opcode #12 every time someone attacks me and is within range = 2. So:

Spell A:

  • melee header: target = 5 (Caster), projectile = 1 (None)
  • opcode #232: target = 2 (Preset), parameter1 = 3 (Nearest Not Self), parameter2 = 7 (When attacked), resource = ~Spell B~, duration = 60 (or whatever...)

Spell B:

  • melee header: target = 1  (Living Actor), projectile = 1 (None), range = 2
  • opcode #12: target = 2 (Preset), timing = 1, parameter1 = 1 (or whatever...)

Is that correct? I don't think so because it's not working....

Edited by Luke
Link to comment

Is it displaying: "One of the spells has failed" - that means the target was out of range.  Spells cast by Contingency and Sequencer use a strict range check, and fail if not in range, while normal attacking/casting gives you an extra 1-2 feet beyond the item/spells specified range.

The "When Attacked" trigger for op232 has a tendency to trigger twice for no reason.

"AttackedBy()" includes most hostile actions, not just physical/damaging attacks.

Otherwise - what is it doing?

Link to comment

The spells you posted are correct, so it's likely some other field that's incorrect.

Try setting the Special Field of opcode 232 to '1', attacking them should trigger a message "A contingency Spell has been triggered".  (This will also terminate the effect, but it will determine if the problem is in Spell A or Spell B.)  No message - Spell A has an issue, message - Spell B has an issue.

Link to comment


So, the problem was related to opcode #206 (target = self, resource = ~SPELL_A~) which I added in order to prevent multiple castings of Spell A..... And this leaves me confused since opcode #232 has target = 2 (Preset) which is not Self....

On 3/18/2019 at 7:13 PM, kjeron said:

The "When Attacked" trigger for op232 has a tendency to trigger twice for no reason.

It seems to trigger every time you see something like "Abdel: Attack Roll 11 - 1 = 10: Miss" in the combat log.....

Edited by Luke
Link to comment
3 hours ago, Luke said:

Is there any noticeable difference between 'HitBy([ANYONE])' and 'TookDamage()' ?


The first one detects if you are attacked, while the other only flips if you take damage. As in, a fire elemental will not attack a fireball thrower with the second, while it can attack him master with the first. If that's the only thing in the IF THEN clause of the Enemy() turn script.

Edited by Jarno Mikkola
Link to comment
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...