Jump to content

BG2:EE v2.6.6.0 - op232 corrections / special flags


Recommended Posts

Corrections:

Parameter #1: Target:

  • 2 => NearestEnemyOf() *which evaluates as [EVILCUTOFF]
  • 3+ => [ANYONE]

Parameter #2: Condition:

  • 1 => See(NearestEnemyOf()) *which evaluates as See([EVILCUTOFF])
  • 8 => PersonalSpaceDistance([ANYONE],4)
  • 9 => PersonalSpaceDistance([ANYONE],10)
  • 10 => Delay(Extra)
  • 13 => TimeOfDay(Extra)
  • 14 => PersonalSpaceDistance([ANYONE],Extra)
  • 15 => StateCheck(Myself,Extra)
  • 16 => Die()

 

Additional flags:

Special: Extra:

[Condition = 0] && [Extra | 1] => Trigger even if the effect host was the source of the hit

[Extra | 1] => When triggered, display strref 0xF000F6 ("A contingency spell has been triggered") as effect host and remove effect
[Extra | 2] => Fire subspell as effect source instead of effect host
[Extra | 4] => Suppress subspell casting glow and string
[Extra | 8] => Suppress subspell range check

 

Misc notes:

1) [param3 != 0] acts as if [Extra | 1] was specified, (and maintains the portrait icon)

2) New to v2.6, when:

  1. Starting Spell()
  2. And the resref being cast (first 7 letters) is a parent resource of an active op232 effect on the caster
  3. And the active op232 originated from op234 [param2=0/1] or was defined with [Extra | 1] or [param3 != 0]

       => Remove the active op232, (only remove one instance, even if more would have met the above)

Edited by Bubb
NearestEnemyOf() not NearestEnemyOf(Nothing)
Link to comment
8 hours ago, Bubb said:
  • 8 => PersonalSpaceDistance([ANYONE],4)
  • 9 => PersonalSpaceDistance([ANYONE],10)

Any relevant differences with respect to "Range()"...?

8 hours ago, Bubb said:

Additional flags:

Special: Extra:

[Condition = 0] && [Extra | 1] => Trigger even if the effect host was the source of the hit

[Extra | 1] => When triggered, display strref 0xF000F6 ("A contingency spell has been triggered") as effect host and remove effect
[Extra | 2] => Fire subspell as effect source instead of effect host
[Extra | 4] => Suppress subspell casting glow and string
[Extra | 8] => Suppress subspell range check

When you say [Extra | 1], do you mean BIT0=2^0=1 set to 1, right... ? And similarly

  • [Extra | 2] => BIT1=2^1=2 set to 1
  • [Extra | 4] => BIT2=2^2=4 set to 1
  • [Extra | 8] => BIT3=2^3=8 set to 1

...?

So for instance, if you change Night Club +1 ("blun38.itm") to THAC0: +1, +2 at night dusk (i.e., set [Condition = 13] && [Extra = 1]), then you'll see "A contingency spell has been triggered" and the op232 effect will be removed (i.e., it'll trigger just once, even if I'm still equipping the club...). How can I avoid this issue...?

