Jump to content

Opcode 39 issues


DavidW

Recommended Posts

Opcode 39 is seriously overloaded. It gets used for lots of conceptually different purposes: sleep, unconsciousness, being knocked down, and more. This means that flat immunity to opcode 39 is often overkill. This is an attempt to disentangle things (so far, only for BG2EE). (Wall of text warning!)

Spells/Items that apply 39

Here's a breakdown, based on research in BG2EE:


1) Effects that are clearly labelled as 'sleep'. Examples: the Sleep spell, the (Greater) Command spell, the Wand of Sleep, the Sleep cloud created by the Wand of Air.
2) Effects that are clearly labeled as causing unconsciousness. Examples: pseudodragon claw attacks, Color Spray, Sphere of Chaos.
3) Effects that inflict a short (sub-1-round) 39 to simulate being knocked down or knocked back (actually the most common use of 39). Examples: Wing Buffet, the Staff of the Ram, the Dragon Breath spell.
4) Effects that are used in scripts (cutscenes or other) to disable the party or creatures. Examples: SURE_SLEEP, the effects that knock out trolls.
5) Miscellaneous effects that render the target unable to act. The main ones:
    - Stinking Cloud effects (victims are 'sent reeling and fall down')
    - Emotion: Hopelessness (victims 'lie down where they stand')
6) Miscellaneous effects that stop the target from moving. The main ones:
    - Ixil's Spike (target is 'pinned to the ground')
    - Earthquake (targets 'fall to the ground')
7) Effects that I think shouldn't be using 39 at all, specifically:
    - SPIN775 (the version of Psionic Blast used by Gith), which I think has no good reason not to use the Stun opcode like other Psionic Blasts
    - Bigby spells, which (as I discussed elsewhere) I think ought to be using 186.

Creatures that get immunity to 39

This is pretty widespread. We can break it into three categories:

1) Creatures that are also immune to 235 (wing buffet). 
2) Creatures affected by Wing Buffet, but otherwise with widespread immunities and minimum hp. (The point here is that normally these creatures are protected because they have scripted actions to perform when below a certain hit point level, so they need never to have their scripts disabled. A few seconds is tolerable, but not multiple rounds).
3) Other creatures (e.g., undead, slimes, constructs).

Spells or player-usable items that grant immunity to 39

There are surprisingly few of these. Here's a breakdown:

1) Rage powers. These are described in in-game text as making the user 'immune to charm, confusion, fear, feeblemind, hold, imprisonment, level drain, maze, stun, and sleep' (or permutations thereof).
2) The Chaotic Commands spell. In-game text describes this spell as making recipients 'immune to magical commands. Suggestion, Charm, Domination, Command, Sleep, Maze, and Confusion are all spells that fit into this category.'
3) The Greenstone Amulet. In-game text says that the amulet, when activated, 'protects the wearer from all forms of mind attacks'.
4) Exaltation (the Tyr kit special power; also an IWD spell), which 'removes the effects of fear, sleep, feeblemind, unconsciousness, and intoxication, as well as berserk and confused states of mind. In addition, the recipient is protected against spells and other attacks that cause these effects for 1 turn.'

In IWD there is also Impervious Sanctity of Mind, which 'steels the caster's mind against any outside influence. Charm, confusion, fear, feeblemindedness, hold, sleep, maze, berserk, and intoxication will not affect the caster as long as this spell is in effect.'

Main proposal

My suggestions:

1) Basically nothing should be immune to short-duration knockdown unless specifically immunized against it, i.e. 39 immunity shouldn't in any way imply knockdown immunity. That's partly on conceptual grounds (few if any of the reasons for immunity to sleep, e.g. being undead or affected by Chaotic Commands, apply to knockdown), partly on technical grounds (the knockdown sleep is often to disable a creature during wing buffet, and creatures look silly flying backwards while casting or otherwise acting). Boss creatures can cope with a couple of seconds' delay in their script firing if they happen to be knocked back at the point at which they get reduced to 0 hp.
2) Boss creatures should otherwise be immune to all 39 effects, for the usual reasons.
3) Other creatures with 39 immunity should not be immune to immobilizing effects like Earthquake and Ixil's Spike, but should be immune to both unconsciousness and sleep effects. (There is very little avaiable in-game evidence to separate these for creature immunities and doing so involves a lot more design work than I'm comfortable with in a fixpack.)
4) Player spells and abilities should only protect against 39 effects that are actually called out. So Chaotic commands and rage should protect against sleep, but not other types of unconsciousness; exaltation should protect against unconsciousness, but not against being knocked down by Earthquake.
5) The immobilizing effects of Earthquake and Ixil's spike should be blocked by Free Action, since the Free Action description pretty clearly seems to apply to them.

