Break
June 18th, 2010, 15:54
In this "Tutorial" I will show you basic coding for new coders.
Remember this is for Z508 base, Wont work in every base.
How to change login test:
1) Go into Player.java and search for:
public void welcome() {
Edit the strings below it.
2) Go into TestWorldLoader.java and search for:
getOwner().Welcome();
Below it, You will see something like this:
getOwner().getActionSender().sendMessage(getOwner( ), "Welcome to Z508.");
Edit the messages to what you choose.
For example:
getOwner().getActionSender().sendMessage(getOwner( ), "<col=6999>----------------------------Welcome To BreakPkSource!----------------------------");
How to remove Administrators Modifications
Go to PlayerUpdateMasks and search for:
Administrator modifications
Below it, You will see this:
if (p.rights >= 2) {
combat = 0;
}
Replace it with this:
if (p.rights >= 2) {
}
How to make everyone keep thier stuffs on death:
Go to Player.java and search for:
if (rights < 2) {
Replace it with:
if (rights < 0) {
How to make Administrators loose there stuffs on death:
Go to Player.java and search for:
if (rights < 2) {
Replace it with:
if (rights < 4) {
1) How to change home:
Make a new account on your server and type ::coords.
Let's say the coords are: 3087 and 3491.
So, Once you found your coords, Go to RS2LoginProtocol.java inside codec and search for:
3087
Now you will see something like this:
p.setCoords(3087, 3491, 0);
Change those coords to the new home coords you would like.
How to add commands:
I will show you now how to add ::starter command.
Go into commands.java and add this:
if (cmd[0].equals("starter") && p.starter == 0) {
Engine.playerItems.addItem(p, 995, 120000000);
p.message("You have been given a Starter Pack, Use it Wisely.");
p.starter = 1;
}
This is the command.
995 - Item id (In this case is cash).
120000000 - Amount (In this case 120m).
You can change those to which items or amount you choose.
Now we are going to add variable, Open up Player.java and search for:
public int rights = 0;
Under add this:
public int starter = 0;
We done with Player.java.
Now, Open FileManager.java and search for:
stream.writeString("rights:" + p.rights);
Under add:
stream.writeString("starter:" + p.starter);
Search again for:
stream.writeString("rights:" + p.rights);
And add this under:
stream.writeString("starter:" + p.starter);
Now, Search for:
else if (line.startsWith("rights:"))
p.rights = Integer.parseInt(line.substring(7));
And add this below:
else if (line.startsWith("starter:"))
p.starter = Integer.parseInt(line.substring(8));
This will make you able to do ::starter only once.
How to add objects:
Go inside Player.java and search for:
public void loadStaticObjects() {
Under add:
getActionSender().addStaticObject(ITEM ID, HEIGH, COORDS X, COORDS Y, 2, 10);
How to add a pvp timer:
Open up Player.java and replace this:
(x >= 3201 && x <= 3201 && y >= 3204 && y <= 3233)) {
//if ((attacking == null && attackedBy == null) || (timerStarted && System.currentTimeMillis() - PVPTimer >= 10000)) {
// if (timerStarted) {
// removeWilderness();
// timerStarted = false;
// }
return false;
//} else if (!timerStarted && (attacking == null || attackedBy != null)) {
// PVPTimer = System.currentTimeMillis();
// timerStarted = true;
//}
}
return true;
}
return false;
}
public int getWildernessLevel() {
With this:
(x >= 3201 && x <= 3201 && y >= 3204 && y <= 3233)) {
if ((attacking == null && attackedBy == null) || (timerStarted && System.currentTimeMillis() - PVPTimer >= 10000)) {
if (timerStarted) {
removeWilderness();
timerStarted = false;
attackedBy = null;
attacking = null;
}
return false;
} else if (!timerStarted && (attacking == null || attackedBy != null || attacking != null || attackedBy == null)) {
PVPTimer = System.currentTimeMillis();
timerStarted = true;
}
}
return true;
}
return false;
}
public int getWildernessLevel() {
How to add npcs:
Go into build/data/npcs and open up npcspawn, Now add this:
spawn = NPC ID COORDS Y COORDS X 0 0 0 0 0 NPC NAME
How to add talking npc:
Go to NPC.java and beloew:
public void process() {
Add this:
if (npcType == 552) {
requestText("Hello Everyone.");
requestAnim(-1, 1);
}
How to change characters rights:
Go into build/data/characters/mainsave and then click twise on your character name.
Now you will see:
rights:0
Change it into:
rights:1 For a moderator.
rights:2 For a administrator or owner rank.
How to make specifly commands for you (Owner commands):
Open Commands.java and add this:
String hostpaul = Server.socketListener.getAddress(p.socket.socket);
Under this:
Engine.fileManager.appendData("characters/logs/commands/"+p.username+".txt", playerCommand);
For example let's take "demote" command.
Now to make a command for yourself only type this:
if (cmd[0].equalsIgnoreCase("demote") && p.username.equalsIgnoreCase("YOUR NAME HERE"))) {
String person = playerCommand.substring((playerCommand.indexOf(" ") + 1));
Player p2 = Engine.players[Engine.getIdFromName(person)];
if (p2 != null) {
p2.disconnected[0] = false;
p2.rights = 0;
p2.hidden = 0; // Only if you got a hidden rank
p2.getActionSender().sendMessage(p2, "You have been demoted to a regular player! " +p.username+ " certainly didn't do it!");
You have demoted "+p2.username+" to a regular player!");
p2.updateReq = true;
p2.appearanceUpdateReq = true;
}
}
This will make the command for your username only.
If you want use this command in every account you will use, Replace this:
p.username.equalsIgnoreCase("YOUR NAME HERE") {
With:
!hostpaul.equalsIgnoreCase("YOUR IP HERE")) {
How to make an object teleport you:
This can else work with npcs.
Go into ObjectOption1 and add this:
case ####: // Case Id
teleportTo(3138, 3516, 4, 0, 0, 0, 0, 0, 0, 0, 0);
To get your case id, Add the object.
Now inside the server click on the object and check the case inside run.bat box.
How to add ItemOnItem:
Open ItemOnItem class, Now under this:
PlayerItems pi = new PlayerItems();
if(itemUsed == ITEMID && usedWith == ITEMID) {
Now you can add under what you want.
Example:
if(itemUsed == 1747 && usedWith == 1747) {
player.appendExperience(300 ,15);
pi.deleteItem(player, 1747, pi.getItemSlot(player, 1747), 1);
pi.deleteItem(player, 1747, pi.getItemSlot(player, 1747), 1);
pi.addItem(player, 5853, 1);
player.getActionSender().sendMessage(player, "You have made a Dwarven stout(m2).");
}
I think I have done! If you need anything special, Then please leave a request as a replay.
Hope this helped you.
~Sincerely Break.
Remember this is for Z508 base, Wont work in every base.
How to change login test:
1) Go into Player.java and search for:
public void welcome() {
Edit the strings below it.
2) Go into TestWorldLoader.java and search for:
getOwner().Welcome();
Below it, You will see something like this:
getOwner().getActionSender().sendMessage(getOwner( ), "Welcome to Z508.");
Edit the messages to what you choose.
For example:
getOwner().getActionSender().sendMessage(getOwner( ), "<col=6999>----------------------------Welcome To BreakPkSource!----------------------------");
How to remove Administrators Modifications
Go to PlayerUpdateMasks and search for:
Administrator modifications
Below it, You will see this:
if (p.rights >= 2) {
combat = 0;
}
Replace it with this:
if (p.rights >= 2) {
}
How to make everyone keep thier stuffs on death:
Go to Player.java and search for:
if (rights < 2) {
Replace it with:
if (rights < 0) {
How to make Administrators loose there stuffs on death:
Go to Player.java and search for:
if (rights < 2) {
Replace it with:
if (rights < 4) {
1) How to change home:
Make a new account on your server and type ::coords.
Let's say the coords are: 3087 and 3491.
So, Once you found your coords, Go to RS2LoginProtocol.java inside codec and search for:
3087
Now you will see something like this:
p.setCoords(3087, 3491, 0);
Change those coords to the new home coords you would like.
How to add commands:
I will show you now how to add ::starter command.
Go into commands.java and add this:
if (cmd[0].equals("starter") && p.starter == 0) {
Engine.playerItems.addItem(p, 995, 120000000);
p.message("You have been given a Starter Pack, Use it Wisely.");
p.starter = 1;
}
This is the command.
995 - Item id (In this case is cash).
120000000 - Amount (In this case 120m).
You can change those to which items or amount you choose.
Now we are going to add variable, Open up Player.java and search for:
public int rights = 0;
Under add this:
public int starter = 0;
We done with Player.java.
Now, Open FileManager.java and search for:
stream.writeString("rights:" + p.rights);
Under add:
stream.writeString("starter:" + p.starter);
Search again for:
stream.writeString("rights:" + p.rights);
And add this under:
stream.writeString("starter:" + p.starter);
Now, Search for:
else if (line.startsWith("rights:"))
p.rights = Integer.parseInt(line.substring(7));
And add this below:
else if (line.startsWith("starter:"))
p.starter = Integer.parseInt(line.substring(8));
This will make you able to do ::starter only once.
How to add objects:
Go inside Player.java and search for:
public void loadStaticObjects() {
Under add:
getActionSender().addStaticObject(ITEM ID, HEIGH, COORDS X, COORDS Y, 2, 10);
How to add a pvp timer:
Open up Player.java and replace this:
(x >= 3201 && x <= 3201 && y >= 3204 && y <= 3233)) {
//if ((attacking == null && attackedBy == null) || (timerStarted && System.currentTimeMillis() - PVPTimer >= 10000)) {
// if (timerStarted) {
// removeWilderness();
// timerStarted = false;
// }
return false;
//} else if (!timerStarted && (attacking == null || attackedBy != null)) {
// PVPTimer = System.currentTimeMillis();
// timerStarted = true;
//}
}
return true;
}
return false;
}
public int getWildernessLevel() {
With this:
(x >= 3201 && x <= 3201 && y >= 3204 && y <= 3233)) {
if ((attacking == null && attackedBy == null) || (timerStarted && System.currentTimeMillis() - PVPTimer >= 10000)) {
if (timerStarted) {
removeWilderness();
timerStarted = false;
attackedBy = null;
attacking = null;
}
return false;
} else if (!timerStarted && (attacking == null || attackedBy != null || attacking != null || attackedBy == null)) {
PVPTimer = System.currentTimeMillis();
timerStarted = true;
}
}
return true;
}
return false;
}
public int getWildernessLevel() {
How to add npcs:
Go into build/data/npcs and open up npcspawn, Now add this:
spawn = NPC ID COORDS Y COORDS X 0 0 0 0 0 NPC NAME
How to add talking npc:
Go to NPC.java and beloew:
public void process() {
Add this:
if (npcType == 552) {
requestText("Hello Everyone.");
requestAnim(-1, 1);
}
How to change characters rights:
Go into build/data/characters/mainsave and then click twise on your character name.
Now you will see:
rights:0
Change it into:
rights:1 For a moderator.
rights:2 For a administrator or owner rank.
How to make specifly commands for you (Owner commands):
Open Commands.java and add this:
String hostpaul = Server.socketListener.getAddress(p.socket.socket);
Under this:
Engine.fileManager.appendData("characters/logs/commands/"+p.username+".txt", playerCommand);
For example let's take "demote" command.
Now to make a command for yourself only type this:
if (cmd[0].equalsIgnoreCase("demote") && p.username.equalsIgnoreCase("YOUR NAME HERE"))) {
String person = playerCommand.substring((playerCommand.indexOf(" ") + 1));
Player p2 = Engine.players[Engine.getIdFromName(person)];
if (p2 != null) {
p2.disconnected[0] = false;
p2.rights = 0;
p2.hidden = 0; // Only if you got a hidden rank
p2.getActionSender().sendMessage(p2, "You have been demoted to a regular player! " +p.username+ " certainly didn't do it!");
You have demoted "+p2.username+" to a regular player!");
p2.updateReq = true;
p2.appearanceUpdateReq = true;
}
}
This will make the command for your username only.
If you want use this command in every account you will use, Replace this:
p.username.equalsIgnoreCase("YOUR NAME HERE") {
With:
!hostpaul.equalsIgnoreCase("YOUR IP HERE")) {
How to make an object teleport you:
This can else work with npcs.
Go into ObjectOption1 and add this:
case ####: // Case Id
teleportTo(3138, 3516, 4, 0, 0, 0, 0, 0, 0, 0, 0);
To get your case id, Add the object.
Now inside the server click on the object and check the case inside run.bat box.
How to add ItemOnItem:
Open ItemOnItem class, Now under this:
PlayerItems pi = new PlayerItems();
if(itemUsed == ITEMID && usedWith == ITEMID) {
Now you can add under what you want.
Example:
if(itemUsed == 1747 && usedWith == 1747) {
player.appendExperience(300 ,15);
pi.deleteItem(player, 1747, pi.getItemSlot(player, 1747), 1);
pi.deleteItem(player, 1747, pi.getItemSlot(player, 1747), 1);
pi.addItem(player, 5853, 1);
player.getActionSender().sendMessage(player, "You have made a Dwarven stout(m2).");
}
I think I have done! If you need anything special, Then please leave a request as a replay.
Hope this helped you.
~Sincerely Break.