Pylon-Scape
Welcome to PylonScape forums!
Pylon-Scape
Welcome to PylonScape forums!
Pylon-Scape
Would you like to react to this message? Create an account in a few clicks or log in to continue.


ip: pylonscape.no-ip.biz
 
HomeSearchLatest imagesRegisterLog in

 

 [TUT] How to make NPC Dialogues [TUT]

Go down 
3 posters
AuthorMessage
Someguy
Admin
Someguy


Number of posts : 58
Pts : 1212
Registration date : 2009-03-08
Location : Streetz...

[TUT] How to make NPC Dialogues [TUT] Empty
PostSubject: [TUT] How to make NPC Dialogues [TUT]   [TUT] How to make NPC Dialogues [TUT] I_icon_minitimeWed Apr 01, 2009 5:16 am

Purpose: Teach you how to make npc dialogues.

Difficulty: 7-9

Assumed Knowledge: you should know how to add voids

Server Base: Czar (should work on all)

Classes Modified: client.java


NOTE: if your new at coding or havent coded anything like this in before then backup your files just incase you go wrong and you dont know how to fix it.


procedure
Step 1

ok first of all you need to do is edit your client.java so you wont need any other files open.

First of you get the id of the npc you want to be made to talk, so I will use 1002 as an example (please not I don’t know which npc 1002 is, this is only an example) ok now look for
Code:
Code:

 case 155: //first Click npc
now scroll down till you see something like :

Code:
Code:

 } else if (NPCID == 494 || NPCID == 495) { /*Banking*/
               skillX = server.npcHandler.npcs[NPCSlot].absX;
               skillY = server.npcHandler.npcs[NPCSlot].absY;
               NpcWanneTalk = 1;
            }

step 2

Under that add your npc so , like this :
Code:
Code:

else if (NPCID == 1002) {//the npc 1002   
              skillX = server.npcHandler.npcs[NPCSlot].absX;
              skillY = server.npcHandler.npcs[NPCSlot].absY;
              NpcWanneTalk = 1339;
}

step 3

The two parts in bold are very important, the first one – 1002 has to be your npc id , so whatever the npc id is it has to go in here and the second bold 1339 is a case…. Now you need to make cases for the chat and cases for the accepting or declining.

