Select Answer based on object interacted with

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
F1foux
Posts: 26
Joined: Mon Jul 19, 2021 1:21 pm

Select Answer based on object interacted with

Post by F1foux »

Hi Tony,

I'm working on a System in which the dialogue itself is a game. So a conversation is triggered, NPC speaks a line then the player get's into a minigame where the enemies are the possible answers to the npcs dialogue.

So I disabled the Dialogue Managers response menue because I won't use it. The enemies get an index assigned which is the same as their Dialogue Entry ID. What would be the best way to have the killed enemy send their index to the dialogue manager and make the conversation select the answer with that ID, or have the conversation continue from that answers branch?

I hope it's understandable what I'm trying to do. Btw I'm working with Bolt, so if possible pls don't go too deep into scripting language ;)

Thx for your help and thx for the great asset!
User avatar
Tony Li
Posts: 21980
Joined: Thu Jul 18, 2013 1:27 pm

Re: Select Answer based on object interacted with

Post by Tony Li »

Without scripting, it might be simpler to branch based on the value of a variable. Here's an example scene:

DS_AlternateResponseExample.unitypackage

It uses this conversation:
alternateResponse1.png
alternateResponse1.png (15.53 KiB) Viewed 463 times

The "Shoot an enemy" node waits for the sequencer message "ShotEnemy".

When the 3 enemies in the scene are killed, they record their enemy number in a variable and use a one-line script to send the sequencer message "ShotEnemy". You could use Bolt instead of the one line of code if you prefer, or you can just use the included script.

The Delay Evaluation node is because you're setting a variable and Conversations Evaluate Conditions One Extra Level Ahead.

The 3 final nodes check the value of the variable.
F1foux
Posts: 26
Joined: Mon Jul 19, 2021 1:21 pm

Re: Select Answer based on object interacted with

Post by F1foux »

Hi Tony,

Thank you for your fast response.
I think I solved the problem by implementing the "GotoEntry" sequencer command you have listed under extras on your website.
The enemy killed sends a message to the dialogue system with it's ID number and "GotoEntry(2)@Message(2)" moves the conversation to the correct entry.

But I keep your solution in mind if mine doesn't work out.

Cheers!
User avatar
Tony Li
Posts: 21980
Joined: Thu Jul 18, 2013 1:27 pm

Re: Select Answer based on object interacted with

Post by Tony Li »

Hi,

That's a good solution, too!
Post Reply