Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Dialogue options still continue processing even when user walks away during chat. #305

Closed
src52 opened this issue Apr 25, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@src52
Copy link
Contributor

src52 commented Apr 25, 2021

Describe the bug
If you speak to another NPC and walk away mid-conversation, instead of closing all dialogue interfaces, the next available option dialogue displays, even if the user didn't traverse down that part of the dialogue tree.

To Reproduce
Steps to reproduce the behavior:

  1. Speak with an NPC with an option dialogue.
  2. Before the option dialogue appears, cancel the dialogue interaction by walking away.
  3. Each click that you make while walking away will display the next set of option choices from the dialogue, even if the player didn't go down that particular branch of the dialogue tree.

Expected behavior
All dialogues should close when walking away from a dialogue interaction with an NPC.

Screenshots
https://i.imgur.com/vPSgVop.mp4

@src52 src52 added the bug Something isn't working label Apr 25, 2021
@hallowatcher
Copy link
Contributor

is this on my romeo and juliet branch?

@src52
Copy link
Contributor Author

src52 commented May 4, 2021

is this on my romeo and juliet branch?

Yes, maybe I should've created a bug report on your specific fork instead, but I wasn't sure if it was caused by yours in particular.

@Tynarus
Copy link
Member

Tynarus commented May 15, 2021

This should be fixed with the new action handling system, but feel free to re-open if it persists when the PR is ready to merge.

@Tynarus Tynarus closed this as completed May 15, 2021
@hallowatcher
Copy link
Contributor

hallowatcher commented Jun 23, 2021

I know why this happens, and IMO it's an issue still, depending on the perspective you look at it.

Say you have this code:

async function talkToNpc() {
  await dialog([ ... ]);
  
  openBankInterface();
}

If you talk to the NPC, and walk away mid dialogue, the openBankInterface() function will always be reached, no matter what. Right now, this is hackily solved by checking if the dialogue was "success".

async function talkToNpc() {
  const success = await dialog([ ... ]);
  
  if (success) {
    openBankInterface();
  }
}

But what if you have multiple dialogues in there (the case for some quests where there is a world.tick between each dialogue). This solution is hella ugly

async function talkToNpc() {
  const successOne = await dialog([ ... ]);
  
  if (successOne) {
    const successTwo = await dialog([ ... ]);

    if (successTwo) {
      // Do something important
    }
  }
}

This can easily be fixed by throwing in dialogue.ts, line 589 (I think). I'll look into it, unless we still want to depend on the return value of the dialogue function (current solution)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants