Description: To add npc options to a npc dialogue
Difficulty: 1
Assumed Knowledge: C+P
Tested Server: Cleaned v4
Files/Classes Modified: Client.java
Procedure
Step 1: Open clint.java and search:
under:
Code:
switch(actionButtonId) {
add:
Code:
case 9157:
break;
case 9158:
break;
case 9157 ill be the top option and 9158 will be the bottom
Step 2: Do something happend when they click option.
Lets say u want it to make it so if click first option they tele.
add this to case 9157:
Code:
if (NpcDialogue == ##) {
PutNPCCoords = true;
teleportToX = --;
teleportToY = ++;
RemoveAllWindows();
}
every time u add one to this u have to tell the server at wat dialogue is this so that why we add: if (NpcDialogue == ##) { change the ## to ur dialogues case. ++ and -- are ur teleport cords and lets say u want to make it seconds option close it. add this to case 9158:
Code:
if (NpcDialogue == ##) {
RemoveAllWindows();
}
That basicaly how in the codes is it wroten it remove all windows so when they click it it will close all but u can make with case 9158 w/e u want just add the code in there and when u click the option will make effect case 9158 aint always for closing.
Step 3: Adding the options appear in dialogue.
go to public void updatenpcchat and add:
Code:
case ##:
sendFrame171(1, 2465);
sendFrame171(0, 2468);
sendFrame126("Choose an option", 2460);
sendFrame126("Yes, please", 2461);
sendFrame126("No, Thanks", 2462);
sendFrame164(2459);
NpcDialogueSend = true;
break;
This works like ur normals dialogues just that were it says yes,please and no,thanks u can change to any option u want
yes please is case 9157 and no, thanks is case 9158
If u dont have delcare: (ONLY IF U DONT HAVE!)
Code:
public void sendFrame126(String s, int id) {
outStream.createFrameVarSizeWord(126);
outStream.writeString(s);
outStream.writeWordA(id);
outStream.endFrameVarSizeWord();
flushOutStream();
}
public void sendFrame171(int MainFrame, int SubFrame) {
outStream.createFrame(171);
outStream.writeByte(MainFrame);
outStream.writeWord(SubFrame);
flushOutStream();
}
public void sendFrame164(int Frame) {
outStream.createFrame(164);
outStream.writeWordBigEndian_dup(Frame);
flushOutStream();
}
Best i could explain
Credits: ME