Door-Locking Support

Example of how to set up events for locking doors. RPGx automatically gives default door bricks an inventory (with only one item slot, which is meant for adding a lock item). Normally, with storage bricks that support locking, you can add a lock item to their corresponding lock slot, and that inventory will be classified as being "locked". Players then won't be able to access that inventory unless they have the right key. Doors don't have that functionality by default, so you have to add events to check whether or not a player can open the door. With the event setup below, the inventory GUI for the door will be opened once the door itself is clicked (for adding or removing a lock). When a player clicks on a door with one of the key items, it will check to see if that player has the appropriate key to open it. With this setup, a door will also automatically open itself if a player successfully picks the door's lock, or has the right key to unlock it.

onActivate -> Self -> RPGx_OpenBrInv

onRPGxKeyHit -> Self -> RPGx_ifCanAccess

onRPGxCanAccessPass -> Self -> door -> [Toggle]

onRPGxCanAccessFail -> Client -> CenterPrint -> "This door is locked." [2]

onRPGxInvUnlocked -> Self -> door -> [OpenCW]