Jump to content

How to talk with NPC in Tutorial Island?


trainux

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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