Jump to content

Opcode 39 issues


DavidW

Recommended Posts

OK, here's a more detailed look at developer intent. (Warning: another wall of text.)

Starting with oBG: at least prior to TotSC, opcode 39 is used only in the spells Sleep, Command, Color Spray, Stinking Cloud, and Hopelessness, and in the Wand of Sleep. It's clear that there are (at least) three separate effects here, overloaded onto the same opcode: sleep (uses the 'sleep' icon), stinking cloud (uses the 'poisoned' icon), and hopelessness (uses the 'hopelessness' icon). (Color Spray has no icon and is described as rendering the target unconscious.) The overload is harmless, though, because players have no way to get immunity to 39 and the only creatures who have 39 immunity are undead and slimes, who ought to be immune to all three effects anyway.

Things start getting a bit messed up even as soon as TotSC, which introduces two player-usable ways to get immunity to 39: Chaotic Commands and the Greenstone Amulet. The former protects from an explicit list of mental attack forms, which includes Sleep, and describes itself as 'like the 8th level wizard spell Mind Blank'. The latter grants immunity to 'mental commands', and calls out Sleep explicitly as an example.

I think it's pretty clear that dev intent here was to block Sleep (and possibly Hopelessness) and that blocking Stinking Cloud was unintended (though probably noticed and treated as unavoidable, given the oBG engine). 

oBG2

oBG2 substantially expands the use of 39. Here's a list of extra uses (the old ones are retained; the only change to them is that Color Spray now grants the Sleep icon)
- it is used in several cutscene effects where the clear intention is for a party member reliably to be affected
- it is applied on nearly all uses of 235 (wing buffet) to disable the character during the buffet (and, in nearly all cases, for 1 second longer)
- it is used by several items/creatures where the effect is labeled with a 'sleep' icon and/or the 'sleep' string. Specifically: the drow bolt of sleep; the sleep cloud from the staff of air; pseudodragon claws; Pixie Prick. All but one of these (pseudodragon claw) is described as causing 'sleep' in in-game text.
- it is used in several one-off cases:
    - by Ixil's Spike, to simulate being 'pinned to the ground', along with the 'Held' icon
    - by Earthquake, to simulate being knocked down and unable to rise for several rounds     (no icon is applied)
    - By Abazigal's Shockwave, presumably to simulate being knocked down for 3 seconds
    - By the Staff of the Ram and the Smite HLA, both of which describe you as 'knocked back and stunned' (this is also a use of 235, but now the effect is explicitly intended to last longer than the knockback). The 'stunned' icon is used. (Incidentally, the game text for these powers says that large creatures are not affected, but this is not implemented.)
    - by the Gith version (and only the Gith version) of Psionic Blast, SPIN775 (PSIONIC_MIND_BLAST). At a guess this is intentional: this is simulating the AD&D psionic power Psionic Blast, a single-target spell which to first approximation knocks its target unconscious. No icon is included.
    - by Sphere of Chaos, without icon (but described in description text as knocking target     unconscious).
    - by Comet, to represent the character being knocked back and stunned.

oBG2 also adds a new way the player can gain immunity to 39: rage. The rage powers are described specifically as protecting against Sleep, but they also immunize against the Hopelessness icon and the (unused) Unconsciousness icon.

In oBG2, undead and slimes remain immune to 39. In addition, dragons, mephits, salamanders, golems, and Mordenkainen's Sword are granted immunity.

BG2EE

(I'm ignoring newly-added resources for now and just looking at what BG2EE does to the oBG2 resources). 

BG2EE makes only a few changes:
- it moves the Bigby's Hand spells over to 39, which as I've discussed elsewhere is probably a mistake that should be reverted (not least because of its graphical awkwardness)
- it moves Stinking Cloud from the Poisoned to the Nauseated icon. That's clearly deliberate (and fairly sensible, albeit it reuses an icon that signifies something a bit different - Ghast nausea).
- it dumps the Sleep icon on basically everything (including things like Hopelessness and Stinking Cloud). I think that's just a bit of over-enthusiastic autocoding in the wake of the Sleep opcode allowing a built-in icon; I suggest not taking it too seriously.

Revised suggestions

Put aside the awkward special cases for now and look at more generic uses of the opcode. I suggest:

1) It is clear that no ability should grant PCs blanket immunity to 39. This blocks scripted uses that clearly should always work, as well as knockback effects that no party protection should logically block and that make a (cosmetic) mess of various scripted and in-combat events.
2) The large majority of effects that render a character unconscious are identified in-game as 'Sleep' effects, either through their icon or through displayed strings. 
3) Rage is clearly intended to protect from unconsciousness (since the icon is blocked) and hopelessness (ditto). 
4) Although Hopelessness is not explicitly called out by mind-protecting effects like Chaotic Commands and the Greenstone Amulet, it fairly clearly comes under the category of effects they should protect from.
5) There is no in-game evidence that any party protection is supposed to protect from Stinking Cloud: it does not fit the description of anything protected from by Chaotic Commands, Rage, etc; its icon is not protected from. I think this is just an error grandfathered in all the way from TotSC, unavoidable then but avoidable now.

