PServ
November 21, 2009, 10:20:34 pm
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to SMF For Free
 
   Home   Help Search Staff List Login Register  

Pages: [1]
 1 
 on: June 13, 2008, 11:53:00 am 
Started by izzygoo - Last post by izzygoo
I hate to say this but, reply even if you look at it.

In my tutorial i will show and explain to you, how to add npcs with chat box text,making them show you an interface (like the makeovermage), and also making them teleport you somewhere in dialogue.

Source used = Figmentscape.

Difficulty = 3/10  ( Basicly just knowing a bit of java and some java knowledge.)

Things that will be changed = Client.java.

Tutorial Credits = This is my personal method of Npc dialogue, I have taken it and "watered it down" so even beginners may understand it.

Lets get started Shall we?

THIS IS ADDING NPCDIALOGUE IN THE CHATBOX

PLEASE NOTE THIS IS ADDING THE VOID, IF YOU ALREADY HAVE THE VOID ADDED (search for it to see) THEN SKIP THIS STEP

First of all, you will need to add the void for your npc dialogue.
mine it looks like this.

Also mine is placed right after the shops handler.


Code:
public void UpdateNPCChat() {
/*sendFrame126("", 4902);
sendFrame126("", 4903);
sendFrame126("", 4904);
sendFrame126("", 4905);
sendFrame126("", 4906);*/
sendFrame126("", 976);
switch (NpcDialogue) {
All that is saying is, to send frames (in this case pictures and menu states) and the numbers are basicly the picture ids.

PEOPLE WHO HAD THE VOID START BACK HERE

Next you will need to make a case.


if you dont have any npc dialogue then skip this past this part this one is for the people that do


If you already have dialogue on your server, then find the last case of npc dialogue and make it a number after it...for instance.

case 25
(code)
(code)

the case you make would be one number after the last one.

case 26
(code)
(code)


Right so, if you DONT have ANY Npcdialogue in your server at all then.. make case 1...for instance here is my case 1


Code:
case 3:
                  sendFrame200(4883, 591);
                  sendFrame126(GetNpcName(NpcTalkTo), 4884);
                  sendFrame126("blah blah blah blah blah", 4885);
                  sendFrame75(NpcTalkTo, 4883);
                  sendFrame164(4882);
                  NpcDialogueSend = true;
                  break;
Right, the sendframes are of course telling it what to send to you that the player sees, while in the npcdialogue chatbox.

Also  the   sendFrame126(GetNpcName(NpcTalkTo),   is telling it, to get the name of your npc that you are speaking to. in this    sendFrame126("blah blah blah blah blah", 4885);   that is where you want to add your text, in between the quotation marks. Also the npcdialoguesend = true;  ...does it really need explaining?

Okay, and if you wanted to make anymore dialouge, then you add another case and go from there.

Next up!  search for case 40 until you see something that looks like this.


Code:
case 40:
           if (NpcDialogue == # || NpcDialogue == # || NpcDialogue == # ||  {
           NpcDialogue += #;
           NpcDialogueSend = false;
           } else if (NpcDialogue == 3 || NpcDialogue == 7 || NpcDialogue == 300  {
           NpcDialogue = 1;
           NpcDialogueSend = false;
           RemoveAllWindows();
That is the case that handles your npc dialogue, ok, you see


Code:
if (NpcDialogue == # || NpcDialogue == # || NpcDialogue == # ||  {
           NpcDialogue += #;
the  npcdialogue == #  is what your npcid who is talking will be so if your npcid  is hans, you would do this. if (NpcDialogue == 0 || and so on and so forth.

the    NpcDialogue += #;   is what is adding up your cases of npc dialogue, so however many cases you have of npcdialouge for that npc that is the number you would put in the #, for instance.

If you have  4 cases of npc dialogue you would put


Code:
NpcDialogue += 4#;
One more thing left for basic npcdialogue (I almost forgot   )

Okay next is the easiest part.

You need to add this in, for npc dialogue.


Code:
} else if (NPCID == #) {
           skillX = server.npcHandler.npcs[NPCSlot].absX;
           skillY = server.npcHandler.npcs[NPCSlot].absY;
           NpcWanneTalk = 1339;
Mine is placed beneath fishing, and above shops.


     OK NOW WE ARE DONE WITH THAT, NOW...FOR THE FUN STUFF!

Making a npc show a menu like the makeovermage for instance


This is really really easy, to make it bring up an interface.

After the npc's dialogue case then this will make the npc bring up an interface.


Code:
case #:
          showInterface(3559);
          NpcDialogue = 0;
          break;
That is to be added after a npc's dialogue case, you can prolly add it into a case but this will be easier for you.
the  showInterface(3559);   is telling it, to bring up that interface, in this case it's the charactermakermenu. You can replace that with any interface you wish.


NOW IS MAKING A NPC TELE YOU SOMEWHERE IN CHAT

This is really really easy also!

simply find the case you wish it to tele you in and add it after what it says for instance like this.


Code:
case #:
                      sendFrame200(4883, 591);
                      sendFrame126(GetNpcName(NpcTalkTo), 4884);
            sendFrame126("blah blah blah blah blah blah blah", 4885);
            sendFrame126("Click here to continue", 4886);
            sendFrame75(NpcTalkTo, 4883);
            sendFrame164(4882);
            NpcDialogueSend = true;
            teleportToX = ####;
            teleportToY = ####;
                      break;
Simply add    teleportToX = ####;
         teleportToY = ####;
Into your case.                                  ( the #### are the coords you enter.....)


 Thank you very much for allowing me to post on these great formus, I hope you found my tutorial helpful. Also i do not leech, and do NOT wish to be called a leecher, if you tell me i leeched this when obviously i didnt, it WILL BE REMOVED. Thank you, and have a nice day.

   **** this tutorial was brought to you by Izzygoo  also please note. im not going to post pictures..no need to ****

 2 
 on: June 09, 2008, 07:54:37 pm 
Started by Pserv - Last post by Pserv
Please do not post any guides regarding anything but programming.

 3 
 on: June 09, 2008, 07:21:15 pm 
Started by Pserv - Last post by Pserv
MySql Database is a free Database. You may store a limited amount of files in it for free.

 4 
 on: June 09, 2008, 06:50:55 pm 
Started by Pserv - Last post by Pserv
Welcome to my Programming Community. I hope you enjoy your visit.

Pages: [1]
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2006, Simple Machines LLC
ServerBeach Coupon
Page created in 0.253 seconds with 10 queries.