Jump to content

Photo

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


4 replies to this topic

#1 argent77

argent77
  • Modders
  • 823 posts
  • Gender:Male

Posted 09 September 2018 - 05:20 AM

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?
 



#2 kjeron

kjeron
  • Members
  • 131 posts

Posted 09 September 2018 - 08:28 AM

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.


#3 argent77

argent77
  • Modders
  • 823 posts
  • Gender:Male

Posted 09 September 2018 - 09:21 AM

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.



#4 c4_angel

c4_angel
  • Modders
  • 61 posts
  • Gender:Male
  • Location:Shanghai, China

Posted 14 September 2018 - 06:49 AM

Can opcode #267 (Text: Protection from Display Specific String) supress the feedback string?

#5 argent77

argent77
  • Modders
  • 823 posts
  • Gender:Male

Posted 14 September 2018 - 09:48 AM

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.





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users