I tried applying it via op177 and I got mixed results, i.e.: the op232 effect does not terminate after first trigger but will also display "A contingency spell has been triggered" every time it triggers (but it shouldn't since "parameter3=0" 😕...)

9 hours ago, Bubb said:

[Extra | 1] => When triggered, display strref 0xF000F6 ("A contingency spell has been triggered") as effect host and remove effect

Are you talking about STRREF_GUI_FEEDBACK_CONTINGENCY_TRIGGER...? If so, then how can strref be 0xF000F6...? According to BG2EE "enginest.2da", that should be strref 36936 (0x9048)...

9 hours ago, Bubb said:

[Extra | 2] => Fire subspell as effect source instead of effect host

Could you clarify effect source vs. effect host...?

9 hours ago, Bubb said:

[Extra | 4] => Suppress subspell casting glow and string

To clarify:

  • casting glow => Header @ 0x22...?
  • string => Header @ 0x8...?
9 hours ago, Bubb said:

[Extra | 8] => Suppress subspell range check

To clarify: range => Extended Header @ 0xE...?

Link to comment
7 hours ago, argent77 said:

Interesting. How does condition 10 => Delay(Extra) work exactly? I could only make it work with Extra=1 (and Extra=-1 for some reason). Setting Extra=0 crashes the game. Any other value doesn't appear to work.

The crash is a divide-by-zero in Delay(). The condition is pretty unreliable because two events need to line up for it to fire: the Delay() trigger needs to return true at the same time the contingency is checked, (every 101 ticks).

1 hour ago, Luke said:

Any relevant differences with respect to "Range()"...?

As lynx says 🙂

1 hour ago, Luke said:

When you say [Extra | 1], do you mean BIT0=2^0=1 set to 1

Yes

1 hour ago, Luke said:

So for instance, if you change Night Club +1 ("blun38.itm") to THAC0: +1, +2 at night dusk (i.e., set [Condition = 13] && [Extra = 1]), then you'll see "A contingency spell has been triggered" and the op232 effect will be removed (i.e., it'll trigger just once, even if I'm still equipping the club...). How can I avoid this issue...?

That's the fun part — you can't. Extra acting as both flags and parameters for some Condition values is annoying.

1 hour ago, Luke said:

I tried applying it via op177 and I got mixed results, i.e.: the op232 effect does not terminate after first trigger but will also display "A contingency spell has been triggered" every time it triggers (but it shouldn't since "parameter3=0" 😕...)

op177 is crazy in that it doesn't "add" the EFF to the creature, it merely wraps / executes it. So that's why op232 doesn't get removed when you apply it via op177, though there's still no way to stop the string from firing.

1 hour ago, Luke said:

Are you talking about STRREF_GUI_FEEDBACK_CONTINGENCY_TRIGGER...? If so, then how can strref be 0xF000F6...? According to BG2EE "enginest.2da", that should be strref 36936 (0x9048)...

strrefs [0xF00000-0xF00537] index into enginest.2da, with the row being strref - 0xF00000. So, 0xF000F6 => row 246 => STRREF_GUI_FEEDBACK_CONTINGENCY_TRIGGER

1 hour ago, Luke said:

Could you clarify effect source vs. effect host...?

Effect source = the creature that cast the spell

Effect host = the creature the effect is attached to

2 hours ago, Luke said:

To clarify:

  • casting glow => Header @ 0x22...?
  • string => Header @ 0x8...?

To clarify: range => Extended Header @ 0xE...?

Yes

Link to comment
17 hours ago, Bubb said:

(every 101 ticks).

Why is 101 instead of 100...?

17 hours ago, Bubb said:

As lynx says 🙂

I see.

17 hours ago, Bubb said:

That's the fun part — you can't. Extra acting as both flags and parameters for some Condition values is annoying.

17 hours ago, Bubb said:

op177 is crazy in that it doesn't "add" the EFF to the creature, it merely wraps / executes it. So that's why op232 doesn't get removed when you apply it via op177, though there's still no way to stop the string from firing.

Good to know.

On reflection, it should not be an issue since you can set up the op232 effect to always fire and then put op318/324 effects on the subspell checking for the desired TimeOfDay (or whatever)...

17 hours ago, Bubb said:

strrefs [0xF00000-0xF00537] index into enginest.2da, with the row being strref - 0xF00000. So, 0xF000F6 => row 246 => STRREF_GUI_FEEDBACK_CONTINGENCY_TRIGGER

OK, I see now. Technically speaking, it's row 250 since we need to take into account the header rows, but I got the overall point...

17 hours ago, Bubb said:

Effect source = the creature that cast the spell

Effect host = the creature the effect is attached to

Could you provide a concrete example where this is relevant?

I mean, the op232 effect is usually attached to the creature casting the specified SPL file(s), so they're usually the same creature 😕...

On 3/25/2022 at 7:44 AM, Bubb said:

2) New to v2.6, when:

  1. Starting Spell()
  2. And the resref being cast (first 7 letters) is a parent resource of an active op232 effect on the caster
  3. And the active op232 originated from op234 [param2=0/1] or was defined with [Extra | 1] or [param3 != 0]

       => Remove the active op232, (only remove one instance, even if more would have met the above)

Could you also provide a concrete example of this?

Thank you!

Edited by Luke
Link to comment
7 hours ago, Luke said:
On 3/25/2022 at 1:44 AM, Bubb said:

2) New to v2.6, when:

  1. Starting Spell()
  2. And the resref being cast (first 7 letters) is a parent resource of an active op232 effect on the caster
  3. And the active op232 originated from op234 [param2=0/1] or was defined with [Extra | 1] or [param3 != 0]

       => Remove the active op232, (only remove one instance, even if more would have met the above)

