A lock with TWO keys

From ADRIFT 5 Manual Wiki
Revision as of 07:58, 22 June 2013 by Saabie (Talk | contribs) (Created page with "ADRIFT allows you to easily select which dynamic object is used as the key to unlock a particular door or cabinet, but if you want the player to be able to use either of two keys...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ADRIFT allows you to easily select which dynamic object is used as the key to unlock a particular door or cabinet, but if you want the player to be able to use either of two keys to unlock the door, then we need to create a new object property for it and add support for it to all of the lock/unlock commands.

Second key property

We know this is going to be similar to the existing "Key for lock" property in the Standard Library, so open the "Open and Close" folder and right click on "Key for lock":

CopyKeyForLock.jpg

Select "Copy" from the menu.

Right click on the folder you want to copy it to and select "Paste"

Now double-click the new property to open it. The first thing we want to do is change the name to "Second key for lock", then remove the tick from the "Mandatory" box as we still want to be able to have other locks with only one key. Click OK to save it.

SecondKeyForLock.jpg

If you open any lockable object you will now see the new property directly under the "Key for lock" property, and if you tick it you can then select a dynamic object as its second key.

Lock objects with key

Open the "Lock objects with key" task in the "Open and Close" folder, and switch to the restrictions page. The last restriction here is

Silent key check

, then use the same method to make a copy of 1. Make a copy of "Lock objects key check" and call it "Lock objects silent key check" 2. Open its only restriction and delete the text "What do you want to lock %object1%.Name with?" in its message box (make sure you delete every last space and carriage return) 3. In the restrictions of "Lock objects with key" where we added the check for the second key, make sure its text box contains the same text as the restriction for the 'key for lock' above it. 4. Delete both actions in "Lock Objects (Lazy)" 5. Create two SPECIFIC tasks which override "Lock Objects (Lazy)", call them something like "Lock with first key" and "Lock with second key" 6. Add action: Execute task [Lock objects key check] with parameters "%object1%" and "%object1%.LockKey" to "Lock with first key". 7. Add action: Execute task [Lock objects silent key check] with parameters "%object1%" and "%object1%.Property15" to "Lock with second key". 8. Only to "Lock with second key", add a restriction [Referenced object][must][have property][Second key for lock] 9. Make sure "Lock with second key" has a higher priority (smaller number) than "Lock with first key". 10. In "Unlock objects key check" is an action to execute task "Unlock objects with key". Change its second parameter to "%Object2%". 11. Repeat steps 1 to 9 for the Unlock tasks.


the 'Lock/Unlock objects with key' tasks should have a higher priority (lower number) than the 'Lock/Unlock Object (Lazy)' tasks.


<<< Conversations with other charactersMain PageClothing Slots >>>