Skip to content

Unbreakable lock discrepancies

#4431 (closed) implemented support for unbreakable locks. The issue says such locks cannot be opened using the Open magic effect, this does not appear to be accurate.

Morrowind.exe saves lock level 0 as 0x7fffffff if the value was set using the console. If the value was set to 0 in the editor, it is saved as 0 instead. This 0 is treated as unlocked if no key is assigned, but behaves like an "unbreakable" lock otherwise. When a locked door with an editor assigned level of 0 is saved by the engine, the lock level is saved as 0x7fffffff.

The original engine maintains a separate lock level and locked boolean at runtime. In save games this boolean doesn't exist and unlocked doors are expressed using negative numbers as in current OpenMW. As a side effect, this means it is possible to lock doors using negative lock levels at runtime. Doors locked this way will behave as locked doors, until the game is saved and reloaded, at which point their locked state is (obviously) unrecoverable from the save game and they are once again unlocked.

Lock levels <= 0 cannot be interacted with using a lock pick, but Open magic appears to work just fine. Only lock level 0 isn't shown in the UI.

Matching vanilla behaviour should be as easy as adding a boolean locked variable alongside the existing lock level variable, converting 0x7fffffff to 0 upon loading a save and setting locked to true, and serializing locked doors with lock level 0 as 0x7fffffff.