Could you also provide a concrete example of this?

If I understand correctly, the vanilla Contingency spells will now remove a previous instance of themselves if recast before they have triggered.

Probably was a cleaner solution than working with subspells to do the same with op321.

Link to comment
6 hours ago, Luke said:

Why is 101 instead of 100...?

Because:

Spoiler
void CGameSprite::ContingencyCheck() {
    if (g_pBaldurChitin->m_pObjectGame->m_worldTime.m_active != 0 && this->m_nLastContingencyCheck > 0) {
        --this->m_nLastContingencyCheck;
    }
    else {
    	// Sets m_nLastContingencyCheck = 100
        CContingencyList::Process(&this->m_derivedStats.m_cContingencyList,this);
    }
}

Logging the current game tick on that CContingencyList::Process() yields:

[Keldorn] Checking contingencies on tick: 5340435
[Keldorn] Checking contingencies on tick: 5340536
[Keldorn] Checking contingencies on tick: 5340637
[Keldorn] Checking contingencies on tick: 5340738

It appears to be an off-by-one error.

6 hours ago, Luke said:

OK, I see now. Technically speaking, it's row 250 since we need to take into account the header rows, but I got the overall point...

I would use "lines" to refer to the actual line number in the file, and "rows" to refer to the main engine-read content of the 2DA, (the first row being index 0), but I'm just being pedantic at this point.

7 hours ago, Luke said:
On 3/25/2022 at 11:43 AM, Bubb said:

Effect source = the creature that cast the spell

Effect host = the creature the effect is attached to

Could you provide a concrete example where this is relevant?

It's not relevant for vanilla spells. If you change Globe of Blades, (SPPR725.SPL) like so:

  1. Spell ability 0 => Target = Living actor (1)
  2. And change all of the ability's effects to Target = Preset target (2)
  3. And change SPPR725D.EFF => Resource = SPWI112.SPL, Special = 2

If you cast the spell on another creature, when the contingency is triggered the caster fires magic missile at the contingency host. Basically it lets you check the conditions on another creature yet take an action from the caster.

7 hours ago, Luke said:
On 3/24/2022 at 11:44 PM, Bubb said:

2) New to v2.6, when:

  1. Starting Spell()
  2. And the resref being cast (first 7 letters) is a parent resource of an active op232 effect on the caster
  3. And the active op232 originated from op234 [param2=0/1] or was defined with [Extra | 1] or [param3 != 0]

       => Remove the active op232, (only remove one instance, even if more would have met the above)

Could you also provide a concrete example of this?

As kjeron says 🙂

Link to comment
21 hours ago, Bubb said:

I would use "lines" to refer to the actual line number in the file, and "rows" to refer to the main engine-read content of the 2DA, (the first row being index 0), but I'm just being pedantic at this point.

Cheers, I'll keep that in mind for the next time 🙂

21 hours ago, Bubb said:

It's not relevant for vanilla spells. If you change Globe of Blades, (SPPR725.SPL) like so:

  1. Spell ability 0 => Target = Living actor (1)
  2. And change all of the ability's effects to Target = Preset target (2)
  3. And change SPPR725D.EFF => Resource = SPWI112.SPL, Special = 2

If you cast the spell on another creature, when the contingency is triggered the caster fires magic missile at the contingency host. Basically it lets you check the conditions on another creature yet take an action from the caster.

Interesting, good to know...

21 hours ago, Bubb said:
On 3/26/2022 at 1:06 PM, Luke said:
On 3/25/2022 at 7:44 AM, Bubb said:

2) New to v2.6, when:

  1. Starting Spell()
  2. And the resref being cast (first 7 letters) is a parent resource of an active op232 effect on the caster
  3. And the active op232 originated from op234 [param2=0/1] or was defined with [Extra | 1] or [param3 != 0]

       => Remove the active op232, (only remove one instance, even if more would have met the above)

Expand  

As kjeron says 🙂

Thank you both!

Edited by Luke
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...