This is for a 614 server btw
Ok, so I wanted my santa guy to do some stuff. The santa npc has an id of 1552. I added this file called npc1552.
Code:
package dragonkk.rs2rsps.scripts.dialogues;
import dragonkk.rs2rsps.scripts.dialogueScript;
import dragonkk.rs2rsps.util.Misc;
public class npc1552 extends dialogueScript {
@Override
public void run(short inter, byte child) {
switch(this.stage) {
case 0:
if(inter == 241 && child == 5) {
String[] talkDefinitions = new String[]{"Santa", "Merry Christmas, pal!"};
this.sendEntityDialogue(SEND_1_TEXT_CHAT, talkDefinitions, false, (short)-1, SEND_NO_EMOTE);
this.stage = 1;
}
break;
case 1:
if(inter == 241 && child == 5) {
String[] talkDefinitions = new String[]{Misc.formatPlayerNameForDisplay(p.getDisplayName()), "A Merry Christmas to you too, Santa."};
this.sendEntityDialogue(SEND_1_TEXT_CHAT, talkDefinitions, true, (short)-1, SEND_NO_EMOTE);
this.stage = 2;
}
break;
case 2:
if(inter == 241 && child == 5) {
String[] talkDefinitions = new String[]{Misc.formatPlayerNameForDisplay(p.getDisplayName()), "But it isn't even Christmas yet!?"};
this.sendEntityDialogue(SEND_1_TEXT_CHAT, talkDefinitions, true, (short)-1, SEND_NO_EMOTE);
this.stage = 3;
}
break;
case 3:
if(inter == 241 && child == 5) {
String[] talkDefinitions = new String[]{"Santa", "I say it is!", "And as long as I am standing here you can do", "the Christmas Event!"};
this.sendEntityDialogue(SEND_2_TEXT_CHAT, talkDefinitions, false, (short)-1, SEND_NO_EMOTE);
this.stage = 4;
}
break;
case 4:
if(inter == 241 && child == 5) {
String[] talkDefinitions = new String[]{"Santa", "Do you want me to teleport you to the event?"};
this.sendEntityDialogue(SEND_2_TEXT_CHAT, talkDefinitions, false, (short)-1, SEND_NO_EMOTE);
this.stage = 5;
}
break;
case 5:
if(inter == 242 && child == 6) {
String[] talkDefinitions = new String[]{Misc.formatPlayerNameForDisplay(p.getDisplayName()), "Certainly.", "No thank you."};
this.sendEntityDialogue(SEND_2_OPTIONS, talkDefinitions, true, (short)-1, SEND_NO_EMOTE);
this.stage = 6;
}
break;
default:
this.finish();
break;
}
}
@Override
public void start() {
String[] talkDefinitions = new String[]{Misc.formatPlayerNameForDisplay(p.getDisplayName()), "Hi Santa! What are you doing here?"};
this.sendEntityDialogue(SEND_1_TEXT_CHAT, talkDefinitions, true, (short)-1, SEND_NO_EMOTE);
this.stage = 0;
}
}
I know the dialogue is stupid it was just for testing purposes. With the following code I can make the dialogue start:
Code:
} else if (cmd[0].equals("santadialogue")) {
p.getDialogue().startDialogue("npc1552");
But how can I make the dialogue start when you talk to the santa npc? I looked around in a lot of filed and couldn't find it. Help is really appreaciated.
Edit: if you know how to open a shop when you talk to an npc is would be very nice if you told me how to do that too, although I guess it is done sort of the same way a s a dialogue (but you need to have made a shop to ofc.)