Jump to content

Is selected effect removal possible in classic BG2 without log feedback?


argent77

Recommended Posts

Enhanced Edition games provide the very useful effect opcode 321 (Remove effects by resource) to remove selected spell effects from a creature. Sadly, the original BG2 engine doesn't provide such a feature.

However, it is possible to exploit opcodes 220 (Remove effects by school) or 221 (Remove effects by secondary type) to accomplish a similar effect if you use a custom school (via mschool.2da) or secondary type (via msectype.2da) for the spell effects. These two opcodes are available to both BG2 and EE engine, but have the ugly side effect of printing a message to the game log, regardless of whether a message is defined or not.

Is it possible to suppress this feedback somehow? Or are there other/better options available to accomplish the same effect as the methods above?

Bonus question: Is it possible to preserve the secondary type of an EFF resource (or inherit it from parent spell) applied via opcode 177?

Link to comment

I can only answer the bonus:

Power, Primary Type, Secondary Type, and Parent Resource are checked depending on the opcode applying the EFF:
When applied by opcodes 177/283:

  • The stats of the applying spell is used for removal of the opcode 177 effect (and therefor the EFF).
  • The stats of both the applying spell and the EFF are used for deflection/reflection.

When applied by opcodes 248/249:

  • The stats of the EFF file are used for removal of the EFF.
  • The stats of the EFF file are used for deflection/reflection of the EFF.

When applied by opcode 272:

  • The stats of the applying spell are used for removal/deflection/reflection of the opcode 272 effect.
  • The stats of the EFF file are used for removal/deflection/reflection of the EFF.

When applied by opcode 182/183:

  • The stats of the applying spell are used for removal/deflection/reflection.

 

Exception:

  • Opcode 333 is always applied directly to the creature, even when applied through an EFF, so the stats in the EFF file are always used for it's removal.
  • Opcodes 309/187 do not retain any stats, no matter how they are applied. The engine deletes and reapplies them as it's own effect.
  • there might be some others
  • IIRC the primary/secondary type removal opcodes cannot remove timing mode 9 effects.
Link to comment

Thank you, that's very insightful. And it also explains why the effect doesn't work as expected. I'm trying to apply opcode 187 (Set local variable) via 177. No matter how I set up parameters, the effect is always applied directly with fixed timing mode 9 and all parent resource info cleared. Looks like I have no choice but to add another opcode 187 instance to the removal spell to reset the global.

Link to comment

That's an interesting thought. Unfortunately I couldn't make it work in my tests. It appears messages for opcodes 220 and 221 are really hardwired into the game executable. Looks like the best I can do is defining a custom feedback message.

 

Fortunately the EE games don't suffer from this hardcoded issue. Specifying strref -1 suppresses feedback entirely.

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