24. Build a locked-door puzzle
Figure 16. Has Inventory asks whether the active inventory contains the required item.
| From | Output | To |
|---|---|---|
| On Interact: use | NEXT | If Variable: door_open == true |
| Door already open? | TRUE | Already-unlocked message |
| Door already open? | FALSE | Has Inventory: brass_key_item |
| Has key? | FALSE | Locked / need-key message |
| Has key? | TRUE | Set door_open true |
| Set flag | NEXT | Disable door → hide door → add 10 points → success message |
Assign this graph to the door’s Use verb. A plain Use interaction tests possession of the key. It does not require the player to select the key and use it with the door; that more specific input needs the appropriate inventory/preposition response to call the same puzzle logic.
Keep the key unless the story says it should be consumed. To consume it, insert Remove Inventory only on the success path after the possession check. Do not remove it on the locked response.
The already-open guard comes before the reward. Otherwise a repeat call can award another ten points even if the door is no longer visible.
