[info] how to hack in unlock doors/chests function

+
You could attach this to the 'interact' key for specific 'actions', or create a custom keybind.
I decided to render it like this, sort of hackish, since it's simpler to implement and illustrate.
Some knowledge of modding and coding is required, keybingings are optional, run from console.

This function only works within 5 feet, for the currently highlighted object (focus text or icon).

Disclaimer: Use at your own risk, this is only intended for testing or fixing quest bugs. Some quest objectives trigger when doors and chests are locked or unlocked, thus it has the potential to mess up quest 'facts' or objectives and progression as well.

Code:
exec function Unlock()
{
    var entities : array<CGameplayEntity>;
    var entity : W3LockableEntity;
    var actor : CActor;
    var i, size : int;

    actor = (CActor)GetWitcherPlayer();
    FindGameplayEntitiesInRange(entities, actor, 5, 50, '', FLAG_ExcludePlayer);
    size = entities.Size();

    for ( i=0 ; i<=size ; i+=1 )
    {
        entity = (W3LockableEntity)entities[i];
        if ( !entity.isHighlightedByMedallion ) { continue; }
        if ( entity.IsLocked() ) { entity.Unlock(); }
        else { entity.Lock(entity.GetKeyName()); }
    }
}

Create a file called '\modUnlock\content\scripts\modUnlock.ws' in 'The Witcher 3\mods' folder, paste the code above into it.

Edit '\bin\config\base\general.ini', insert the line 'DBGConsoleOn=true', then open console with ~tilde in game and type 'Unlock'.

May need to run the game executable with the parameter '-forcescriptcompilation', although I can't recall if that's the case.
 
Last edited:
Just leaving this here:

There is a mod called Debug Console Extensions, which contains console command `skeletonkey`, which does the same.
The problem is, that the door stays unlocked throughout the game, and if there is a quest tight to unlocking the door, you will never be able to continue. Such as quest Beyond Hill and Dale, in which you have to ask Regis to unlock the playroom door for you.

As a programmer myself, I had to reverse this little script and create an opposite of this script, to lock the door, that was previously unlocked instead.

Just leaving this small script here for someone else:

Code:
exec function LockDoor()
{
    var entities : array<CGameplayEntity>;
    var entity : W3LockableEntity;
    var actor : CActor;
    var i, size : int;

    actor = (CActor)GetWitcherPlayer();
    FindGameplayEntitiesInRange(entities, actor, 5, 50, '', FLAG_ExcludePlayer);
    size = entities.Size();

    for ( i=0 ; i<=size ; i+=1 )
    {
        entity = (W3LockableEntity)entities[I];
        if ( !entity.isHighlightedByMedallion ) { continue; }
        if ( !entity.IsLocked() ) { entity.Lock(entity.GetKeyName()); }
    }
}
 
Top Bottom