Implementing this would require 3 spellstates: SLEEP_IMMUNITY, UNCONSCIOUS_IMMUNITY, IMMOBILIZE_IMMUNITY.

Special cases

I think we should treat Hopelessness as a Sleep effect. That's basically pragmatic: if you look at the effects that protect against sleep, they fairly clearly should protect against Hopelessness (it's in the general category of things that Rage ought to protect against; it's a magical command).

Similarly, I think Stinking Cloud should be an unconsciousness effect. It's not a mind-affecting result, so it shouldn't be blocked by Chaotic Commands; it's not sleep, so it isn't covered by the in-game description for Rage. (There is a case for putting it in its own category - the spell description doesn't mention unconsciousness - but that gets profligate with spellstates.)

Effects for mods

- mod-added items/spells that give sleep immunity will grant it too broadly - but then, that's true already
- mod-added items/spells that cause sleep will affect some creatures that shouldn't be affected. That's not ideal but I think is a price worth paying for fixing a lot of bugs.

I have partially-coded proof-of-concept versions of this which I'll upload in due course (without prejudice as to whether we go this way or another).

 

Link to comment

I can offer a bit of inside info on this.

aVENGER (RR) has been trying to disentangle the use of op39 going all the way back to BG2FP. His focus was primarily on distinguishing whether op39 was being used for sleep vs. unconsciousness. The added angle of whether we can consider sleep to be a mental vs. non-mental effect was, AFAIK, not considered--or, at least, not acted upon.

For BG2FP, sleep vs. unconsciousness only manifested itself in whether (half-)elves could resist the effects. They'd get protections against Sleep and Command, but not against Earthquake or Wing Buffet. This was carried forward into BG2EE and BGEE, though it now used a 318 mechanic instead of a series of 177s, but the determination was the same. There wasn't really a lot we could do in oBG2 to have items/spells selectively protect against sleep but not unconsciousness that didn't cause greater issues, so BG2FP left it alone.

oIWD added another dimension in that op39 could be applied with or without wake-on-damage, and this was carried over to IWDEE. When op39 was used for sleep, the targets woke when damaged, whereas unconsciousness meant they stayed down--e.g. Sleep was wake-on-damage, Earthquake was not. The implementation was not terribly consistent, so these were reviewed for IWDEE (aVENGER again, at least primarily). However, a few of these changes made gameplay terrible and were reverted: notably, Color Spray was made wake-on-damage because it turned a non-disarmable trap in Kresselack's tomb to be a high-likelihood TPK. This exception is a clear case of dev intent, because I did it.

I think the sleep vs. unconsciousness divide is a good one, and one where we can make good decisions. I'm a little skeptical if we can make solid determinations beyond that.

Overall, I think the proposed framework is good, and pretty much jives with BG2EE as it stands (e.g. elves have no protection vs. Stinking Cloud). It's basically adding the piece missing from the BG2FP treatment: making items/spells which provide immunity to op39 be a little more selective. We may also want to consider if items/spells which cure sleep should make a similar distinction--something I can handle via the cure stuff, should we decide to proceed.

Edited by CamDawg
Link to comment
2 hours ago, DavidW said:

the Sleep cloud created by the Staff of Air.

Technically speaking, description speaks of "cloud of gas"... As a result, you may want to remove  (half-)elves immunity and treat it as a Nausea effect... Though I'm not 100% sure... Thoughts...?

2 hours ago, DavidW said:

(The point here is that normally these creatures are protected because they have scripted actions to perform when below a certain hit point level, so they need never to have their scripts disabled. A few seconds is tolerable, but not multiple rounds).

2 hours ago, DavidW said:

Boss creatures can cope with a couple of seconds' delay in their script firing if they happen to be knocked back at the point at which they get reduced to 0 hp.

What about attaching an op272 effect (frequency: once per second) on the CRE file itself that casts a SPL file which in turn does what the script is supposed to do...? The SPL file can be prefixed with op318 effects checking for current HP, so as to preserve the "when below a certain hit point level" thing...

2 hours ago, DavidW said:

Other creatures with 39 immunity should not be immune to immobilizing effects like Earthquake and Ixil's Spike, but should be immune to both unconsciousness and sleep effects. (There is very little avaiable in-game evidence to separate these for creature immunities and doing so involves a lot more design work than I'm comfortable with in a fixpack.)

I think we should indeed consider the nature of the creature being hit here... I know that this would involve some judgement calls, but the nature of a creature is a static property after all, right...?

