Locks and Clothing

I’d like to make an article of clothing that when worn, unlocks certain doors, but when removed, will render those doors locked again. I’ve been able to do the prior but not the latter. Added complication: the article of clothing is of a kind of clothing, so that, for instance, the player cannot be wearing two pairs of pants at once. (I’ve successfully made the clothing such that only one of that ilk may be worn.)

New Poster, here. Thanks for your time and attention. I’ve looked through the archives quite a bit, and found nothing like this.

Here’s probably the simplest way to do it.

A clothing-linked door is a kind of door.
A clothing-linked door is usually closed and not openable.

Every turn:
    if the player wears the Pants of Unlocking:
        now every clothing-linked door is open;
    otherwise:
        now every clothing-linked door is closed.

This is a very tiny bit less efficient than tying into the putting on and taking off actions, but it avoids any and all edge cases when something is worn without a player-controlled action. It’s worth the miniscule performance hit, imo.

4 Likes

Brilliant! I’ll give that a try. I didn’t think of making a kind of door.

Excellent. I had to make some changes to both close and lock the door, but it works perfectly now. Thanks so much.