Thread: [PI] NPC Dialogue With Teleport Option (GUIDE!)

Results 1 to 8 of 8
  1. #1 [PI] NPC Dialogue With Teleport Option (GUIDE!) 
    Registered Member
    Join Date
    Jul 2014
    Posts
    66
    Thanks given
    1
    Thanks received
    0
    Rep Power
    11
    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:

    case (USE SOMETHING THAT DON'T EXISIST):
    sendNpcChat4("1", "2", "3", "4," c.talkingNpc, "(NPC Name)");
    c.nextChat = 0;
    break;
    Example:

    case 1337:
    sendNpcChat4("1", "2", "3", "4," c.talkingNpc, "Martin Thwait");
    c.nextChat = 0;
    break;
    Alright so the second line starts with "sendNpcChat4" that's how many lines your NPC will say
    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.

    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 = 365;
    break;
    How to make the dialogue show when you talk to your NPC
    open up ActionHandler.java
    hold CTRL + F and search for

    public void firstClickNpc(int i)
    Under that add

    case ***:
    c.getDH().sendDialogues(0, i);
    break;
    In my case the i'll replace the *** with 2270 cause that's my NPCs ID but you replace it with yours.


    case 2270:
    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(1337, i);
    break;

    Adding clickable options

    Go back to DialogueHandler.java
    Under what you earlier wrote in DialogueHandler copy and paste in this.

    case ***:
    sendOption2("1", "2");
    c.dialogueAction = 0;
    break;
    Remember that i said replace the 0 in c.nextChat = 0; with a random number that was not used in a case?
    Replace *** with that number, since i chosed 365 i'll replace it with that.

    case 365:
    sendOption2("1", "2");
    c.dialogueAction = 0;
    break;
    Now we need to come up with 2 options the players who talked with the NPC can reply with.
    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

    case 365:
    sendOption2("Yes", "No");
    c.dialogueAction = 1014;
    break;
    Now let's open ClickingButtons.java

    hold CTRL + F search for "barrows tele" scroll down abit til you see something like 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.");
    }
    Above that add this:

    } else if (c.dialogueAction == ****) {
    c.getPA().movePlayer(****, ****, 0);
    Now replace the first 4 **** with what you wrote in the DialogueHandler,

    case 365:
    sendOption2("Yes", "No");
    c.dialogueAction = 1014;
    break;

    } else if (c.dialogueAction == 1014) {
    c.getPA().movePlayer(****, ****, 0);
    Now write your coordinates where you should get teleported if you reply "yes"

    } 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!
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Dec 2010
    Posts
    354
    Thanks given
    17
    Thanks received
    61
    Rep Power
    47
    Wow please re-write your dialogue system it's terrible.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jul 2014
    Posts
    66
    Thanks given
    1
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by dan0194 View Post
    Wow please re-write your dialogue system it's terrible.
    I've just coded for a couple days haha... i but i thought i would share how i make a dialogue and tele options.
    Tho i know it's terrible x)
    Reply With Quote  
     

  4. #4  
    Registered Member
    Optimum's Avatar
    Join Date
    Apr 2012
    Posts
    3,517
    Thanks given
    830
    Thanks received
    1,580
    Discord
    View profile
    Rep Power
    5000
    could help new people thanks for the contribution

    Quote Originally Posted by DownGrade View Post
    Don't let these no life creeps get to you, its always the same on here. They'd rather spend hours upon hours in the rune-server spam section then getting laid! ha ha!Its honestly pathetic i haven't seen so many lowlifes in my life its actually insane i wish that this section would just vanish its probably the only way to get these people out of the community...
    PLEASE BE AWARE OF IMPOSTERS MY DISCORD ID: 362240000760348683
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jul 2014
    Posts
    66
    Thanks given
    1
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Optimum View Post
    could help new people thanks for the contribution
    I'm new and i had some trouble with this and i didnt find a good guide so i figure out i might as well help out people that was in my seat
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Sep 2013
    Posts
    142
    Thanks given
    7
    Thanks received
    2
    Rep Power
    11
    I think i looks better if you use a teleport animation, not only the move player code.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Jul 2014
    Posts
    66
    Thanks given
    1
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Steen View Post
    I think i looks better if you use a teleport animation, not only the move player code.
    Yeah true
    Reply With Quote  
     

  8. #8  
    Donator
    Dunpk's Avatar
    Join Date
    Apr 2014
    Posts
    145
    Thanks given
    26
    Thanks received
    13
    Rep Power
    15
    TYVMMMMMMMM helpfull and no errors.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 1
    Last Post: 11-21-2012, 02:06 AM
  2. [Pi] NPC Dialogue Help
    By Mayday Parade in forum Help
    Replies: 5
    Last Post: 08-20-2011, 10:55 PM
  3. [PI] Npc which open's Option's to Teleport
    By Zerk3r in forum Tutorials
    Replies: 15
    Last Post: 03-26-2011, 09:36 PM
  4. [PI] NPC Dialogue - Small Problem $10 [PI]
    By NathanCoder in forum Help
    Replies: 10
    Last Post: 10-16-2010, 12:36 PM
  5. Replies: 5
    Last Post: 03-06-2010, 11:51 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •