Purpose: To make so when you click an object, you get npc dialog.
Difficulty: Easy
Server Base: Any
Classes Modified: Client.java
Ok, let's get started. First open up your client.java and search for:
- Code:
-
// first Click npc
Now scroll down, until you see this:
- Code:
-
NpcWanneTalk = A NUMBER WILL BE HERE;
Now look for the last little piece of code that has that in it. And below it add this:
- Code:
-
else if (NPCID == NPC ID HERE) {
skillX = server.npcHandler.npcs[NPCSlot].absX;
skillY = server.npcHandler.npcs[NPCSlot].absY;
NpcWanneTalk = CASE NUMBER HERE;
Now where it says NPC ID HERE of course you put the id of the NPC so let's use 656 as an example. Now where it says CASE NUMBER HERE you put in the case number where your NPC Dialog information will be, don't worry I'll get to that soon. So let's use 100 as our case number for an example.
Ok now your code should look like this:
- Code:
-
else if (NPCID == 656) {
skillX = server.npcHandler.npcs[NPCSlot].absX;
skillY = server.npcHandler.npcs[NPCSlot].absY;
NpcWanneTalk = 100;
Ok good. Now search for the following:
- Code:
-
case 1306:
If you don't have that, you should, but if you don't search for this:
- Code:
-
case "ID OF AN OBJECT IN YOUR SERVER":
For you people that would keep "ID OF AN OBJECT IN YOUR SERVER" there, don't. Do what it says.
Ok so after when you search that in, you should see "break;" after all the codes in that case. Well after "break;" press enter. So after we press enter paste the following:
- Code:
-
case YOUROBJECTID:
VoidForDialog();
break;
Ok so replace YOUROBJECTID with the object id that you want to click so the npc dialog shows. Let's use 300 as an example, which is a hay stack.
Now add this void:
- Code:
-
public void VoidForDialog() {
sendFrame200(4901, 591);
sendFrame126(GetNpcName(NpcTalkTo), 4902);
sendFrame126("", 4903);
sendFrame126("This is PRIVATE PROPERTY!", 4904);
sendFrame126("Get away from here now!", 4905);
sendFrame126("", 4906);
sendFrame75(NpcTalkTo, 4901);
sendFrame164(4900);
NpcDialogueSend = true;
}
There! Now your done! Click your object and it should do something like this:
Thanks for reading this tutorial! Hoped it helped!
Credits: Purehit, Seven Lives (Both Me)