Jump to content

How to talk with NPC in Tutorial Island?


Recommended Posts

Posted (edited)

According to my logic, this fragment should work to talk to an NPC of Tutorial Island.

if(dialogues.inDialogue()) {
	if(!dialogues.isPendingContinuation()) {
		if(dialogues.clickContinue()) {
			dialogues.clickContinue();
		}
	}
}else {
	NPC tuto2 = npcs.closest("Survival Expert");
	if(tuto2.isVisible()){
		tuto2.interact("Talk-to");
	}else{
		getCamera().toEntity(tuto2);
	}
}

But in Tutorial Island the annoying messages appear that seem to dialogue with another NPC but they are not.

I attach the image specifying the message to which I refer.

https://photos.app.goo.gl/3ta5FZpqZNg8EfSM6

Edited by trainux
Posted (edited)

Well firstly @trainux, don't check if getDialogues().inDialogue(), because as you said yourself, the player is always in a dialogue.

Whenever you are talking to an NPC on the island the "Click here to continue" / "Click to continue" widget will be visible. So just check for that instead.

Just look at my open source script https://github.com/Explv/Tutorial-Island

Edited by Explv
  • Like 1
Posted
2 minutes ago, Explv said:

Well firstly @trainux, don't check if getDialogues().inDialogue(), because as you said yourself, the player is always in a dialogue.

Whenever you are talking to an NPC on the island the "Click here to continue" / "Click to continue" widget will be visible. So just check for that instead.

Just look at my open source script https://github.com/Explv/Tutorial-Island

Your island code is free, I did not know, I will use it to guide me.
Thanks brother.

Posted
Quote

NPC tuto2 = npcs.closest("Survival Expert");
    if(tuto2.isVisible()){
        tuto2.interact("Talk-to");
    }else{
        getCamera().toEntity(tuto2);
    }

Don't write in camera code, interact does it for you. Also interaction event has specific requirements on whats visible or not, so its possible your script stalls forever.
 

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...