Wow please re-write your dialogue system it's terrible.
|
|
INFO:
In this tutorial i'll show how you make a dialogue when the NPC asks if you wanted to be taken to his... (in this case thieving stalls) I'll show how you add clickable options if you want to be taken to the (stalls) or not.
P.S this is my first tutorial and i'm sure alot of people know about this already but i might help one individual or two.
Spawn a NPC
Spawn the NPC you want to create a dialogue to, or if you want to create a dialogue to a existing NPC look up the NPC ID we'll need that later.
In this tutorial i'll use Martin Thwait as a example (NPC ID = 2270)
Adding what the NPC will say
Now we want to add what the NPC will say,
open DialogueHandler.java
Hold in CTRL + F and search for case 13 (if you're on PI this will take you to duradel's dialogue)
Under duradels dialogue we'll create a new one, so lets start with paste this under duradel's dialogue:
Example:case (USE SOMETHING THAT DON'T EXISIST):
sendNpcChat4("1", "2", "3", "4," c.talkingNpc, "(NPC Name)");
c.nextChat = 0;
break;
Alright so the second line starts with "sendNpcChat4" that's how many lines your NPC will saycase 1337:
sendNpcChat4("1", "2", "3", "4," c.talkingNpc, "Martin Thwait");
c.nextChat = 0;
break;
so if 4 is too much you just change that to 3,2 or 1.
Let's say Martin asks me if i want to be teleported to his thieving stalls and it should be 3 lines long.
case 1337:
sendNpcChat3("Hello!", "My name is Martin and I am a master of the thieving skill.", "Do you want me to take you to my stalls?", c.talkingNpc, "Martin Thwait");
c.nextChat = 0;
break;
Then it will looks something like this:
now we're on the third line wich is "c.nextChat = 0;" basiclly if we want this chat to continue (wich we want)
the next case number (to reply on Martin's question "Do you want to me to take you to my stalls?" will we replace with the "0")
This number will connect with a new case we'll make later so choose a number that HAVE NOT been used in a case.
I'll go with 365.
How to make the dialogue show when you talk to your NPCcase 1337:
sendNpcChat3("Hello!", "My name is Martin and I am a master of the thieving skill.", "Do you want me to take you to my stalls?", c.talkingNpc, "Martin Thwait");
c.nextChat = 365;
break;
open up ActionHandler.java
hold CTRL + F and search for
Under that addpublic void firstClickNpc(int i)
In my case the i'll replace the *** with 2270 cause that's my NPCs ID but you replace it with yours.case ***:
c.getDH().sendDialogues(0, i);
break;
Now we need replace the 0 with what the case Id was in DialogueHandler so our NPC will say the right Dialogue.case 2270:
c.getDH().sendDialogues(0, i);
break;
case 2270:
c.getDH().sendDialogues(1337, i);
break;
Adding clickable options
Go back to DialogueHandler.java
Under what you earlier wrote in DialogueHandler copy and paste in this.
Remember that i said replace the 0 in c.nextChat = 0; with a random number that was not used in a case?case ***:
sendOption2("1", "2");
c.dialogueAction = 0;
break;
Replace *** with that number, since i chosed 365 i'll replace it with that.
Now we need to come up with 2 options the players who talked with the NPC can reply with.case 365:
sendOption2("1", "2");
c.dialogueAction = 0;
break;
Since i chosed a question about "Do you want me to take you to my stalls?" I'll have to go with "Yes" and "No"
So in my case i'll replace the "1" and "2" with "Yes" and "No"
case 365:
sendOption2("Yes", "No");
c.dialogueAction = 0;
break;
Now we need to replace the 0 with a random number, remember once again it need to be something that dosen't exisist.
I'll replace it with 1014
Now let's open ClickingButtons.javacase 365:
sendOption2("Yes", "No");
c.dialogueAction = 1014;
break;
hold CTRL + F search for "barrows tele" scroll down abit til you see something like this:
Above that add this:} else if (c.dialogueAction == 2) {
c.getPA().movePlayer(2507, 4717, 0);
} else if (c.dialogueAction == 5) {
c.getSlayer().giveTask();
} else if (c.dialogueAction == 6) {
c.getSlayer().giveTask2();
} else if (c.dialogueAction == 7) {
c.getPA().startTeleport(3088,3933,0,"modern");
c.sendMessage("NOTE: You are now in the wilderness...");
} else if (c.dialogueAction == 8) {
c.getPA().resetBarrows();
c.sendMessage("Your barrows have been reset.");
}
Now replace the first 4 **** with what you wrote in the DialogueHandler,} else if (c.dialogueAction == ****) {
c.getPA().movePlayer(****, ****, 0);
case 365:
sendOption2("Yes", "No");
c.dialogueAction = 1014;
break;
Now write your coordinates where you should get teleported if you reply "yes"} else if (c.dialogueAction == 1014) {
c.getPA().movePlayer(****, ****, 0);
} else if (c.dialogueAction == 1014) {
c.getPA().movePlayer(2765, 2769, 0);
Compile and restart your server and it should work, if you have any questions feel free to ask!
Wow please re-write your dialogue system it's terrible.

I think i looks better if you use a teleport animation, not only the move player code.
TYVMMMMMMMM helpfull and no errors.
| « Redone Shop System | [PI] New Trade Screen, Wealth Transfer, Total Offer Item Value, Dupes Fixed » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |
| Tags for this Thread |