Jump to content

[Discussion] Opcodes 109, 175, 185 (Paralyze and Hold)


Recommended Posts

I've just spent a couple of hours trying to understand the intended uses of opcodes 109 ('Paralyzation'), 175 ('Hold Creature'), and 185 ('Hold Creature 2'), all of which are pretty much functionally identical afaict - they all impose immobility and script-stopping, gated by an IDS check. Mostly I was looking at unmodded, unfixpacked, vanilla BG1 and BG2, where the original intention is clearer. (IWD is another matter and I haven't really looked at it yet.)

Here I think is the underlying logic. (Summary: 109 represents innate paralyzing effects, though it also unnecessarily doubles up representing Web; 175 represents Hold spells; 185 represents things that fix you in place through some external mechanism.)

109 is used almost exclusively by items that cause paralysis, such as the undroppable weapons used by ghouls and carrion crawlers. The IDS check is rarely functional: you're affected by a 109 unless you have explicit protection from it. It is almost always associated with the 'Paralyzed' string. Many classes of monster - dragons and undead, for instance - are immune to it; you also get immunity to it from Free Action, Chaotic Commands, et al.

Complicating matters, though, 109 is *also* used by Web spells, both in BG1 and BG2 (the 'mimic glue' effect in BG2 also uses it). This is actually unnecessary, at least in EE: the web effect (opcode 157) is invariably associated with Web, and it imposes the paralyzation condition all by itself. However, it's clear that Bioware *didn't know that* and thought 157 was cosmetic (and they may have been right: I'm not sure whether this is EE behavior). There are quite a number of places in BG1 and BG2 where it is fairly clear that creatures are given 109 immunity because they are supposed to be unaffected by webs. (It's fairly clear for wyverns, which have no obvious lore reason not to be affected by paralysis (and are big enough to look stupid when Web Effect Overlay plays over them) and have an item that blocks 109, 157, and Entanglement effects; it's equally clear for Kuo-Toa, who get similar immunities to implement their PnP slipperiness trait; it's probably true for Beholders, who can presumably float above webs but have no obvious canon reason to get paralysis immunity.)

175 is used pretty much exclusively by paralyzing spells, almost always labelled 'Hold' (Tanar'ri paralysis is an exception) and is almost always associated with the 'Held' string. Creature immunity doesn't normally affect it: you get immunity to it through situational things like Free Action.

185 is used *very* rarely, and very few things are immune to it. In vanilla BG1, *nothing* is immune to it, and the *only* spell or item which uses it is Otiluke's Resilient Sphere. I think the underlying idea is that 185 represents things that physically prevent you from moving, but through some external barrier rather than directly slowing or freezing you. (On this basis, players should never be immune to 185, and probably only minhp1 items should grant it, to avoid the usual scripting problems. In BG2, however, I think the logic of this breaks down quite badly: boss monsters get immunity to 185, but it gets granted by some items/spells that really shouldn't grant it (some but not all fixed in FP or EE). I think the designers kind of lost track of what they'd intended. They also use 185 to double up as a cutscene can't-be-blocked effect (e.g. HELL_HOLD), but that is (or should be!) harmless since players shouldn't be protected from 185 anyway.

I think the designers lose track of this general scheme a bit in BG2, and slightly more in the Enhanced Editions, but I think it's probably what we should be running with. I'm going to post a bunch of suggested bugfixes that rely on this architecture.

Link to comment

Cheers, this is absolutely the kind of review I wanted to do. A great deal of the confusion here can be traced back to BG2FP, which then propagated into the EEs.If you look at the immunity effect batches, he relevant bits are:

  1. Immunities to paralyzation (109) and hold (175) were added to existing immunities to special hold (185)
  2. An immunity to paralyzation (109) was added to immunity to web (157)
  3. Immunities to paralyzation (109) and hold (175) were linked; if a creature was immune to one they were made immune to the other

These were not chained, e.g. an item that provided immunity to web was given 109 immunity, but was not hit again to also add 175. We removed immunity to 185 from the Free Action spell, but missed it on barbarian rage (nothing should stop HELL_HOLD).

With the finer distinctions between these three and 109 removed from web, #2 and #3 definitely need to be rolled back entirely, and #1 at least partially--185 immunity definitely shouldn't provide immunity to 109, and IMO not 175 either. This and your followup threads are pretty spot on; I'll comment on them as needed.

Link to comment
6 minutes ago, CamDawg said:

185 immunity definitely shouldn't provide immunity to 109, and IMO not 175 either.

I think actually this is okay, simply because basically nothing should have 185 immunity in the first place. The only exceptions, pretty much, are scripted bosses where being paralyzed will break a scripted interrupt, but they need to block 175 and 109 for the same reason. The original (un-FP) game pretty much matches that, I think - dragons are an exception, but I think they're 109/175 immune anyway (and I'm not actually sure they should be an exception in any case).