So as far as a general framework is concerned, I'm inclined now to agree with Luke (who advocated NAUSEA_IMMUNITY). I think we want SLEEP_IMMUNITY and NAUSEA_IMMUNITY. SLEEP_IMMUNITY protects against anything identified (in oBG2) as 'sleep' by its icon, string, or in-game description. NAUSEA_IMMUNITY protects against Stinking Cloud. Chaotic Commands, the Greenstone Amulet, and Rage grant SLEEP_IMMUNITY but not NAUSEA_IMMUNITY. The various creatures who get 
39 immunity all get both SLEEP_IMMUNITY and NAUSEA_IMMUNTY. (I can see that being arguable for a few of them - e.g. dragons - but I think there's more design work than I'm comfortable doing in a fixpack to separate them out.)

As for knockback, I think that nothing affected by 235 should be immune to the short-duration 39 effect that accompanies 235 - it makes a graphical mess and fairly clearly is unintentional. So I think we should be stripping 39 from anything that doesn't already have 235 immunity, and relying on SLEEP_IMMUNITY and NAUSEA_IMMUNITY.

We then need to deal with the special cases.

Special cases

- Gith psionic blast, Sphere of Chaos: I agree on reflection with Subtledoctor that it's just confusing to treat these as sui generis given that they're such rare effects anyway (and given that virtually any other similar effect is treated as sleep). So we should treat these effects too as sleep (and apply icons to that effect).
- Abazigal's Shockwave: this is just a knockdown, only lasts 3 seconds, and is only used in one controlled case anyway. Nothing needs to be immune to it.
- Smite/Staff of the Ram: this is interesting, in that both effects describe themselves as 'knock back and stun' - 'stun', not 'sleep' - but both use opcode 39. I assume the reason is aesthetic: it makes more sense that the target is prone. This is somewhere where I think the new immunity system comes into its own - we can carry on using opcode 39 but use STUN_IMMUNITY to give protection (after the initial knockback period, probably) and display the Stun icon rather than the Sleep icon. #curestn can remove these effects.
- Comet: I think the implementation of Comet is bugged and ought to be tweaked to fit the description better. It describes itself as knocking back the target and then, for any creature knocked back, stunning it (again: stun, not sleep) for 1d4 rds unless it makes a save vs paralysis. Actually, it just applies 39 for 3 rounds with a save to avoid. (Again I suspect this is aesthetic.) We can do the same thing as Smite/Staff of the Ram.
- Earthquake: this is harder. Most creatures protected from 39 probably shouldn't be immune to earthquake - the obvious counterexamples are dragons (too large, can fly - in any case have 235 immunity so don't need to worry), magic swords (can fly), undead creatures with the mist or shadow animation (incorporeal, can fly), slimes (have no facing. This is more design than I'd ideally do but I think it's unavoidable given the overloading of 39. (There are other creatures - like beholders - that don't get 39 immunity but probably shouldn't be affected by Earthquake's knockdown, but I think that's beyond the scope of a fixpack). In addition, boss monsters need Earthquake immunity, partly because their immunities are for balance reasons and partly because it messes with their death scripting. As a matter of implementation, I think the easiest thing to do is externalize the knockdown to a subspell, and apply a mixture of 318-on-the-spell and 318-on-a-creature/protective item. (This seems more sensible than blowing a spellstate.)
- Ixil's Spike: I think we can treat this as sui generis on basically the same basis as Earthquake, and with basically the same implementation.

Residual issues with icons

I think we should revert most of the (excessive, confusing) rollout of Sleep icons in EE. If it's not too much of a stretch, I suggest using the (unused, I think) Unconsciousness icon for short-duration knockdown: sleep is far too confusing, but having no icon associated with an effect is bad practice.

Link to comment
3 hours ago, DavidW said:

Smite/Staff of the Ram: this is interesting, in that both effects describe themselves as 'knock back and stun' - 'stun', not 'sleep' - but both use opcode 39

This is stepping further back and not totally relevant, but I've always thought it was odd that "paralysis" and "stun" freeze you upright like a magical Hold, when by rights they should cause you to lose muscle control and fall over. Once upon a time I even considered a mod  to pair these up with op39 effects to make it more realistic, but I quickly abandoned that idea. Fact is in this game, paralysis and stun simply freeze you in place - for whatever reason, they don't make you fall down. But as you see in TOB, this rule seems to have been forgotten. It's like some dev was designing Smite and said "it says 'stun' so I better add an op39 effect so they fall down." Seems like inconsistency born of an oversight - not specific dev intent that "this particular kind of stun should knock you prone!"

So while it's nice that this putative revision to op39 handling would allow us to retain the falling-down aspect of the HLA and Staff of the Ram, I'm not sure it's necessary.

OTOH putting the work in to retain the falling-down part would keep the game true to its unmodded behavior, and this is a FixPack after all. And it would provide a clear model for an enterprising modder who wants to backport that visual behavior to earlier versions of stun and paralysis...  so I guess win-win.

tl;dr: don't mind me, I'll just wander over that way.

Link to comment

I don't know if a spellstate for NAUSEA_IMMUNITY is necessary, just checking poison resistance should suffice, unless you know of any specific examples otherwise.

There is one more special case that the EE's made worse and still have not fixed.  Ever since IWDEE came out and the "Wake on Hit" option was added, falling unconscious from non-lethal damage has erroneously used the "Wake on Hit" mode and the "Sleep" icon (because they are both the default(0) values).  Not that we can really do anything about that part, as it needs an internal fix.  The only way to block this effect is with 7EYES, which would require a spellstate, but it may be better to use it to block non-lethal damage entirely instead of just the op39 (which could catch other "Sleep" effects).

Sleep does not actually disable scripts as most other disabling effects do.  It only restricts which actions may be taken (some hardcoded, some require an ACTSLEEP listing).  Dialog is one it restricts, but that can be circumvented with action #313 (after adding both to ACTSLEEP).  Though I don't know whether it would be worth it to update death scripts to handle STATE_SLEEPING.

Blocking projectiles: All you have to do is add a new projectile to be used as it's impact projectile (See WEB.PRO/WEBTRAV.PRO/ANTIWEB.ITM).

Link to comment
4 hours ago, DavidW said:

- it moves the Bigby's Hand spells over to 39, which as I've discussed elsewhere is probably a mistake that should be reverted (not least because of its graphical awkwardness)

4 hours ago, DavidW said:

- it is applied on nearly all uses of 235 (wing buffet) to disable the character during the buffet (and, in nearly all cases, for 1 second longer)

4 hours ago, DavidW said:

    - by Ixil's Spike, to simulate being 'pinned to the ground', along with the 'Held' icon
    - by Earthquake, to simulate being knocked down and unable to rise for several rounds     (no icon is applied)
    - By Abazigal's Shockwave, presumably to simulate being knocked down for 3 seconds

4 hours ago, DavidW said:

    - by Comet, to represent the character being knocked back and stunned.

I'm pretty sure op39 is being employed in these instances because it's effectively the only source of a non-interruptible animation change.

I've been playing around with trying to make Staff of the Ram do its thing without op39, specifically, trying to use op138 to invoke the sleeping sequence with a delayed 138 to play the awakening sequence. The problem is that op138 can be interrupted, e.g. a player can select a party member and give them the usual actions, and the animation change is ignored. Similarly AI scripting also ignores it, as it's just a cosmetic animation change. The next idea was to pair it with something that disables the target (e.g. op185 or 45) but then it prevents the animation change--if you delay it to fire after the sleep animation plays, it still leaves a window for interruption. The upshot of all of this is that I think we're stuck with op39 for anything that 'knocks over' the target, or language to that effect. As it would greatly simplify this problem, I'm really, really hoping one of the clever people here can prove me wrong.

Taken to its logical conclusion it means we have to rely on gating any op39 through a 318/324, doing away with any blanket op39 immunity (for player-accessible items and spells, at least), and gating the sleep cures as well.

Edited by CamDawg
typos
Link to comment
1 hour ago, kjeron said:

 

I don't know if a spellstate for NAUSEA_IMMUNITY is necessary, just checking poison resistance should suffice, unless you know of any specific examples otherwise.

 

 

I’m not convinced in-game evidence adequately supports making all and only poison-immune creatures immune to Stinking Cloud. It is not described as a poison effect and a significant number of creatures (notably dragons) have 39 immunity but can be poisoned.

Link to comment
6 hours ago, DavidW said:

This is somewhere where I think the new immunity system comes into its own - we can carry on using opcode 39 but use STUN_IMMUNITY to give protection (after the initial knockback period, probably) and display the Stun icon rather than the Sleep icon. #curestn can remove these effects.

No, I don't think it would make sense...

As you said, this is not a real stun effect, but physical knockdown... Nothing should cure physical knockdown, simply because there would be nothing to cure...

If Earthquake/ Staff of the Ram / Dragon Wing Buffet / etc. knocks you to a prone condition, you should just remain on the ground for the specified duration... You should not be able to "cure" the prone condition...

Link to comment
40 minutes ago, DavidW said:

I’m not convinced in-game evidence adequately supports making all and only poison-immune creatures immune to Stinking Cloud. It is not described as a poison effect and a significant number of creatures (notably dragons) have 39 immunity but can be poisoned.

Notably, the 318s vs. poison was implemented by BD and Stinking Cloud was omitted.

Link to comment
14 hours ago, CamDawg said:

and Stinking Cloud was omitted.

Probably because such spells do not deal poison damage...

In any case I too would add the check, seems reasonable...

Special cases include "ohrgrog.spl" and "ohdmask.spl" (used by the Visage - "ohdmask.itm"): these are described as gas-based / breath attacks but deal acid damage... As a result, the op318/324 check should only block the sleep effect, not also op12...

Link to comment
8 hours ago, Luke said:
23 hours ago, CamDawg said:

and Stinking Cloud was omitted.

Probably because such spells do not deal poison damage...

In any case I too would add the check, seems reasonable..

I think 'seems reasonable' is too loose a criterion for a fixpack. I don't think we can go adding active immunity to an item unless there's clear evidence that the developers intended it to work that way; I take Cam's comment as active evidence that they didn't.

Link to comment
On 8/12/2022 at 10:51 PM, subtledoctor said:

This is stepping further back and not totally relevant, but I've always thought it was odd that "paralysis" and "stun" freeze you upright like a magical Hold, when by rights they should cause you to lose muscle control and fall over.

Paralyzation caused by ghouls need not be like flaccid paralysis irl (some things like tetanus and electrocution do cause rigid paralysis anyway) since ghouls are imaginary after all, maybe it's more like rigor mortis?

As for stun, PnP wise it's meant to be more like "out on your feet" and while stunning should prevent effective action in combat it's not even supposed to grant automatic hits in combat (although you should lose both dexterity and shield bonus to AC).

On 8/11/2022 at 6:32 AM, subtledoctor said:

Put another way: I haven't seen a case made for what is gained by distinguishing "sleep" from "unconsciousness." You can't actually bonk someone on the head and knock them out in these games!

You totally can, fist damage - except from monks, who have lethal unarmed attacks - knocks the target unconscious when they drop to zero hp or less.

Incidentally, the unconsciousness duration appears tied to the excess damage relative to hp. Striking a relatively tough 9hp goblin for 9 fist damage (strength girdle) knocks him out for 12 seconds/2 rounds. Striking a 7 hp goblin for 8 damage knocks him out for 30 seconds/5 rounds. Striking a goblin with only 1hp remaining for 9 damage knocked him out for about 156 seconds... looks like the formula is 2 rounds plus 3 rounds per point of excess damage unless I mistimed.

Also, immunity to opcode 39 turns out non-protective vs fist unconsciousness (on the original ToB engine anyway) undead which are vulnerable to normal weapons can be knocked down with fists @lynx might be interested in this for the IESDP.

Edited by polytope
Link to comment
2 hours ago, polytope said:

Paralyzation caused by ghouls need not be like flaccid paralysis irl (some things like tetanus and electrocution do cause rigid paralysis anyway) since ghouls are imaginary after all, maybe it's more like rigor mortis?

So you would still fall on the ground while being rigid... The "standing up" posture is not a stable state.

Link to comment
9 minutes ago, mickabouille said:

So you would still fall on the ground while being rigid... The "standing up" posture is not a stable state.

The context is the associated animation, a creature's sequence for falling asleep and laying there (which btw is distinctly different to collapsing dead) shows floppiness. The designers didn't include a subset of animations that show anyone toppling rigidly and lying in such a pose.

Whether or not the devs were pressed for time to include new animations (and they probably were, look at banshees and water elementals) it doesn't seem likely that paralyzation freezing characters in place compared to unconsciousness was an accident.

Link to comment
On 8/11/2022 at 11:54 AM, subtledoctor said:

I agree with you in substance, I just don't see why the same result cannot be achieved by simply designating Stinking Cloud and Earthquake as knockdowns

The main issue here that I can think of is undead. Undead don't breathe and shouldn't be affected by stinking cloud. But, corporeal undead at least should be knocked down by an earthquake.

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