Ok now for the cases look for
Code:
Code:

 public void UpdateNPCChat() {
now under that you will see case1 , case 2, and so on…. Now add in your case so do this….

Code:
Code:

  case 1339:
            sendFrame126(GetNpcName(NpcTalkTo), 4902);
            sendFrame126("", 4903);
            sendFrame126("HEY WHATS UP ADD YOUR TEXT HERE", 4904);
            sendFrame126("MORE TEXT HERE", 4905);
            sendFrame126("", 4906);
            sendFrame75(NpcTalkTo, 4901);
            sendFrame164(4900);
            NpcDialogueSend = true;
            break;

now if you want there to be a choice dialogue then you need to add another case like so :
Code:
Code:

 case 1340:
            sendFrame171(1, 2465);
            sendFrame171(0, 2468);
            sendFrame126("Select an Option", 2460);
            sendFrame126("Yes, please", 2461);
            sendFrame126("No, Thank you.", 2462);
            sendFrame164(2459);
            NpcDialogueSend = true;
            break;

now notice how that case is
Code:
Code:

case 1340:
and the one before was
Code:
Code:

case 1339:
that’s because you need them to come one after the other so if I chose … 10 i would need cases 10 and 11…..

step 4
right now search for: case 40: and it should look something like this…..
Code:
Code:

 case 40:
            if (NpcDialogue == 1 || NpcDialogue == 3 || NpcDialogue == 5  || NpcDialogue == 40 || NpcDialogue == 42

now on this bit :
Code:
Code:

 if (NpcDialogue == 1 || NpcDialogue == 3 || NpcDialogue == 5  || NpcDialogue == 40 || NpcDialogue == 42 || NpcDialogue == 1001 || NpcDialogue == 1002 || NpcDialogue == 2259 || NpcDialogue == 2260 || NpcDialogue == 301 || NpcDialogue == 305 || NpcDialogue == 308 || NpcDialogue == 309 || NpcDialogue == 313 || NpcDialogue == 314 || NpcDialogue == 317 || NpcDialogue == 318 || NpcDialogue == 319 || NpcDialogue == 322 || NpcDialogue == 323 || NpcDialogue == 14600 || NpcDialogue == 14602) {

Add the
Code:
Code:

 NpcDialogue == 1339
onto the end so make the above stuff look like this….(the bit in bold is what we just added)

Code:
Code:

if (NpcDialogue == 1 || NpcDialogue == 3 || NpcDialogue == 5  || NpcDialogue == 40 || NpcDialogue == 42 || NpcDialogue == 1001 || NpcDialogue == 1002 || NpcDialogue == 2259 || NpcDialogue == 2260 || NpcDialogue == 301 || NpcDialogue == 305 || NpcDialogue == 308 || NpcDialogue == 309 || NpcDialogue == 313 || NpcDialogue == 314 || NpcDialogue == 317 || NpcDialogue == 318 || NpcDialogue == 319 || NpcDialogue == 322 || NpcDialogue == 323 || NpcDialogue == 14600 || NpcDialogue == 14602[b] || NpcDialogue == 1339[/b]) {

case 40 makes anything number in the above code (which are cases in ure source) be +1 so it makes case 1339 move onto case 1340 once you click continue

ok now onto the part where if you chose “Yes, please “ or “no thank you”

step 5
ok now first is the “yes, please” ok clicking this option (which is also the first option in the dialogue) will require some coding in case 9157:
so look for case 9157: and you should see something like this :

Code:
Code:

 case 9157:
                  if (NpcDialogue == 2) {
                     NpcDialogue = 0;
                     NpcDialogueSend = false;
                     openUpBank();
                  } else if (NpcDialogue == 4) { //Aubury
                     NpcDialogue = 0;
                     NpcDialogueSend = false;
                     openUpShop(2);
                  }

So the
Code:
Code:

 if (NpcDialogue == 2) {
refers to the cases we were discussing earlier, and the
Code:
Code:

 NpcDialogue = 0;
                     NpcDialogueSend = false;
                     openUpBank();


Is what it does once you have clicked on the “yes, please” , so using our example we will add our code (we will pretend it was to get teleported somewhere)

Add this near the others
Code:
Code:

 else if (NpcDialogue == 1340) { //npc 1002
                     NpcDialogue = 0;
                     NpcDialogueSend = false;
                     teleportToX = 1234;
                     teleportToY = 1234;
                  }

The
Code:
Code:

 else if (NpcDialogue == 1340)
has to be the case the “yes, please” and “no, thank you” are on… so if I made the “1340” into “1341” it wouldn’t work or even “1339” wouldn’t work ok? Got it ? good

step 6
Ok now for the “no, thank you” ok clicking this option (which is the second option in the dialogue) which will require some coding in case 9158:
So look for case 9158: (under case 9157: ) and you will see something like this :
Code:
Code:

 case 9158:
                  if (NpcDialogue == 2) {
                     NpcDialogue = 0;
                     NpcDialogueSend = false;
                     openUpPinSettings();
                  } else if (NpcDialogue == 4) {
                     NpcDialogue = 5;
                     NpcDialogueSend = false;
                                    }else if (NpcDialogue == 41){
                    NpcDialogue = 0;
                    NpcDialogueSend = false;
                    RemoveAllWindows();
                  }

So this has the same concept as the case 9157, meaning that the
Code:
Code:

 else if (NpcDialogue == 1340)
has to be 1340 (remember this is just an example number),
Code:
Code:

                    NpcDialogue = 0;
                    NpcDialogueSend = false;
                    RemoveAllWindows();

This code above is very important….. the
Code:
Code:

 NpcDialogue = 0;
tells the server that the next dialogue to appear is 0, which means no more dialogues will appear, but you could have it as
Code:
Code:

 NpcDialogue = 6678;
or something like that and it would load whatever is in case 6678:, the code below is also important
Code:
Code:

 NpcDialogueSend = false;
                    RemoveAllWindows();

as it stop the server from sending the dialogue and then it closes the dialogue screen.

And that’s it, hope you enjoyed the tut and now understand how to add dialogues



credits: -fedexer- (some random guy that i dont know...)


Want more intresting tutorials? PM me.
Back to top Go down
http://pylonscape.co.uk
thequestnoob

thequestnoob


Number of posts : 104
Pts : 4347
Registration date : 2009-03-27
Location : Stop Looking At Me...

[TUT] How to make NPC Dialogues [TUT] Empty
PostSubject: Re: [TUT] How to make NPC Dialogues [TUT]   [TUT] How to make NPC Dialogues [TUT] I_icon_minitimeThu Apr 02, 2009 10:03 am

looks eazy xp coding WoW server's is more deficult (same for SA-MP*) servers x) (i got both)





*=San Andreas - Multy player server (online private san andreas servers)
Back to top Go down
Someguy
Admin
Someguy


Number of posts : 58
Pts : 1212
Registration date : 2009-03-08
Location : Streetz...

[TUT] How to make NPC Dialogues [TUT] Empty
PostSubject: Re: [TUT] How to make NPC Dialogues [TUT]   [TUT] How to make NPC Dialogues [TUT] I_icon_minitimeTue Apr 07, 2009 6:53 am

i had a wow server but thats on my laptop atm i dont use the laptop often and i go on gtasamp its awsome
Back to top Go down
http://pylonscape.co.uk
thequestnoob

thequestnoob


Number of posts : 104
Pts : 4347
Registration date : 2009-03-27
Location : Stop Looking At Me...

[TUT] How to make NPC Dialogues [TUT] Empty
PostSubject: Re: [TUT] How to make NPC Dialogues [TUT]   [TUT] How to make NPC Dialogues [TUT] I_icon_minitimeTue Apr 07, 2009 11:18 am

Someguy wrote:
i had a wow server but thats on my laptop atm i dont use the laptop often and i go on gtasamp its awsome
hehe wat server? x)

(reinstalling san andreas atm and sa-mp my c drive got repleaced with new one and everything is gone Sad )
Back to top Go down
Ryan0123

Ryan0123


Number of posts : 225
Pts : 10156
Registration date : 2009-03-08
Location : ScotlanD!

[TUT] How to make NPC Dialogues [TUT] Empty
PostSubject: Re: [TUT] How to make NPC Dialogues [TUT]   [TUT] How to make NPC Dialogues [TUT] I_icon_minitimeTue Apr 07, 2009 12:55 pm

looks really hard :S
Back to top Go down
Sponsored content





[TUT] How to make NPC Dialogues [TUT] Empty
PostSubject: Re: [TUT] How to make NPC Dialogues [TUT]   [TUT] How to make NPC Dialogues [TUT] I_icon_minitime

Back to top Go down
 
[TUT] How to make NPC Dialogues [TUT]
Back to top 
Page 1 of 1
 Similar topics
-
» Moderator Or Administrator Sample Application Copy The Questions And Paste Make A Topic For Moderator/Administrator Status Then Paste The Questions *NOTE You Must Be A Moderator First To Make A Application For Administrator*
» I have a request to make.
» I will make a music request.
» huh help me to make a vote system plz
» somefroob help me make a server lawl plawks

Permissions in this forum:You cannot reply to topics in this forum
Pylon-Scape :: Tutorials-
Jump to: