Expect key press to advance dialogue?

I’m setting up a ‘shop’ system, where the player is in conversation with a ‘shopkeeper’. I need help putting this script together so that the ‘shopkeeper’ waits for an input, like a key press for example, before continuing his speech. It would be even better if specific keys can trigger different branches of dialogue, more like a menu, but I would understand if it would require more complex scripting. Any suggestions?

you can check out this one

not free though, can map the answer to key press

Hi,

This is how I might go about implementing a dialogue with potential branching.

You need the dialogue to be executed on an EventTick as you dont know when the user will provide an interaction

You need the dialogue to block on a branch condition at each interaction point where it will stop until a user provides input

You need the dialogue to know what point it is at to know how to branch.

So if your event tick had a branch condition on a bool InDialogue, it will only display first block of dialogue when the bool is true other wise do nothing.

Your BeginOveralp event can set that bool to true and the branch will fire and show first block of text.

After your first block is displayed you could have another branch waiting on a bool Block1Input.

Your Key Pressed event can set that bool to true and the branch will fire and block two dialogure will display.

So far so good … but your block one is gonna display before block two every time.

If you have a state flag that records where you are in the dialogue then you can wrap the display block text with another branch checking for the correct state to display, state = block1 show block1 text otherwise continue on til you hit the block of text associated with the current state

Branching can happen by using an enum instead of a bool for your input action, so key press 1 sets your enum to Option1, key 2 to option2 and key 3 to option3, you can then use the enum value to branch to the correct block of dialogue

HTH

I think I understand, I’ll give it a go. You have my thanks.