Jump to content


Photo

[RESOLVED] Magic Resistance Mod Fix


  • Please log in to reply
3 replies to this topic

#1 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 09 May 2011 - 01:21 AM

When this Magic Resistance Mod Fix is set to 1 in TobExCore.ini, setting the magic resistance to a fixed value stops working for some reason.

For example, I have a spell which is supposed to set MR to 0 for a short while, but it does nothing. As soon as I disable this option, everything works fine.

Edited by Ascension64, 08 July 2011 - 08:28 PM.


#2 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 20 May 2011 - 11:07 PM

A small update. When the aforementioned option is activated in TobExCore.ini and opcode #166 is used with parameter 2 set to 1 (flat value modifier), it can no longer lower the magic resistance of the target to the value specified in parameter 1 if the target's current MR is already higher than that.

To give a concrete example, if the target's current magic resistance is 25% and I want to set it to 0, nothing happens.

Edited by aVENGER, 21 May 2011 - 01:37 AM.


#3 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 12 June 2011 - 04:39 PM

Ah, this is because in vanilla, MR p2=0 is an instantaneous sum modifier, and therefore is overridden by p2=1.
TobEx modified the behaviour of p2=0 to be a post-set modifier so that it is added after any sets are made.
The instantaneous sum modifier got moved to p2=3.

So a p2=1 will override any similar effects of p2=1, 2, or 3, but not p2=0. So for example, setting Viconia's MR to X works fine, but if a character equipped a Ring of +5% MR, the MR will stay always be X+5. I don't think the game will choose the higher, the modifier will always be added.

I can offer two possible solutions to this:
1. If we want to keep the current TobEx implementation (which is identical to all other stat modifiers where p2=0 is a post-set modifier, TobEx adds p2=3 as an instantaneous modifier that can get overriden by a p2=1), then you can make you spell/item give increment MR by -100 (p2=0). TobEx will limit the MR to 0 so it won't go negative or overflow. I prefer the other one, but you can try this one out and see if it fixes the problem in the meantime.
2. I can change the TobEx implementation to have keep the instantaneous sum at p2=0 and move the post-set sum to p2=3. This is probable more compatible with any existing mods that rely on using a set modifier to overwrite the instantaneous sum modifier. I prefer this one.

I will also need to check with the GemRB crew to see their implementation, in particular whether they have made any changes or accounted for any differences between engines. The other thing to note is that BG2:ToB and IWD2 appears to use the same implementation (re: IESDP) but the other games may use an implementation similar to that of other stat modifier effects (like Strength mod, etc.)

Edited by Ascension64, 12 June 2011 - 04:45 PM.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#4 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 08 July 2011 - 08:25 PM

Corrected issue for next version. p2 = 0 will work as vanilla, p2 = 3 will perform the post-sum modifier.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)