8 minutes ago, CamDawg said:

If you look at the immunity effect batches

...which I didn't. Oops. Fixpack's architecture is more complex than I gave it credit for. Ignore some of what I say about things that are in EE but not FP - sorry.

Link to comment
On 3/20/2022 at 3:02 AM, DavidW said:

109 is used almost exclusively by items that cause paralysis...

On 3/20/2022 at 3:02 AM, DavidW said:

175 is used pretty much exclusively by paralyzing spells...

Sorry, but it's still not clear to me if there's a real difference between the two (I know that internally they're actually the same thing, except for the special field of op109, but...)?

If I want to make a new SPL/ITM file that imposes immobility (without physically preventing you from moving – so as to exclude op185), should I use op109 or op175...?

As already said, kjeron managed to provide a clear distinction between the two. However, according to the original game files, it's not clear to me if that's indeed the intended behavior or not... In particular, the fact that creature immunity doesn't normally affect op175 makes me think that's not the intended behavior...

Edited by Luke
Link to comment

I'm largely repeating my initial post, but I think if you look at original BG1 you can see a quite clear distinction in how the opcodes are used and immunized against:

- 185 is used *only* by Otiluke, and nothing is immune to it

- 175 is used by Hold spells, and player-usable Free Action-type effects protect you from it; no creature is innately immune to 175, immunities by creature type are handled by IDS targeting inside the 175 opcode.

- 109 is used by other paralyzing effects, mostly creature touch attacks. It's not associated with the string 'Held'.

That architecture then gets successively confused through SoA, ToB, and the EEs. I think it is reasonably clear in-game that the level designers were just losing track themselves of which opcode did which (I think by now the development environment for modding the IE games is quite substantially better than the actual environment Bioware had back in the day). By the EEs, where the 109/175 distinction is almost entirely elided, we have in-house testimony (Cam) that the distinction had been lost. But I think you can see its bones clearly enough even in BG2 that it's worth using it as a baseline for a FP. 

I'm partway through code that tries to spell this out more explicitly.

Link to comment
1 hour ago, DavidW said:

I'm partway through code that tries to spell this out more explicitly.

OK, I'll wait for it...

Additionally, what about asking @Lava to make two brand new custom portrait icons for op109 and op185 (in so doing, "icon=13|Held" would be unique to op175...)?

Link to comment

These are tiny things to work with. Anyway, here:


One is a mix of red (mostly associated with negative effects) and green matter holding someone, which may feel suitable for monster attacks. The other one is white circle (Otiluke's) with red arrow pointing down. Feels suitable for that effect.

2 icons.zip

Edited by Lava
Link to comment

In-game and in editors, 175 is hold. 109 is already known in NI as paralyzation, which is what I suggest we use for combat feedback. Further, we should start thinking of 185 as 'immobilization' rather than a special version of hold. 

Link to comment
On 3/21/2022 at 1:28 PM, Luke said:

Sorry, but it's still not clear to me if there's a real difference between the two (I know that internally they're actually the same thing, except for the special field of op109, but...)?

If I want to make a new SPL/ITM file that imposes immobility (without physically preventing you from moving – so as to exclude op185), should I use op109 or op175...?

Quoted text notwithstanding, and not to muddy the waters, but what I seem to see from the BG1 bones here is something like this:

  • op109 is "paralysis," i.e. some kind of biological reaction or mechanism, often delivered by touch attacks like from ghouls and carrion crawlers
  • op175 is a purely magical "Hold" effect which I tend to think of as a physically immobilizing force
  • op185 I think of as similar to Hold, i.e. magical immobilization, except nothing can be allowed to be immune to it as it is only ever used in special cases like Otiluke's Sphere and cut scenes (and I agree the Implosion HLA should use it)

So in other words I don't see a need for a conceptual difference between 175 and 185 - only a technical difference. Something like "109 is paralysis, 175 is immobilization, and 185 is special-case immobilization" seems fine to me. (And for that reason I don't think op185 needs its own portrait icon... it should either mimic 175 or, more likely, have no icon at all.) Consider that the Hold Undead spell uses op185, not because it is different in concept from Hold Person, but simply because many undead have 101 immunity to op175 via things like ring95.itm.

(And for Heaven's sake let us not bring op165 "pause creature" into the discussion... :laugh: )

Edited by subtledoctor
Link to comment

Pretty much, I think, except I think it's better to think of 185 as doing double duty as (1) an unblockable CS hold, and (2) miscellaneous effects (being stuck in a chasm, being trapped in a bubble of force, being held onto by a disembodied hand) that block action but aren't formally 'Hold' and so aren't blocked by Hold immunity. 


Link to comment

It might help to list explicitly how original BG1 (before even TotSC) does this, since it's pretty clean and simple:

185 is used only by Otiluke, and nothing is protected.

175 is used by Hold Person (wizard, priest, and trap forms), Hold Animal, and Hold Monster. The Greenstone Amulet, the Chaotic Commands spell, the Free Action spell, and the Ring of Free action protect against it.

109 is used by 

(1) paralyzing attacks: ghouls, ghasts, carrion crawlers, vampiric wolves, Kaldran the bear. It's accompanied by the 'held' icon but not by any string. (In particular, 109 attacks never say 'Held'.)

(2) The Web spell (157 is treated as cosmetic).

(3) basilisks, for technical reasons that I don't think are relevant.

Anything immune to 175 is immune to 109, as are undead, wyverns, spiders, certain mages, and some scripted creatures. (The potion of free action protects against 109 but not 175; surely a bug.)

I think the logic of this is pretty transparent:

- 185 is being used as a bespoke hold-in-place.

- 175 is specifically the Hold spell's payload, and nothing is innately immune to it - you get immune by using a spell or magic item. Creature immunity is entirely handled by the restrictions in Hold: to 'persons' (=humanoids), animals, or no restriction at all.

- 109 is mostly paralysis, as SD says. The player can't really generate this at all except through summons, so creature immunity to 109 is basically there just to guard against undead-on-undead edge cases (and not to generate the sweeping immunities that are granted by the time we get to the EEs).

- BUT to complicate things, Web doubles up on 109, and that means that things that need web immunity (wyverns, spiders, and, I'm fairly sure, certain prebuffed mages) end up getting paralyzation immunity. BUT that doesn't matter too much in original BG1 because, as I say, 109 immunity is something of an edge case. Again, by the EEs this has ramified enormously.

Even by the time we reach ToTSC this is getting a bit confused, incidentally - Aec'letec's powers aren't a completely clean fit.


Link to comment

The plan looks good to me.

One note for a specific spell: the "Hold Monster" spell's description currently includes the line "Undead creatures cannot be held." I'd accept this description, and add a "not undead" targeting restriction.

On icons for 185 - I'd set no generic icon, but the normal gameplay spells that use it should impose portrait icons. Implosion needs one as it's currently using Hold, Otiluke's already has one.

Link to comment
1 hour ago, jmerry said:

One note for a specific spell: the "Hold Monster" spell's description currently includes the line "Undead creatures cannot be held." I'd accept this description, and add a "not undead" targeting restriction.

Huh. That's quite annoying, actually. It's not implemented afaict, and it's not in PnP... still, it's hard to argue against developer intent when there's a new line explicitly added to the spell. Agreed, we'd better enact that. 324 immunity to undead is probably the simplest way.

Link to comment

This is moot in this particular case, as this has been in the description since oBG

Regardless, I'll note here (and I'll add it to the main 'what are we fixing' thread for better visibility) is that we had a team go through the tlk literally line-by-line, standardizing stuff like spell and item descriptions. Generally this was an exceptional upgrade as many text inconsistencies were fixed, and the item and spell descriptions were vastly improved. As part of this, they were also meticulous in documenting what items did. Specifically, what they did at that particular point in development and--this is the key bit for a Fixpack--what they documented was not necessarily how something was supposed to work. The good news is that, via the EE translation tool, we can look up who made what changes to strings.

Link to comment

Pushing the analysis further:

ToTSC adds 2 abilities that use 175: spin999 (Tanar'ri paralyze) and spin999 (tanar'ri death gaze). That all seems to strengthen the idea that 175 is associated with magical paralysis; that said, it's really not dispositive because they're enemy-only powers usable only in one situation, where the 109/175 distinction isn't that visible. And there's room to debate whether the Tanar'ri paralyze should really be a 109 (especially as it is not IDS-gated - is it really supposed to work on undead?) This matters more when it gets imported into BG2, of course.

BG2 adds the following (while keeping all the BG1 content):

Using 185:

Hold Undead (SPCL742,SPWI324). As I say elsewhere, I think it's a design error to use 185 rather than an IDS-gated 175 here.
SPIN708, TRAP_SLIME. Logical: having a mass of corrosive slime dumped on you probably isn't resistable by free action.
SPIN769, HELL_HOLD. First use of 185 as a cutscene unblockable power.
SPWM114, probably an error (FP fixes).

Using 175:
- Beholders, weirdly, have both a Hold Person (SPIN988) and a Paralyze (SPIN990) eyestalk, but both use 175. (I actually think there is some reason to think the Hold Person version is an earlier implementation that should be dropped in favor of the more-standardly-used Paralyze ray, but it doesn't matter too much here.)
- Bigby's Clenched Fist and Bigby's Crushing Hand use 175; as I note elsewhere, it should probably be 185.

Using 109:
- several more paralyzing creatures use 109: ghoul lords, maurezhi demons, lacedons, liches
- several more variants of the web effect also have 109 backstopping 157
- a cutscene-used effect, HOLD_PARTY, uses 109 but should probably be moved to 185
- implosion uses 175, and again should probably be 185
- sphere of chaos inflicts 109 (and is described as 'paralyzes' in the spell text)

- DAGG17 uses 109, with no IDS gate, despite being specifically called out in text as applying a Hold Person effect; I think that might be worth shifting to a Humanoid-gated 175.

- RODSWORD, the sword created by the Rod of Lordly Might, uses 109 even though its descriptive text says 'held', not 'paralyzed'.

I think this continues to point to a reasonably clear distinction between 190, 175 and 185, against which bugs can be reasonably easily spotted.


For the same reason, the changes I'm suggesting have relatively minor consequences: they're as much about clearing up messy code as anything else. The ones I've spotted are

Many fewer creatures (notably including undead) are immune to the movement-blocking effects of Implosion and Bigby
Undead can use Free Action spells to avoid Hold Undead
Wyverns, Invisible Stalkers, Kuo-Toa, and certain jellies are affectable by Hold Monster
The Rod of Lordly Might holds more creatures

I'm sure there'll be others, but they will be similarly edge-case. (The fact that undead are immune to most Holds has a big impact here.)

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.

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