Page 1 of 1

Lever puzzle

Posted: Sun Dec 15, 2024 10:12 pm
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

Re: Lever puzzle

Posted: Mon Dec 16, 2024 9:07 am
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.

Re: Lever puzzle

Posted: Mon Dec 16, 2024 9:25 am
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.

Re: Lever puzzle

Posted: Mon Dec 16, 2024 9:37 am
by Tony Li
Happy to help!