Jump to content

Question on SR implementation on EEs


Recommended Posts

I have just bought myself the EEs from GOG and managed to install EET on my arch linux install. Installed SR and now I have some questions about the implementation -- I have zero experience with modding EEs so most likely this all boils down to sheer ignorance.

(1) A spell like Mage Armor has as first opcode a Remove Effects by Resource [321] with resource the Mage Armor spell resource. If I understand how the opcode works, this not only prevents stacking but also allows refreshing the spell before it runs out. But this is inconsistent, e.g. other buffs like Shield do not work like this. Is this a case of "We have not had the time to go through every spell and work it out" or there is some underlying reason for Mage Armor receiving this treatment and other buffs like Shield do not?

(2) Magic Missile, Burning Hands, etc. have as first opcode a Immunity to Resource and Message [324] with resource the corresponding spell with duration 1. Some buffs have similar opcodes to block for 1 second some other spell (e.g. Free Action for Grease, Chaotic Commands for Charm). What is this supposed to accomplish?

(3) Protection from Petrification has a Modify Script State [282] opcode with state Lockpicking Bonus [20] ?? Is this something for detectable spells? But then why is not the Set Spell State [328] opcode enough? Or maybe it is enough but the implementation has not bothered to delete the spurious opcode for the EEs?

Thanks in advance.

Link to comment
2 hours ago, grodrigues said:

(1) A spell like Mage Armor has as first opcode a Remove Effects by Resource [321] with resource the Mage Armor spell resource. If I understand how the opcode works, this not only prevents stacking but also allows refreshing the spell before it runs out. But this is inconsistent, e.g. other buffs like Shield do not work like this.

Most likely, the odd spell might have been missed.  If you find things like this, please note them in the mod's feedback thread. The mod is still being updated by the community, we are making fixes when and as we can.

2 hours ago, grodrigues said:

(2) Magic Missile, Burning Hands, etc. have as first opcode a Immunity to Resource and Message [324] with resource the corresponding spell with duration 1. Some buffs have similar opcodes to block for 1 second some other spell (e.g. Free Action for Grease, Chaotic Commands for Charm). What is this supposed to accomplish?

This is the IWD method for making sure immunities work, so called because IWD had versions of opcodes 318 and 324 while the BG2 engine did not.  (Indeed, from what I understand, the EEs have the IWD-in-BG2 project to thank for IWDEE, which led to the integration of the IWD and BG2 engines and ultimately led to the wonderfully moddable 2.x engine.)

The BG2 method is to use an opcode 101 or 206 effect in, say, Free Action, and try to block every source of Hold.  But what if a new mod-added spell comes along and Free Action does not account for it?  (Because, how can it?)  The new engine generally applies a stat or a state or a spellstate along with effects like Free Action.  The new spell can simply say, in its first effect, "if this tries to affect someone with the Free Action state, then fail."  Not only does it make spell interactions more reliable, thanks to the redundancy, it is also extremely moddable because it can use anything in SPLPROT.2da as a basis for instantaneous immunity, and you can put a lot of different conditions into SPLPROT.2da.  You know the annoying thing where some spells that set STR to 18/50 can sometimes lower your STR score?  We can add a 318 or 324 effect at the beginning of the Strength spell that says "do not apply this to anyone with STR already higher than 18."  It is way more flexible than the BG2 method of immunity interactions. If taken to the extreme, it can enable stuff like my revised weapon  styles, which apply an extra 1/2 APR for specialization in SWS, and an automatic Shield Bash for specialization in SnS style.

But the really short answer is, those 318/324 effects in the unmodded spells are there to ensure they work and interact as intended, in a mod-friendly way.

2 hours ago, grodrigues said:

(3) Protection from Petrification has a Modify Script State [282] opcode with state Lockpicking Bonus [20] ?? Is this something for detectable spells? But then why is not the Set Spell State [328] opcode enough?

Not sure, but probably yes for legacy Detectable Spells compatibility.  A lot of the use of stats has moved to spellstates in the newer EE versions, which is great in principle since it would be nice for more stats to be available for use by mods.  But there are a lot of old mods out there that might never be updated, and which expect the pre-EE Detectable Spells regime to be in place.  So a lot of spells added by mods that support Detectable Spells might use both methods simultaneously.  No harm done.  (At least, no harm done unless to many mods use too many spellstates, since they are limited to 255 in number.)

Edited by subtledoctor
Link to comment
25 minutes ago, subtledoctor said:

 (Indeed, from what I understand, the EEs have the IWD-in-EET project to thank for IWDEE, which led to the integration of the IWD and BG2 engines and ultimately led to the wonderfully moddable 2.x engine.)

IWDEE came out of (CamDawg's and my) IWD-in-BG2 project (which moved IWD over to the original ToB engine) - IWD-in-EET came later.

There actually is a version of IWD-in-BG2 that moved vanilla IWD over to the BG2EE engine, but it was never released publicly - I wrote it and gave it to Beamdog, and they used it as the starting point for IWDEE.

Link to comment
2 hours ago, subtledoctor said:

The new spell can simply say, in its first effect, "if this tries to affect someone with the Free Action state, then fail."  Not only does it make spell interactions more reliable, thanks to the redundancy, it is also extremely moddable because it can use anything in SPLPROT.2da as a basis for instantaneous immunity, and you can put a lot of different conditions into SPLPROT.2da

Ok, got it.

Just to check my understanding, let us take Burning Hands. If I open NI, the creature type entry reads as "Not match entries 4 and 147" I presume these are entries in splprot.2da. So if I hunt down the 4th entry it reads as "14  100  2". 14 is lower than 0x100 so it is a stat. Hunting its value in stats.ids. we have RESISTFIRE. The value 2 means less than so *not* matching entry 4 just means if critter is immune to fire, it is immune to Burning Hands. Presumably a similar reasoning can be done for not matching entry 147. Is my understanding correct? Thanks in advance.

Edited by grodrigues
I hate typos; misread the entry and fumbled double negation
Link to comment
10 minutes ago, grodrigues said:

Ok, got it.

Just to check my understanding, let us take Burning Hands. If I open NI, the creature type entry reads as "Not match entries 4 and 147" I presume these are entries in splprot.2da. So if I hunt down the 4th entry it reads as "14  100  4". 14 is lower than 0x100 so it is a stat. Hunting its value in stats.ids. we have RESISTFIRE. The value 4 means greater or equal so not matching entry 4 just means if critter is immune to fire, it is immune to Burning Hands. Presumably a similar reasoning can be done for not matching entry 147. Is my understanding correct? Thanks in advance.

Yeah - I hadn't noticed that effect in Burning Hands, but there it is.  To be precise, my version immunizes "not matching 4 or 144." Row 4 is "14 100  2" and row 144 is "14 128 2"  Stat 14 is RESISTFIRE, so this all translates to: "if the target's fire resistance is not less than 100, and not more than 128, then don't even bother having the spell affect that person."  (Resistance over 128 wraps around and becomes negative.) 

This means the old-fashioned "get my resistance over 100 and then heal myself by having the enemy damage me" trick doesn't work. At least, not with that spell.

Link to comment
2 minutes ago, subtledoctor said:

To be precise, my version immunizes "not matching 4 or 144." Row 4 is "14 100  2"

Was editing my post at the same time you responded, yeah I misread entry 4 and fumbled the double negation. Thanks a lot anyways, it sure opens a lot of options.

At this point I just wished they had made a small DSL, say a concatenative language like Forth, possibly with no looping to avoid blowing the stack, with elementary arithmetic and some other operations to handle this kind of stuff. But beggars can't be choosers and we got to work with what we got.

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