# Make a Lockable Door

> For the complete documentation index, see [llms.txt](llms.txt).

Make a door show Unlock while locked, open for a player with the right key, and offer Close afterward. Start with a [working interaction source](int-first-steps.html) and a door mesh with a hinge or animation you can control.

Procedure: Configure the door and key

1. Create a Blueprint based on `NinjaInteractionOpenableActor`. Set up the target collision and give its Smart Object an Open slot and a Close slot. On each, set the behavior type and matching runtime tag to `Interaction.Type.Open` or `Interaction.Type.Close`. Use the [immediate tree](int-guide-immediate.html) for each.

2. Enable Starts Locked, set Key Item Query to match the intended key, and choose a Key Resolver Class. The default resolver can use Ninja Inventory keys. For a quest flag or another key system, subclass `NinjaInteractionKeyResolver` and override Try Unlock With Key. Return true when the instigator can unlock this door.

3. Use the offered action when the player presses Interact. The base door handles a locked door through the Open action. It shows the unlock text, checks the key, and opens on success. Enable automatic closing and choose a delay if the door should close by itself.

## Animate the Door for Each Player

Implement `ApplyOpenState` and `ApplyClosedState` to move the mesh. When Snap To Final State is true, set the final pose immediately so a player joining later sees the correct door. Use `ApplyLockedState` and `ApplyUnlockedState` for a lock indicator. Extend the server-side `Open` or `Close` functions for gameplay, such as revealing a room, and call the parent to preserve the door's state changes.

![Door Blueprint applying its open and closed poses](Documentation/int_adv_openable_actor_blueprint_graph.png)

Override `CanCloseAfterOpen` or `CanOpenAfterClosed` to restrict later uses. For a scripted unlock, call `ForceUnlock` on the server.

## Try It in Play

Try Open without a key, then with the matching key. The first attempt should leave the door closed. The second should open it and offer Close. If an open door still offers Open, compare the offered slot with the actor's Is Open state and verify the slot runtime tags.

