Skip to content

[MOD] Sleep Fix

_Luke__Luke_ Member, Mobile Tester Posts: 1,535
Sleep Fix



Download from GitHub



Introduction

So, as you surely may have noticed, powerful spells such as Earthquake cannot knockdown humanoid Skeletons, Zombies, Golems and the like.

Similarly, if you're protected by spells such as Chaotic Commands, in addition to being protected by Mind-Affecting effects (Sleep, Charm, etc...), you're also protected by the knockdown effect from Earthquake-like spells (which is bad/incorrect).

All of this is due to the fact that there is a unique Sleep/Unconsciousness opcode.
It is used for Mind-Affecting effects (Sleep, Unconsciousness, Hopelessness), Nausea (Stinking Cloud and the like), Wing Buffet (DRAGON_WING_BUFFET, Staff of the Ram, etc...) and general Knockdown (Earthquake-like attacks). As you can see, unrelated attacks share the same opcode, and this causes the aforementioned issues.

Thanks to kjeron (once again!), I managed to put together this mod. It attempts to "fix" this situation by giving each Sleep effect its intended purpose.

There are some exceptions though: the following creatures
  • Demogorgon, Belhifet, Luremaster, Bhaal (boss creatures)
  • "Spirits/Ghosts" (Ghost Dragon, Shaman/Druid Spirits)
are immune to all forms of Sleep (even if it'd be incorrect in some cases).
I'm not sure what to do with them... I'll probably add an option to patch them if someone really wants to...

Unfortunately, the patching process cannot be fully automated (feel free to correct me if I'm missing something), so don't hesitate to leave a message here in case something is incorrectly identified/patched.
In particular, I need help with:
  • mod-added items/spells that grant immunity to Sleep
  • mod-added Earthquake-like items/spells

These two categories of resources need to be patched manually (for best results), so if you know mods that add those resources, tell me and I'll add them to my list.



Compatibility

The mod supports the following games and game variants:
  • BG:EE (with or without SoD)
  • BG2:EE
  • IWD:EE
  • EET



@CamDawg @Galactygon Feel free to refer to this when you look at application of opcode 39 for v2.7.
I'm not sure how you will tackle this issue for v2.7, but what about implementing a "bypass op101" mode for opcode 39 (via `parameter1` which is currently unused)? The Panic opcode can already do that, maybe that feature can be useful in this case as well...



IMPORTANT!!!: When downloading from GitHub, always remember to download the latest release if available, as the master branch might contain untested changes.
StummvonBordwehrtl1942ParysAndreaColomboPermidion_Stark

Comments

  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    New release: Sleep Fix v0.2

    Changelog:
    • Slightly improved (decreased) installation times.
    • Fixed broken link in `sleep_fix.ini`.
    • Added code to correctly patch humanoid Golems such as Love, Pride, and Avarice.
    AndreaColomboPermidion_Starktl1942
  • EndarireEndarire Member Posts: 1,512
    @_Luke_
    May we get this mod added to the EET Compatibility List[/url[]?

    Thankee!
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    Endarire wrote: »
    @_Luke_
    May we get this mod added to the EET Compatibility List[/url[]?

    Thankee!

    This mod should be perfectly compatible with EET...
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    New release: Sleep Fix v0.2.1

    Changelog:
    • Removed unused `Type = Late Tweaks` from `sleep_fix.ini`.
    • Hook horrors are now immune to Nausea.
  • Dan_PDan_P Member Posts: 123
    edited September 2021
    Hi @_Luke_ , you mention in the op you needed to know mod items for manual patching. Two of the items in my mod D2-WEAPON use a knockdown effect. The item resources are:

    d2swd01.itm
    d2swd02.itm

    I have the effects directly on the melee attack.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    dp85 wrote: »
    Hi @_Luke_ , you mention in the op you needed to know mod items for manual patching. Two of the items in my mod D2-WEAPON use a knockdown effect. The item resources are:

    d2swd01.itm
    d2swd02.itm

    I have the effects directly on the melee attack.

    Hi @dp85 , you might want to set the `resist_dispel` field (@0xD) of op235 and op39s to either 0 (Natural/Nonmagical) or 2 (Not dispel/Bypass resistance).

    As of now, op235 qualifies as "Natural/Nonmagical" whereas op39s qualify as "Not dispel/Bypass resistance". That's why my automated code is currently failing to correctly patch them (the same holds for vanilla "balth01.spl", where I make sure the values are equal before patching it... Hmm, now that I think of it, maybe I should do something on my end... I mean, 0 and 2 are basically the same after all...)
    Dan_P
  • Dan_PDan_P Member Posts: 123
    edited September 2021
    Just checked and they really are set differently. I'll get an update up shortly and edit this post.

    Edit: update with new version, with resist field all set to 0. Thanks for letting me know. I prefer things to be more consistent anyways.
Sign In or Register to comment.