So again:

  • oozes, incorporeal creatures should be immune to all types of knockdown
  • flying, magically levitating creatures (Demilich, Mordenkainen's Sword, ...), oozes, incorporeal creatures should be immune to ground-based knockdown (basically all attacks that apply the Shake Screen effect, such as Earthquake)
    • that means flying and magically levitating creatures (Demilich, Mordenkainen's Sword, ...) should still be vulnerable to general knockdown (f.i. Ixil's Spike)
  • non-breathing and STAT(RESISTPOISON)>=100 creatures should be immune to Nausea attacks (f.i. Stinking Cloud)

On top of that, we should also take into account the PERSONALSPACE pseudo stat... For instance, "Solar Stance!" (used by Balthazar, a humanoid-sized creature) should not work on creatures whose personal_space attribute is greater than 3...

To sum up: if we do not consider all these things, then way too many creatures will be vulnerable to op39...

2 hours ago, DavidW said:

5) The immobilizing effects of Earthquake and Ixil's spike should be blocked by Free Action, since the Free Action description pretty clearly seems to apply to them.

I do not agree on this one... I mean, Earthquake/Ixil's spike do not hinder your movement... Am I missing something...?

2 hours ago, DavidW said:

I think we should treat Hopelessness as a Sleep effect.

Technically speaking, Hopelessness is related to Morale (as kjeron stated elsewhere...) I would probably add an op324 effect checking for MORALEBREAK==0 (i.e., if the targeted creatures cannot suffer from Morale Failure, then they should avoid all effects...)

Having said that, I agree on the pragmatic part...

2 hours ago, DavidW said:

Similarly, I think Stinking Cloud should be an unconsciousness effect... There is a case for putting it in its own category...

What about adding a fourth spellstate, i.e. NAUSEA_IMMUNITY...?

2 hours ago, DavidW said:

Effects for mods

- mod-added items/spells that give sleep immunity will grant it too broadly - but then, that's true already
- mod-added items/spells that cause sleep will affect some creatures that shouldn't be affected. That's not ideal but I think is a price worth paying for fixing a lot of bugs.

Does this mean that you are going to remove immunity (op101) to op39...? Asking because I too started working on all of this and I'm abusing the bugged op182 so as not to mess with mod-added items/spells that give op39 immunity...

If so, are you going to remove op101 only for this particular case or in general (as I suggested here)?

1 hour ago, CamDawg said:

oIWD added another dimension in that op39 could be applied with or without wake-on-damage, and this was carried over to IWDEE. When op39 was used for sleep, the targets woke when damaged

This should also be ported over in BG games (where true Sleep attacks are incorrectly flagged as "Do not wake on damage"...)

1 hour ago, CamDawg said:

We may also want to consider if items/spells which cure sleep should make a similar distinction--something I can handle via the cure stuff, should we decide to proceed.

As far as this topic is concerned, "#curepsn" should cure Nausea attacks (such as Stinking Cloud), not "#cureslp"...

Edited by Luke
Link to comment
3 minutes ago, Luke said:

This should also be ported over in BG games (where true Sleep attacks are incorrectly flagged as "Do not wake on damage"...)

Absolutely not. The games use separate mechanics, and when we changed op39 to support the oIWD modes, we deliberately kept all op39s in BGEE and BG2EE to keep the same behavior as oBG and oBG2.

Link to comment
1 minute ago, CamDawg said:

Absolutely not. The games use separate mechanics, and when we changed op39 to support the oIWD modes, we deliberately kept all op39s in BGEE and BG2EE to keep the same behavior as oBG and oBG2.

Fair enough.

You might want to do that in either Tweaks Anthology or IWDification then...

Link to comment

Just throwing this out there:

Is it really necessary to disentangle "asleep" from "unconscious?" Seems like slightly overkill. After all being asleep is, literally, being unconscious. Whereas separating "asleep/unconscious" from "knocked down" seems very important.

  • Pseudodragon scratches seem to be based on classic fey magic tropes, where people are put to sleep (for in-game comparison, see Pixie Prick). So call it a Sleep effect.
  • Sphere of Chaos randomly applies one of a number of mostly mental effects, I see no reason why it shouldn't be normal sleep.
  • Emotion: Hopelessness pretty clearly functions as an arcane version of Greater Command so it should probably be treated identically. Additionally, even if the fluff text mentions the victims being "awake, but too hopeless to move" it is clearly a mental effect and so should be countered by the same things that counter Sleep (Chaotic Commands, Rage, Exaltation, etc.)
  • I gather the idea of Stinking Cloud is to make you sick and cause you to fall over... so just treat it like a knockdown effect. It would have an unusually long duration of being knocked down, compared to other knockdown effects, but I see no reason it can't simply be an exception to the rule.
  • Likewise, I've always interpreted Earthquake's effect as simply knocking you over and preventing you from getting up. So more of an  unusually long knockdown effect than actual loss of consciousness/sleep.
  • Color Spray says "rendered unconscious" which I guess could be trying to simulate a bonk to the head that knocks you out? But it could also very easily be an application of fairy-like magic that puts you to sleep. The text is vague  enough to support either interpretation so... I would choose the interpretation that makes things conceptually and technically simpler to deal with.

