Jump to content
Sign in to follow this  
Galactygon

Opcodes #146 and #148

Recommended Posts

Opcode 146 (cast spell at target): When parameter2 (type) is set to 0 (cast normally), then it is affected by wild surge (stats 153 FORCESURGE and 154 SURGEMOD). This is possibly an engine bug in BGII:EE, so I've reported it.

 

Also, stats 51 SPELLFAILUREMAGE, 52 SPELLFAILUREPRIEST, and 194 SPELLFAILUREINNATE do not affect this opcode.

Haven't tested this in BGII (non EE). Nor have I tested stats 53 SPELLDURATIONMODMAGE and 54 SPELLDURATIONMODPRIEST

 

Opcode 148 (cast spell at point): This opcode is NOT affected by wild surge (stats 153 FORCESURGE and 154 SURGEMOD), or spell failure (stats 51 SPELLFAILUREMAGE, 52 SPELLFAILUREPRIEST, and 194 SPELLFAILUREINNATE).

 

Haven't tested this in BGII (non EE). Nor have I tested stats 53 SPELLDURATIONMODMAGE and 54 SPELLDURATIONMODPRIEST

Edited by Galactygon

Share this post


Link to post

This behavior hasn't been mentioned in the iesdp as well:

 

If param2 of opcode 148 is set to 2, then the target(s) rather than the original caster will cast the spell from the resource file at a spell level specified in param1. This behaviour is unchanged from BGII to BGII:EE

Share this post


Link to post

This behavior hasn't been mentioned in the iesdp as well:

 

If param2 of opcode 148 is set to 2, then the target(s) rather than the original caster will cast the spell from the resource file at a spell level specified in param1. This behaviour is unchanged from BGII to BGII:EE

Do you have any examples? SpellPoint is always used just with coordinates+spellref in vanilla bg2 (and others). (Really)ForceSpellPointRES is the only exception from the spellcasting family, due to different parameter ordering. As far as I know, also only the Really* family forces the level with param1 (if also a string parameter is passed) or param2.

Share this post


Link to post

As far as i know, param2 can be 0 or not 0. There is no different behavior between 1 or 2.

Share this post


Link to post

 

This behavior hasn't been mentioned in the iesdp as well:

 

If param2 of opcode 148 is set to 2, then the target(s) rather than the original caster will cast the spell from the resource file at a spell level specified in param1. This behaviour is unchanged from BGII to BGII:EE

Do you have any examples? SpellPoint is always used just with coordinates+spellref in vanilla bg2 (and others). (Really)ForceSpellPointRES is the only exception from the spellcasting family, due to different parameter ordering. As far as I know, also only the Really* family forces the level with param1 (if also a string parameter is passed) or param2.

 

There are no examples in the game, but I have been able to reproduce it in both BGII:ToB and BGII:EE and use it my mods. I do not have access to the files atm so I can at most instruct how to reproduce this.

 

Open SPWI304 (Fireball), and add an effect with opcode 148 and param2=2 that casts SPWI308 (Lightning Bolt). Make sure the target type of that effect is set to 2 (pretarget) and not 1 (self) as one would expect to do in this opcode. When you cast Fireball into a group of creatures, they will then cast Lightning Bolt to the center point of the Fireball explosion.

Share this post


Link to post

Also, stats 51 SPELLFAILUREMAGE, 52 SPELLFAILUREPRIEST, and 194 SPELLFAILUREINNATE do not affect this opcode.

Haven't tested this in BGII (non EE).

 

It's been like that in BG2 as well.

Share this post


Link to post

 

 

This behavior hasn't been mentioned in the iesdp as well:

 

If param2 of opcode 148 is set to 2, then the target(s) rather than the original caster will cast the spell from the resource file at a spell level specified in param1. This behaviour is unchanged from BGII to BGII:EE

Do you have any examples? SpellPoint is always used just with coordinates+spellref in vanilla bg2 (and others). (Really)ForceSpellPointRES is the only exception from the spellcasting family, due to different parameter ordering. As far as I know, also only the Really* family forces the level with param1 (if also a string parameter is passed) or param2.

 

There are no examples in the game, but I have been able to reproduce it in both BGII:ToB and BGII:EE and use it my mods. I do not have access to the files atm so I can at most instruct how to reproduce this.

 

Open SPWI304 (Fireball), and add an effect with opcode 148 and param2=2 that casts SPWI308 (Lightning Bolt). Make sure the target type of that effect is set to 2 (pretarget) and not 1 (self) as one would expect to do in this opcode. When you cast Fireball into a group of creatures, they will then cast Lightning Bolt to the center point of the Fireball explosion.

 

