Donate
Search
Latest topics
Top posters
Mr. Linksys (18) | ||||
Demonkill101 (13) | ||||
Dragonking (12) | ||||
Ripvayne (10) | ||||
King Redrum (10) | ||||
daniel89 (6) | ||||
Lighting bolt (5) | ||||
someguy (3) | ||||
thedisciple (3) | ||||
yangxue (2) |
make your server save attack style :agressive,defensive,attack,lunge etc
Page 1 of 1
make your server save attack style :agressive,defensive,attack,lunge etc
Description: This tutorial will make your server save your player's selected attack style (Accurate, Aggressive, Controlled, and Defensive) and set it back to what it was when they next log in.
Difficulty: 2
Assumed Knowledge: Copy and Paste
Tested Server: Pimpscape
Files/Classes Modified: client.java
Edits:
• Step 6 has been fixed. In order for this tutorial to work, please do the newer version of Step 6.
• Step 2 has been fixed. It was using the same style, but will now show the client the correct style aswell.
Procedure
Step 1 - Find your client.java:
Find the client class declaration.
Code:
public class client extends Player implements Runnable {It's right at the top of your client.java.
Step 2 - Declare the method which tells the client your attack style:
Declare the following method (Copy and paste this under the line you just found - for those who don't know what declare means):
Code:
public void setClientFightType() {
outStream.createFrame(36);
outStream.writeWordBigEndian(43);
outStream.writeByte(FightType-1);
}Step 3 - Find the Initialize Method:
Search for (Ctrl+F):
Code:
public void initialize()The first thing in there should be something like:
Code:
// first packet sent
outStream.createFrame(249);
outStream.writeByteA(1); // 1 for members, zero for free
outStream.writeWordBigEndianA(playerId);Step 4 - Make the server call the method we added before:
Add the following line underneath the code seen above.
Code:
setClientFightType();It should look like:
Code:
// first packet sent
outStream.createFrame(249);
outStream.writeByteA(1); // 1 for members, zero for free
outStream.writeWordBigEndianA(playerId);
setClientFightType();Step 5 - Find your save extra info method:
Search for (Ctrl+F):
Code:
public boolean savemoreinfo() {Step 6 - Make the server save the attack style:
In your savemoreinfo Method, you should see the following about 4 lines down:
Code:
characterfile.write("[MOREINFO]", 0, 10);Insert the following lines below that.
Code:
characterfile.newLine();
characterfile.write("character-fighttype = ", 0, 22);
characterfile.write(""+FightType, 0, Integer.toString(FightType).length());
characterfile.newLine();It should look like:
Code:
characterfile.write("[MOREINFO]", 0, 10);
characterfile.newLine();
characterfile.write("character-fighttype = ", 0, 22);
characterfile.write(""+FightType, 0, Integer.toString(FightType).length());
characterfile.newLine();Step 7 - Find your load extra info method:
Search for (Ctrl+F):
Code:
public int loadmoreinfo() {Step 8 - Make the server load the attack style:
Once you have found your loadmoreinfo Method, scroll down through it until you see the following. (
Code:
switch (ReadMode) {
case 1:
if (token.equals("character-clueid")) {Change it to this:
Code:
switch (ReadMode) {
case 1:
if (token.equals("character-fighttype")) {
FightType = Integer.parseInt(token2);
} else if (token.equals("character-clueid")) {Congratulations, you have completed this Tutorial!
Your server should now save, load, and set the players attack style to whatever they last used before logging out.
Please note the saving and loading part has not been tested, as my server does not save to text files.
Please post your feedback on this tutorial.
Also post any errors encountered here, I'll try to help you with them.
this is not by me
Difficulty: 2
Assumed Knowledge: Copy and Paste
Tested Server: Pimpscape
Files/Classes Modified: client.java
Edits:
• Step 6 has been fixed. In order for this tutorial to work, please do the newer version of Step 6.
• Step 2 has been fixed. It was using the same style, but will now show the client the correct style aswell.
Procedure
Step 1 - Find your client.java:
Find the client class declaration.
Code:
public class client extends Player implements Runnable {It's right at the top of your client.java.
Step 2 - Declare the method which tells the client your attack style:
Declare the following method (Copy and paste this under the line you just found - for those who don't know what declare means):
Code:
public void setClientFightType() {
outStream.createFrame(36);
outStream.writeWordBigEndian(43);
outStream.writeByte(FightType-1);
}Step 3 - Find the Initialize Method:
Search for (Ctrl+F):
Code:
public void initialize()The first thing in there should be something like:
Code:
// first packet sent
outStream.createFrame(249);
outStream.writeByteA(1); // 1 for members, zero for free
outStream.writeWordBigEndianA(playerId);Step 4 - Make the server call the method we added before:
Add the following line underneath the code seen above.
Code:
setClientFightType();It should look like:
Code:
// first packet sent
outStream.createFrame(249);
outStream.writeByteA(1); // 1 for members, zero for free
outStream.writeWordBigEndianA(playerId);
setClientFightType();Step 5 - Find your save extra info method:
Search for (Ctrl+F):
Code:
public boolean savemoreinfo() {Step 6 - Make the server save the attack style:
In your savemoreinfo Method, you should see the following about 4 lines down:
Code:
characterfile.write("[MOREINFO]", 0, 10);Insert the following lines below that.
Code:
characterfile.newLine();
characterfile.write("character-fighttype = ", 0, 22);
characterfile.write(""+FightType, 0, Integer.toString(FightType).length());
characterfile.newLine();It should look like:
Code:
characterfile.write("[MOREINFO]", 0, 10);
characterfile.newLine();
characterfile.write("character-fighttype = ", 0, 22);
characterfile.write(""+FightType, 0, Integer.toString(FightType).length());
characterfile.newLine();Step 7 - Find your load extra info method:
Search for (Ctrl+F):
Code:
public int loadmoreinfo() {Step 8 - Make the server load the attack style:
Once you have found your loadmoreinfo Method, scroll down through it until you see the following. (
Code:
switch (ReadMode) {
case 1:
if (token.equals("character-clueid")) {Change it to this:
Code:
switch (ReadMode) {
case 1:
if (token.equals("character-fighttype")) {
FightType = Integer.parseInt(token2);
} else if (token.equals("character-clueid")) {Congratulations, you have completed this Tutorial!
Your server should now save, load, and set the players attack style to whatever they last used before logging out.
Please note the saving and loading part has not been tested, as my server does not save to text files.
Please post your feedback on this tutorial.
Also post any errors encountered here, I'll try to help you with them.
this is not by me
Last edited by Tyro on Sun Nov 09, 2008 6:16 am; edited 1 time in total
Lighting bolt- Newbie
- Posts : 5
Join date : 2008-11-09
Lighting bolt- Newbie
- Posts : 5
Join date : 2008-11-09
Similar topics
» how to make a compiler!
» Simple Attack requirement messup.
» DragonScape 508 Server
» Rune-Server Domain Name Expired
» Simple Attack requirement messup.
» DragonScape 508 Server
» Rune-Server Domain Name Expired
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Tue Aug 23, 2011 3:25 pm by Demonkill101
» wow gold wow
Wed Jun 08, 2011 11:47 pm by yangxue
» DragonScape 508 Server
Mon Mar 29, 2010 7:33 pm by AERA808
» Linksys, have you seen\do you know about this?
Tue Jan 20, 2009 1:18 pm by Demonkill101
» Rune-Server Domain Name Expired
Tue Jan 20, 2009 1:17 pm by Demonkill101
» Simple Attack requirement messup.
Sun Dec 28, 2008 11:43 am by thedisciple
» Dragonscape 508 Ip switcher v2
Fri Dec 26, 2008 8:54 pm by Ripvayne
» Rules Of This Forum
Fri Dec 26, 2008 8:53 pm by Ripvayne
» Dragonking/Patragon
Mon Dec 22, 2008 3:48 pm by Mr. Linksys