Purpose: For people who can't figure this out
Difficulty: 5/10
Assumed Knowledge: How to access basic server files
Classes Modified: DialogueHandler, ClickingButtons, ActionHandler, Spawn-Config.cfg
Tested On(if it applies): Project Insanity
***Please note: If you are going to flame this because you already know how to do it, there is no need at all, I could really care less. It is here for people to learn and improve their skills.***
Alright Making a quick tutorial on how to make a Npc dialogue like this:
Step 1. Open up Spawn-Config.cfg and add in this:
Code:
spawn = 599 3193 3425 0 0 0 0 0 Wizard
I am making a wizard do the teleport options.
I'm assuming you know how to change the Npc Id and other configurational settings in it already so lets move on.
Step 2:
Open up ActionHandler.java and insert this:
Code:
case 599:
c.getDH().sendDialogues(100, npcType);
break;
Please note that the... (100, npcType); ...is the Dialogue you want to pull up.
The case 599: is the npc id that we want to initiate the dialogue sequence.
We are pulling up Dialogue 100.
Step 3:
Open up DialogueHandler.java and insert this under your last "case":
Code:
case 100:
sendOption5("Tormented Demons", "Corporeal Beast", "Godwars", "Chaos Elemental", "Dagganoths");
c.teleAction = 45;
break;
Case 100 is the dialogue we want to pull up.
SendOption5 is the choices we would like to give our users.
c.teleAction = 45 is the id so the computer knows were doing those options and not some other option like runecrafting teleports etc...
Step 4:
Now that all of that is added on to the part the most people mess up on and do not understand.
Open up ClickingButtons.java and press ctrl + F to navigate to this line of code:
Right under that there should be an if-statement that teleports you somewhere.
You have two options now with this piece of code we are going to insert.
Code:
if (c.teleAction == 45) {
//tormented demons
c.getPA().spellTeleport(2717, 9802, 0);
c.sendMessage("You teleport to the Tormented Demons chamber!");
First option: if you want to throw it right under the case 9190: you will be using the above code:
Second option: if you want to put it further into the case you will have to use the else- if statement as shown below.
Code:
} else if (c.teleAction == 45) {
//tormented demons
c.getPA().spellTeleport(2717, 9802, 0);
c.sendMessage("You teleport to the Tormented Demons chamber!");
Always make sure to close with a "}" or your code will not run.
Now your probably wondering how do I know the correct case for putting the code in?
Let me explain...
When you click an option your server command prompt window should tell you the action button id (if you have server debugging turned ON)
So clicking that we know that our 5 lines are going to be:
You can now finish adding your if - statements to the cases going in order from 9190 and down for every chat line.
And you have learned that the c.teleAction is used to identify which teleport you want to call.
You may want to make your c.teleAction = -1 at the end of your if statements but it is completely up to you.
I hope you have learned alot from my tutorial. Thanks for reading!
Post any Errors/Questions.