Repeat the same with param2=1 and the result will be all the same. It is always the affected creature who casts the spell in #146/#148

Edited by Avenger

Share this post


Link to post

It is always the affected creature who casts the spell in #146/#148

Whoa whoa whoa. Sorry this is an old thread, but I might not have ever really understood this.

 

Let's say I want to have someone cast Magic Missile in a non-traditional way: say, a thief casting it from an innate ability, or casting it from a wizard's staff, or making it a cleric spell. Heck, let's say I want to do ALL of those things, and I want them all to be treated equally by Shield, and SpellCastOnMe triggers, etc.

 

I had figured, that's easy, just have them all use opcode 146 to cast SPWI112.

 

But does that mean the target is the 'caster' of SPWI112? Does that me that target's level is used for purposes of caster level?

Share this post


Link to post

The 'target' of 146/148 is your thief or whoever wants to cast a mage spell. Their level might be used or ignored depending on the parameters for 146/148.

The normal casting option, for example, just queues up a ForceSpell or ForceSpellPoint action.

Share this post


Link to post

Oh okay that's what I thought. So if, extremely hypothetically, I clone all the SPWI mage spells to innate abilities, and then change the original wizard spells into empty shells that only cast the innate abilities via 146/148 with param1 = 0, then anybody with access to an NRD/opcode 214 spell could cast wizard spells, and it would use their actual level as the caster level because anyone can have a proper caster level for innate abilities...?

 

And then anyone could be a spontaneous arcane caster... and then we could have multiclass sorcerers. Or 3E-style spontaneous-casting bards with thief skills.

 

Totally hypothetically, of course.

Share this post


Link to post

The 'target' of 146/148 is your thief or whoever wants to cast a mage spell. Their level might be used or ignored depending on the parameters for 146/148.

The normal casting option, for example, just queues up a ForceSpell or ForceSpellPoint action.

I've always gotten different results from that:

Opcode 146:

The source always does the casting.