Also, if I was thinking about the real world (always a trap, in discussions like these), I would say the primary difference between being "asleep" and "bonked unconscious" is that when someone is asleep you can wake  them up, whereas when they are knocked out you maybe cannot. So looking at the game's "wake-on-damage" flag  might be a good indicator of whether a spell is meant to cause sleep versus a deeper unconsciousness. But again, to keep things conceptually and technically simple I would just lump both together and simply use the wake-on-damage flag to distinguish them.

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! I see little reason to let spells simulate something that cannot be done manually. If the only functional effect is to make Chaotic Commands slightly different from Exaltation, I would say that accomplish very little and only cause player confusion.

Edited by subtledoctor
Link to comment

@subtledoctor:

I think the main reasons are:

(1) *player* immunity to 39 is mostly through either things that protect specifically from Sleep, or from mental commands. Lots of unconsciousness-causing effects - Stinking Cloud is the most obvious, but other poison-induced effects are also fairly clear cases - don’t fall under that description.

(2) But *creature* immunity isn’t so characterized, and in the overwhelming majority of cases ought to apply to both sleep and other forms of unconsciousness.

(3) But actual knockdown should also affect most creatures immune to unconsciousness.

To illustrate with concrete examples:

- Abazigal, as a dragon, is immune to wing buffet, and so can’t be knocked back. Abazigal ought to be immune to every 39 effect.

- Sendai can be knocked back, so she ought to be affected by short-duration knockdown. (If not, weird graphical effects ensue.) But no longer-duration 39, including Earthquake knockdown, can affect Sendai, because it will break her scripts.

- a ghoul ought to be knocked down by Earthquake. But neither Stinking Cloud nor Sleep should affect it.

- Chaotic Commands should protect from Sleep. But Stinking Cloud is not a mental command and so Chaotic Commands should not protect from it.

These look to me like fairly clear cases. Put them together and they entail a need to distinguish 4 categories: sleep, a non-sleep form of helplessness that undead and the like are immune to, long-duration knockdown, short-duration knockdown. And then I think we can get away with not distinguishing more finely than that.

Link to comment
13 hours ago, DavidW said:

@Luke: just briefly to one of your points, I’m very opposed to doing things like making oozes etc immune to knockdown because I don’t see any evidence that this matches developer intent.

Yeah, it would sound more like a tweak rather than a fix... Guess I'll wait for your proof-of-concept versions and see...

Having said that, I think it is worth mentioning that certain creatures do not really lie down when asleep... That is to say: they look somewhat silly when put asleep – see f.i. the various Djinni/Efreeti/Air Elemental animations (they are basically "invisible"...)

Guess you might want to keep that in mind when working on all of this...?

4 hours ago, DavidW said:

Abazigal ought to be immune to every 39 effect.

I don't see why it should be immune to Stinking Cloud and the like... Ideally, only green dragons should be immune to such attacks... Unless you want to consider it as a boss (i.e.: boss creatures should be immune to every 39 effect just because they are boss creatures...)

4 hours ago, DavidW said:

But no longer-duration 39, including Earthquake knockdown, can affect Sendai, because it will break her scripts.

Just to clarify: when you say "will break her scripts", do you mean that such scripts would fire too late...?

If so, then my suggestion above about using SPL effects instead of scripts should bypass this issue...

Edited by Luke
Link to comment
21 hours ago, DavidW said:

6) Miscellaneous effects that stop the target from moving. The main ones:

    - Ixil's Spike (target is 'pinned to the ground')
    - Earthquake (targets 'fall to the ground')

...

5) The immobilizing effects of Earthquake and Ixil's spike should be blocked by Free Action, since the Free Action description pretty clearly seems to apply to them.

A good idea regarding Ixil's spear and probably Earthquake. At least, save at -6 or suffer 4 rounds of auto-hit incapacity which almost nothing will be immune to is a bit much.

