Lever puzzle

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Arctichorse9
Posts: 46
Joined: Wed Sep 25, 2024 11:26 pm
Location: New York City
Contact:

Lever puzzle

Post by Arctichorse9 »

It seems to me that I could use the Dialogue System to set up a small lever puzzle by setting a bool condition on one lever and requiring the player to press a different lever before the confition is met by having a script on the second lever to set the bool to true. Am I far off and would I use an Alert or a short dialogue?

Any help is appreciated. Thanks
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Lever puzzle

Post by Tony Li »

Hi,

Sure, you can use an alert or a bark.

You don't need any scripting at all. You could use these steps:

1. Add a DS Boolean variable such as "PulledFirstLever" whose Initial Value is false.

2. On the first lever, add a Usable component and a Dialogue System Trigger set to OnUse. Select Add Action > Run Lua Code. Set the Lua Code field to:

Code: Select all

Variable["PulledFirstLeverl"] = true
You could also use Add Action > Play Sequencer to play audio (e.g., maybe a click audio), or Add Action > Show Alert for some visual feedback.

3. On the second lever, add a Usable component and a Dialogue System Trigger set to OnUse. Set the Conditions > Lua Conditions to:

Code: Select all

Variable["PulledFirstLeverl"] == true
Then select Add Action and some action such as Bark or Alert or Play Sequence to do something when the second lever is pulled.

4. On the second lever, you could also add another Dialogue System Trigger set to OnUse -- but this time set the Conditions > Lua Conditions to:

Code: Select all

Variable["PulledFirstLeverl"] ~= true
Then select Add Action and some action such as Show Alert: "You must pull the first lever before pulling this lever."

5. Use a Selector or Proximity Selector to interact with these Dialogue System Triggers. If you're using your own interaction system instead, you can configure your interaction system to call the Dialogue System Triggers' OnUse() methods.
Arctichorse9
Posts: 46
Joined: Wed Sep 25, 2024 11:26 pm
Location: New York City
Contact:

Re: Lever puzzle

Post by Arctichorse9 »

That seems so easy! I've been torturing players for years with all sorts of lever puzzles and secret switches and so happy not to have to use script. Thanks so much for your wonderful help and for the Dialogue System.
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Lever puzzle

Post by Tony Li »

Happy to help!
Post Reply