Rog3r
June 21st, 2010, 15:04
Revamp your Packet 40 with THIS tutorial!
Explanation:
It's pretty annoying moving around in your class just to line up dialog. Well, once you implement and follow this tutorial properly, you'll switch dialog with ease and save some space in your class too. Makes it easy and makes connecting dialog literally just a line away from a method call.
Procedure:
Note, this will revamp your packet 40. Please make a backup of your server before proceeding however if you trust yourself, you don't have too. This was only tested on a source that was derived from Devolution V7.
I'm not sure that it'll work with other sources thus you should be a bit concerned.
Let's begin shall we?
Go into your client class and search for:
case 40:
Replace everything in your packet with this:
case 40: // Dialog switching...
if (nextDialogue) {
if (setNext > 0)
NpcDialogue += 1;
NpcDialogueSend = false;
nextDialogue = false;
}
break;
Now add these variables. Where?
Just place it at the end of your file, right before the last bracket. Make sure it's before the last bracket or you'll be thrown some compiler errors.
public int setNext, atDialogue = 0;
public boolean nextDialogue = false;
And finally add this method above those variables we've just added.
public void nextDialogue(int nextt) {
setNext = 0;
if (nextt > 0) {
setNext = nextt;
nextDialogue = true;
} else {
NpcDialogue = 0;
NpcDialogueSend = false;
RemoveAllWindows();
}
}
We're almost done!
Under packet 155 (case 155) add this:
setNext = 0;
Under packet 17 (case 17) add this:
setNext = 0;
Under packet 21 (case 21) add this:
setNext = 0;
You can compile now. If for some reason you don't have the RemoveAllWindows method, i've provided it for you.
public void RemoveAllWindows() {
outStream.createFrame(219);
flushOutStream();
}
So right now, you may have some problems or confusion on HOW to use this new feature now. Take a look below however if you think you've got it - you're pretty much done.
How do you use this?
Let's say you were working on some dialog:
case 3903:
sendFrame200(4901, 591);
sendFrame126(GetNpcName(NpcTalkTo), 4902);
sendFrame126("", 4903);
sendFrame126("A quest is what you seek! Well then, my advice to you", 4904);
sendFrame126("is to go pratice on mining. If you bring back what I", 4905);
sendFrame126("request, you may unlock something. Do you accept?", 4906);
sendFrame75(NpcTalkTo, 4901);
sendFrame164(4900);
NpcDialogueSend = true;
nextDialogue(3904);
break;
Noticed the bold text? Since this dialogue ID is 3903, at the end before the break sequence we will add this.
What this does is it calls upon the method notifying that the next dialogue will be 3904.
In dialogue ID 3904, you can add more dialog and continue calling like this.
However, let's say you didn't want it to continue. Now, all you really basically have to do is this:
case 3904:
nextDialogue(-1);
break;
When something goes to dialogue 3904, it won't show anything. That bolded text means nothing will appear, thus making dialogue ID 3904, show pretty much nothing.
Good luck!
Explanation:
It's pretty annoying moving around in your class just to line up dialog. Well, once you implement and follow this tutorial properly, you'll switch dialog with ease and save some space in your class too. Makes it easy and makes connecting dialog literally just a line away from a method call.
Procedure:
Note, this will revamp your packet 40. Please make a backup of your server before proceeding however if you trust yourself, you don't have too. This was only tested on a source that was derived from Devolution V7.
I'm not sure that it'll work with other sources thus you should be a bit concerned.
Let's begin shall we?
Go into your client class and search for:
case 40:
Replace everything in your packet with this:
case 40: // Dialog switching...
if (nextDialogue) {
if (setNext > 0)
NpcDialogue += 1;
NpcDialogueSend = false;
nextDialogue = false;
}
break;
Now add these variables. Where?
Just place it at the end of your file, right before the last bracket. Make sure it's before the last bracket or you'll be thrown some compiler errors.
public int setNext, atDialogue = 0;
public boolean nextDialogue = false;
And finally add this method above those variables we've just added.
public void nextDialogue(int nextt) {
setNext = 0;
if (nextt > 0) {
setNext = nextt;
nextDialogue = true;
} else {
NpcDialogue = 0;
NpcDialogueSend = false;
RemoveAllWindows();
}
}
We're almost done!
Under packet 155 (case 155) add this:
setNext = 0;
Under packet 17 (case 17) add this:
setNext = 0;
Under packet 21 (case 21) add this:
setNext = 0;
You can compile now. If for some reason you don't have the RemoveAllWindows method, i've provided it for you.
public void RemoveAllWindows() {
outStream.createFrame(219);
flushOutStream();
}
So right now, you may have some problems or confusion on HOW to use this new feature now. Take a look below however if you think you've got it - you're pretty much done.
How do you use this?
Let's say you were working on some dialog:
case 3903:
sendFrame200(4901, 591);
sendFrame126(GetNpcName(NpcTalkTo), 4902);
sendFrame126("", 4903);
sendFrame126("A quest is what you seek! Well then, my advice to you", 4904);
sendFrame126("is to go pratice on mining. If you bring back what I", 4905);
sendFrame126("request, you may unlock something. Do you accept?", 4906);
sendFrame75(NpcTalkTo, 4901);
sendFrame164(4900);
NpcDialogueSend = true;
nextDialogue(3904);
break;
Noticed the bold text? Since this dialogue ID is 3903, at the end before the break sequence we will add this.
What this does is it calls upon the method notifying that the next dialogue will be 3904.
In dialogue ID 3904, you can add more dialog and continue calling like this.
However, let's say you didn't want it to continue. Now, all you really basically have to do is this:
case 3904:
nextDialogue(-1);
break;
When something goes to dialogue 3904, it won't show anything. That bolded text means nothing will appear, thus making dialogue ID 3904, show pretty much nothing.
Good luck!