If p2=2 and target=(1 or 9), Source casts spell at "Preset Target" and this effect bypasses targets deflection/reflection effects (though its subspell's effects are still subject).

Otherwise, Source casts spell at any/all specified target(s).

 

Opcode 148:

The source always does the casting when p2=0, and the spell is cast once for each effect target.

The target(s) always does the casting when p2=1.

With either p2 value, the spell is always cast at the ability target(point).

 

To compare:

Opcode 258 (activate sequencer)

The target is always the caster, and is who must have the spells sequenced.

 

Opcode 260 (activate sequencer at point)

The target is always the caster, and is who must have the spells sequenced.

 

Opcode 326 (apply effects list)

The source always does the casting.

Unless target = 2, this effect bypasses targets deflection/reflection effects (though its subspell's effects are still subject).

When target=(1 or 9), Source casts spell at "Preset Target".

Otherwise, Source casts spell at any/all specified target(s).

 

Delaying the effects can further complicates the identify of "Source" and "target", as they revert to defaults if you save&reload before the delay expires.

Using them further in Subspells also complicates the identity of "Source" and "target".

Edited by kjeron

Share this post


Link to post

Well I'm glad we have clarity :laugh:

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

Edited by subtledoctor

Share this post


Link to post

 

The 'target' of 146/148 is your thief or whoever wants to cast a mage spell. Their level might be used or ignored depending on the parameters for 146/148.

The normal casting option, for example, just queues up a ForceSpell or ForceSpellPoint action.

I've always gotten different results from that:

Opcode 146:

The source always does the casting.

If p2=2 and target=(1 or 9), Source casts spell at "Preset Target" and this effect bypasses targets deflection/reflection effects (though its subspell's effects are still subject).

Otherwise, Source casts spell at any/all specified target(s).

 

Opcode 148:

The source always does the casting when p2=0, and the spell is cast once for each effect target.

The target(s) always does the casting when p2=1.

With either p2 value, the spell is always cast at the ability target(point).

 

To compare:

Opcode 258 (activate sequencer)

The target is always the caster, and is who must have the spells sequenced.

 

Opcode 260 (activate sequencer at point)

The target is always the caster, and is who must have the spells sequenced.

 

Opcode 326 (apply effects list)

The source always does the casting.

Unless target = 2, this effect bypasses targets deflection/reflection effects (though its subspell's effects are still subject).

When target=(1 or 9), Source casts spell at "Preset Target".

Otherwise, Source casts spell at any/all specified target(s).

 

Delaying the effects can further complicates the identify of "Source" and "target", as they revert to defaults if you save&reload before the delay expires.

Using them further in Subspells also complicates the identity of "Source" and "target".

 

 

The target of those effects is supposed to be the 'would be' caster of the spell stored in their resource field. You can test this by targeting them at someone other than self, but with a spell that targets self.

You must see the spells affect the second guy, not the first.

Share this post


Link to post

The target of those effects is supposed to be the 'would be' caster of the spell stored in their resource field. You can test this by targeting them at someone other than self, but with a spell that targets self.

You must see the spells affect the second guy, not the first.

If I'm understanding you correctly, no, some of them do not function that way.

 

For all: Player A casts SpellA targeting player B

 

SpellA: Ability Target: Living Actor

-Effect: Opcode 146, target = (1 or 9), parameter2 = (0 or 1), resource = SpellB

 

SpellB:

-Effect: Opcode 12, target = 1(Self) = affects Player A

-Effect: Opcode 12, target = 2(Preset) = affects Player A

-Effect: Opcode 12, target = 9(Original) = affects Player A

 

SpellA: Ability Target: Living Actor

-Effect: Opcode 146, target = 2(Preset), parameter2 = (0 or 1), resource = SpellB

 

SpellB:

-Effect: Opcode 12, target = 1(Self) = affects Player A

-Effect: Opcode 12, target = 2(Preset) = affects Player B

-Effect: Opcode 12, target = 9(Original) = affects Player A

 

While here it does:

SpellA: Ability Target: Living Actor

-Effect: Opcode 146, target = (1, 2, or 9), parameter2 = 2, resource = SpellB

 

SpellB:

-Effect: Opcode 12, target = 1(Self) = affects Player B

-Effect: Opcode 12, target = 2(Preset) = affects Player B

-Effect: Opcode 12, target = 9(Original) = affects Player A

 

More importantly, for Opcode 146(P2=0/1), Opcode 148(P2=0), regardless of target, the spells are cast at the level of player A(or specified level), and their effects bypasses player A's magic resistance, not Player B's.

Targeting playerB with Opcode 148(P2=1), Opcode 258, or Opcode 260, will have the spells cast at the level of player B(or specified level), and their effects bypass player B's magic resistance.

Targeting playerB with Opcode 146(P2=2) or Opcode 326, the spells are cast at the level of PlayerA(or specified level), and their effects bypass both players magic resistance.

 

The targeting quirks of AoE's(i.e Sunfire) still take precedence over the above to determine bypassing MR.

 

Opcode 326 also casts spells using the caster level of the calling spell, not the called spell, as other opcodes do.

If spellA is innate and spellB is wizard, opcode 326 would cast spellB using character level, not wizard caster level.

If spellA is cleric and spellB is wizard, opcode 326 would cast spellB using cleric caster level, not wizard caster level.

If spellA is innate and spellB is wizard, opcode 146 would cast spellB using wizard caster level, not character level.

If spellA is cleric and spellB is wizard, opcode 146 would cast spellB using wizard caster level, not cleric caster level.

Share this post


Link to post

Well, tl;dr. But i looked at the first line where you used Effect: Opcode 146, target = (1 or 9), parameter2 = (0 or 1), resource = SpellB. By using target type 1, you effectively disabled targeting B.

I wrote "The 'target' of 146/148 is your thief or whoever wants to cast a mage spell. " You made 'A' as the target of the effects. B is irrelevant for target type 1.

Even with target type 9, where the projectile is targeted at B, opcode 146/148 will still get their target as A (original caster). Obviously, you don't do that if you want 'B' as target.

 

I also wrote: It is always the affected creature who casts the spell in #146/#148

 

If you use target type 1, obviously the affected creature is A.

 

Admittedly, i didn't chew myself through your whole chart.

 

Maybe you want to show me this:

 

SpellA: Ability Target: Living Actor
-Effect: Opcode 146, target = 2(Preset), parameter2 = (0 or 1), resource = SpellB

SpellB:
-Effect: Opcode 12, target = 1(Self) = affects Player A

 

I'm pretty sure this part is in error. If SpellA really affected player B, there is no way the opcode will ever touch player A.

Maybe you could also add a displaystring (139) with the same targeting as opcode 146, to see if your 146 indeed targeted the intended creature.

 

Edited by Avenger

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...