Otherwise, an alternative reading of the Earthquake spell description "Those who fail their saving throws fall to the ground for four rounds" suggests that only failing all saves vs the Earthquake spell should result in being downed for 4 rounds, i.e. save vs spell at -6 or collapse for 1 round, then save vs spell at -2 or be down for the next round, finally save vs spell without penalty or still be floored for 2 more rounds (or just simplify it to a single unpenalized save vs spell to avoid the 4 round knockdown).

Link to comment
2 hours ago, Luke said:

Unless you want to consider it as a boss (i.e.: boss creatures should be immune to every 39 effect just because they are boss creatures...)

Yes, Abazigal is a boss.

2 hours ago, Luke said:

Just to clarify: when you say "will break her scripts", do you mean that such scripts would fire too late...?

In general, one main reason boss monsters get immunity to incapacitating effects is that they are scripted to behave in certain ways when their hit points get too low, and incapacitation interferes with that. (The other reason is obviously challenge.)

While in principle there are probably EE ways to work around that, I feel that level of change is way outside the scope of a fixpack.

Link to comment
1 hour ago, polytope said:

Otherwise, an alternative reading of the Earthquake spell description "Those who fail their saving throws fall to the ground for four rounds" suggests that only failing all saves vs the Earthquake spell should result in being downed for 4 rounds, i.e. save vs spell at -6 or collapse for 1 round, then save vs spell at -2 or be down for the next round, finally save vs spell without penalty or still be floored for 2 more rounds (or just simplify it to a single unpenalized save vs spell to avoid the 4 round knockdown).

I’d struggle to justify calling that a fix rather than a tweak, given how the spell is actually implemented. (I think it’s quite a good tweak as it happens.)

Link to comment
9 hours ago, DavidW said:

To illustrate with concrete examples:

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. I get that one's concept of Stinking Cloud may be that it acts like some kind of "knockout gas" or something... but it could as easily be pictured as causing victims to fall down retching, too overcome to stand up. The description itself says "be sent reeling and fall down" which honestly sounds more like the effect of a wing buffet than unconsciousness. Ditto Earthquake, which states "fall to the ground for 4 rounds" and nothing about unconsciousness.

Now some creatures who are not immune to knockdown must perhaps be immune to Stinking Cloud and Earthquake - Sendai is just a wonky ultra-scripted enemy, fine. And ghouls and their ilk who can perhaps be knocked down should be immune to Nausea effects, but honestly that can be achieved by op206 vs. Stinking Cloud or, to be more inclusive of mods, op83 vs. the Stinking Cloud projectile. It just seems like distinguishing long-duration knockdown from regular short-duration knockdown via a top-down, systematic way, might not be necessary.

9 hours ago, DavidW said:

need to distinguish 4 categories: (1) sleep, (2) a non-sleep form of helplessness that undead and the like are immune to,

Likewise, I am struggling to see the functional difference here. Why do we need a form of lying-down helplessness that undead are immune to, when Sleep is exactly that? I'm not trying to be obtuse, just practical; I simply can't see any daylight between these two categories.

EDIT - okay, on this one, is the idea that there are player-used spells that should block Sleep but not "non-sleep unconsciousness?" Like, the point is just to make Color Spray bypass Chaotic Commands? I'm not sure I see the case for that if there is no deeper reason (meaning, I guess, creature immunities) for the distinction.

Edited by subtledoctor
Link to comment

There are definitely player-used spells that should not block some forms of non-sleep unconsciousness - notably Stinking Cloud, but also pseudodragon poison (I don’t think I buy the claim that it’s a fey sleep effect - pseudo dragons, unlike faerie dragons, are not obviously fey creatures) and arguably also things like Color Spray, which fairly clearly get called out as Unconsciousness rather than Sleep in the in-game text.

I do take the point that you could block the Stinking Cloud projectile; I’ll muse on that. 

Link to comment
11 hours ago, DavidW said:

I do take the point that you could block the Stinking Cloud projectile; I’ll muse on that. 

@subtledoctor

Nope, it would be bad...

As stated on the IESDP, AoE projectiles only impact through their explosion and/or secondary projectiles.

So in this case you would need to block the unlisted hardcoded entry Invisible_Travelling (instead of CLOUD - 94)... Blocking CLOUD - 94 is indeed useless. Let us consider "IMMCLOUD.ITM" as an example: this item blocks Stinking Cloud and the like only because it provides immunity to op39. If you remove it and just leave the immunity (op83) to the CLOUD projectile, you'll notice that Stinking Cloud and the like will no longer be blocked...

But as you surely know, blocking 'Invisible_Travelling' would also block other (totally unrelated) projectiles (since it is widely used as an explosion projectile)...

TLDR: you can't block the Stinking Cloud projectile...

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