S
scimmys hope
Guest
All credits go to Cascade on rune-server
Step 1: (Declare the ints booleans and strings for the bounty hunter system to use)
So what we are going to do first is find;
This is where the client.java file starts and also where we can start to declare voids ints and more.
Code:
public class client extends Player implements Runnable {Under that add;
Code:
public boolean
isInBounty = false,
bountyNoTele = false,
bountyPanel = false;
public int
pickupTimer = 0,
cantLeaveTimer = 0,
BHkillCount = 0;
public String
targetPlayer;
public void youCantLeave() {
sendMessage("Sorry but you cant leave, you have to wait another " + cantLeaveTimer + " seconds");
}
public void writeBounty() {
if(bountyPanel) {
setInterfaceWalkable(15892);
} else if(!bountyPanel) {
setInterfaceWalkable(-1);
}
sendQuest("Bounty Hunter:", 15894); //Title
//Left hand side
if(pickupTimer >= 0) {
sendQuest("@red@Pickup Penelty: "+pickupTimer, 15895);
}
else if(pickupTimer <= 1) {
sendQuest("@gre@No pickup penelty!", 15895);
}
if(cantLeaveTimer >= 0) {
sendQuest("@red@Cant leave for: "+cantLeaveTimer, 15897);
}
else if(cantLeaveTimer <= 1) {
sendQuest("@gre@No cant leave penelty!", 15897);
}
sendQuest("@red@Target: "+targetPlayer, 15898);
sendQuest("", 15900);
sendQuest("", 15901);
//Right hand side
sendQuest("", 15896);
sendQuest("", 15902);
sendQuest("", 15903);
sendQuest("", 15904);
sendQuest("", 15905);
sendQuest("", 15906);
}
public void leaveBounty() {
if(cantLeaveTimer >= 0) {
youCantLeave();
}
else
{
teleportToX = 3222;
teleportToY = 3218;
bountyPanel = false;
sendMessage("Thanks for playing bounty hunter");
}
}
public void enterBounty() {
teleblock = true;
bountyPanel = true;
cantLeaveTimer = 0;
pickupTimer = 0;
//Or if you want a custom non tele message use the bountyNoTele boolean but you must put it into your teleports.
//bountyNoTele = true;
sendMessage("Thanks for coming to bounty hunter");
sendMessage("Please note: When you attack anybody you will have a pickup penelty");
sendMessage("If you pick anything up you cant leave!");
isInBounty = true;
teleportToX = 3374;
teleportToY = 9743;
setTarget();
}
public void giveReward() {
if(BHkillCount == 0) {
sendMessage("You currently have NO kills in the bounty hunter");
}
else if(BHkillCount == 1) {
sendMessage("You currently have 1 kill take your 10000GP reward!");
addItem(995, 10000);
BHkillCount = 0;
}
else if(BHkillCount == 2) {
sendMessage("You currently have 2 kill take your 50000GP reward!");
addItem(995, 50000);
BHkillCount = 0;
}
else if(BHkillCount == 3) {
sendMessage("You currently have 3 kill take your 100000GP reward!");
addItem(995, 100000);
BHkillCount = 0;
}
else if(BHkillCount == 4) {
sendMessage("You currently have 4 kill take your 200000GP reward!");
addItem(995, 200000);
BHkillCount = 0;
}
else if(BHkillCount == 5) {
sendMessage("You currently have 5 kill take your 500000GP reward!");
addItem(995, 500000);
BHkillCount = 0;
}
else if(BHkillCount == 6) {
sendMessage("You currently have 6 kill take your 1000000GP reward!");
addItem(995, 1000000);
BHkillCount = 0;
}
else if(BHkillCount == 7) {
sendMessage("You currently have 7 kill take your 1500000GP reward!");
addItem(995, 1500000);
BHkillCount = 0;
}
else if(BHkillCount == 8) {
sendMessage("You currently have 8 kill take your 2000000GP reward!");
addItem(995, 2000000);
BHkillCount = 0;
}
else
{
sendMessage("You have truly proved yourself in the art of Bounty Hunting");
sendMessage("Take this as your reward and prosper my freind!");
addItem(995, 5000000);
BHkillCount = 0;
}
}Step 2: (Adding some important features in bounty hunter)
Find;
This is your pickup item packet.
Code:
case 236: //pickup itemAnd at the bottom just before the last } ;
Code:
if(isInBounty = true) {
if(pickupTimer >= 0) {
pickupTimer = 0;
cantLeaveTimer = 120;
sendMessage("You have picked up an item when you shouldent have");
sendMessage("You cant leave for 2 minutes!");
}
else
{
}
}Find;
Code:
case 73:And at the bottom before the last }, add;
Code:
if(isInBounty = true) {
pickupTimer = 60;
}Step 3: (Adding so magic also gives you a pickup penelty)
Find;
This is your magic on players packet, it is called everytime sombody uses magic on another player.
Code:
case 249: //Magic on PlayersAnd just before the last 2 }'s add;
Code:
if(isInBounty = true) {
pickupTimer = 60;
}Step 4: (Adding things into the process)
Find;
This is your process, it is called every 500 miliseconds when your server is running.
Code:
process() { // is being called regularily every 500msUnder that add;
Code:
if(isInBounty = true) {
writeBounty();
}
if(cantLeaveTimer >= 0) {
cantLeaveTimer -= 1;
}
if(pickupTimer >= 0) {
pickupTimer -= 1;
}Step 5: (Adding the objects we will use)
Whereever your void is to make new objects add thease.
Code:
makeGlobalObject(3374, 9743, 7319, 0, 10);//bhportal
makeGlobalObject(3383, 3383, 7319, 0, 10);//bhportal
makeGlobalObject(7319, 3367, 7319, 0, 10);//bhportal
makeGlobalObject(3217, 3218, 7319, 0, 10);//bhportal
makeGlobalObject(3217, 3219, 7319, 0, 10);//bhportalStep 6: (Adding voids to run when the portals are clicked)
Find;
Code:
case 14:And scroll down until you see some stuff like if(objectID and at the end of one of those add this;
Code:
if ((objectID == 7319) && (objectX == 3374) && (objectY == 9743))
{
leaveBounty();
}
if ((objectID == 7319) && (objectX == 3565) && (objectY == 9756))
{
leaveBounty();
}
if ((objectID == 7319) && (objectX == 3365) && (objectY == 9769))
{
leaveBounty();
}
if ((objectID == 7319) && (objectX == 3217) && (objectY == 3218))
{
enterBounty();
}
if ((objectID == 7319) && (objectX == 3217) && (objectY == 3219))
{
enterBounty();
}Save & Close Client.java
Step 7: (Making the NPC's talk)
Open NPCHandler.java
Find;
moo
You should see somthing like this if (npcs.npcType == 847) { but with a different ID, at the end of one of those add this;
Code:
if (npcs.npcType == 847) {
if (misc.random2(10) == 1) {
npcs.updateRequired = true;
npcs.textUpdateRequired = true;
npcs.textUpdate = "Are you brave enough to dare the bounty hunter?";
}
}Save and close NPChandler.java
Step 8: (Adding the spawns)
Open autospawn.cfg and add thease spawns;
Code:
spawn = 847 3221 3217 0 2491 5174 2485 5168 2 BH GUARD
spawn = 847 3221 3220 0 2491 5174 2485 5168 2 BH GUARDStep 9:
Find;
Code:
case 9154And replace it with;
Code:
case 9154: //Log out
if(isInBounty = true) {
teleportToX = 3222;
teleportToY = 3218;
savemoreinfo();
logout();
savefile = true;
}
if(cantLeaveTimer >= 0) {
sendMessage("Wait for the timer to run out then logout!");
}
break;
Step 10:
This is an edit you will need to edit the case 73 with the new one in this post.
Ok in your boolean ApplyDead() under;
Code:
actionAmount++;
actionTimer = 0;
ResetAttack();
ResetAttackNPC();
pEmote = 0x900;
IsDeadTimer = true;
ApplyDead();It dosent matter if its exactly the same.
Add;
Code:
isInBounty = false;
pickupTimer = 0;
cantLeaveTimer = 0;And then under that add;
Code:
if(isInBounty = true) {
client killerz = (client) server.playerHandler.players[KillerId];
if(killerz != null && PlayerHandler.players[KillerId] != null) {
killerz.BHkillCount += 1;
otherpkps = PlayerHandler.players[KillerId].pkpoints;
otherkillc = PlayerHandler.players[KillerId].killcount;
killerz.sendMessage("You have killed a person in bounty");
killerz.sendMessage("You now have a total of "+BHkillCount+" kills.");
}
}
else
{Also add an extra } at the end of the boolean.
OPTIONAL: Step 11: (Adding commands to get in and out of bounty hunter and also to give rewards)
IN CLIENT.JAVA
Find;
Code:
END OF FRAME TESTINGUnder that add;
Code:
if (command.startsWith("bhreward"))
{
giveReward();
}
if (command.startsWith("leave"))
{
leaveBounty();
}
if (command.startsWith("gobounty"))
{
enterBounty();
}
if (command.startsWith("bhob"))
{
makeGlobalObject(7319, 3374, 9743, 0, 10);//bhportal
makeGlobalObject(7319, 3383, 9756, 0, 10);//bhportal
makeGlobalObject(7319, 3367, 9769, 0, 10);//bhportal
makeGlobalObject(7319, 3218, 9769, 0, 10);//bhportal
makeGlobalObject(7319, 3219, 9769, 0, 10);//bhportal
}And also to set a target, this is very buggy because everyone has the same target but its a start add this void;
Code:
public void setTarget() {
clearQuestInterface();
for(int i = 0; i < server.playerHandler.maxPlayers; i++) {
if(server.playerHandler.players != null) { {
int playerTar = playerId;
client c = (client) server.playerHandler.players[playerTar];
targetPlayer = server.playerHandler.players.playerName;
}
}
}
}And replace the enterBounty() void with the one in the post.
Step 1: (Declare the ints booleans and strings for the bounty hunter system to use)
So what we are going to do first is find;
This is where the client.java file starts and also where we can start to declare voids ints and more.
Code:
public class client extends Player implements Runnable {Under that add;
Code:
public boolean
isInBounty = false,
bountyNoTele = false,
bountyPanel = false;
public int
pickupTimer = 0,
cantLeaveTimer = 0,
BHkillCount = 0;
public String
targetPlayer;
public void youCantLeave() {
sendMessage("Sorry but you cant leave, you have to wait another " + cantLeaveTimer + " seconds");
}
public void writeBounty() {
if(bountyPanel) {
setInterfaceWalkable(15892);
} else if(!bountyPanel) {
setInterfaceWalkable(-1);
}
sendQuest("Bounty Hunter:", 15894); //Title
//Left hand side
if(pickupTimer >= 0) {
sendQuest("@red@Pickup Penelty: "+pickupTimer, 15895);
}
else if(pickupTimer <= 1) {
sendQuest("@gre@No pickup penelty!", 15895);
}
if(cantLeaveTimer >= 0) {
sendQuest("@red@Cant leave for: "+cantLeaveTimer, 15897);
}
else if(cantLeaveTimer <= 1) {
sendQuest("@gre@No cant leave penelty!", 15897);
}
sendQuest("@red@Target: "+targetPlayer, 15898);
sendQuest("", 15900);
sendQuest("", 15901);
//Right hand side
sendQuest("", 15896);
sendQuest("", 15902);
sendQuest("", 15903);
sendQuest("", 15904);
sendQuest("", 15905);
sendQuest("", 15906);
}
public void leaveBounty() {
if(cantLeaveTimer >= 0) {
youCantLeave();
}
else
{
teleportToX = 3222;
teleportToY = 3218;
bountyPanel = false;
sendMessage("Thanks for playing bounty hunter");
}
}
public void enterBounty() {
teleblock = true;
bountyPanel = true;
cantLeaveTimer = 0;
pickupTimer = 0;
//Or if you want a custom non tele message use the bountyNoTele boolean but you must put it into your teleports.
//bountyNoTele = true;
sendMessage("Thanks for coming to bounty hunter");
sendMessage("Please note: When you attack anybody you will have a pickup penelty");
sendMessage("If you pick anything up you cant leave!");
isInBounty = true;
teleportToX = 3374;
teleportToY = 9743;
setTarget();
}
public void giveReward() {
if(BHkillCount == 0) {
sendMessage("You currently have NO kills in the bounty hunter");
}
else if(BHkillCount == 1) {
sendMessage("You currently have 1 kill take your 10000GP reward!");
addItem(995, 10000);
BHkillCount = 0;
}
else if(BHkillCount == 2) {
sendMessage("You currently have 2 kill take your 50000GP reward!");
addItem(995, 50000);
BHkillCount = 0;
}
else if(BHkillCount == 3) {
sendMessage("You currently have 3 kill take your 100000GP reward!");
addItem(995, 100000);
BHkillCount = 0;
}
else if(BHkillCount == 4) {
sendMessage("You currently have 4 kill take your 200000GP reward!");
addItem(995, 200000);
BHkillCount = 0;
}
else if(BHkillCount == 5) {
sendMessage("You currently have 5 kill take your 500000GP reward!");
addItem(995, 500000);
BHkillCount = 0;
}
else if(BHkillCount == 6) {
sendMessage("You currently have 6 kill take your 1000000GP reward!");
addItem(995, 1000000);
BHkillCount = 0;
}
else if(BHkillCount == 7) {
sendMessage("You currently have 7 kill take your 1500000GP reward!");
addItem(995, 1500000);
BHkillCount = 0;
}
else if(BHkillCount == 8) {
sendMessage("You currently have 8 kill take your 2000000GP reward!");
addItem(995, 2000000);
BHkillCount = 0;
}
else
{
sendMessage("You have truly proved yourself in the art of Bounty Hunting");
sendMessage("Take this as your reward and prosper my freind!");
addItem(995, 5000000);
BHkillCount = 0;
}
}Step 2: (Adding some important features in bounty hunter)
Find;
This is your pickup item packet.
Code:
case 236: //pickup itemAnd at the bottom just before the last } ;
Code:
if(isInBounty = true) {
if(pickupTimer >= 0) {
pickupTimer = 0;
cantLeaveTimer = 120;
sendMessage("You have picked up an item when you shouldent have");
sendMessage("You cant leave for 2 minutes!");
}
else
{
}
}Find;
Code:
case 73:And at the bottom before the last }, add;
Code:
if(isInBounty = true) {
pickupTimer = 60;
}Step 3: (Adding so magic also gives you a pickup penelty)
Find;
This is your magic on players packet, it is called everytime sombody uses magic on another player.
Code:
case 249: //Magic on PlayersAnd just before the last 2 }'s add;
Code:
if(isInBounty = true) {
pickupTimer = 60;
}Step 4: (Adding things into the process)
Find;
This is your process, it is called every 500 miliseconds when your server is running.
Code:
process() { // is being called regularily every 500msUnder that add;
Code:
if(isInBounty = true) {
writeBounty();
}
if(cantLeaveTimer >= 0) {
cantLeaveTimer -= 1;
}
if(pickupTimer >= 0) {
pickupTimer -= 1;
}Step 5: (Adding the objects we will use)
Whereever your void is to make new objects add thease.
Code:
makeGlobalObject(3374, 9743, 7319, 0, 10);//bhportal
makeGlobalObject(3383, 3383, 7319, 0, 10);//bhportal
makeGlobalObject(7319, 3367, 7319, 0, 10);//bhportal
makeGlobalObject(3217, 3218, 7319, 0, 10);//bhportal
makeGlobalObject(3217, 3219, 7319, 0, 10);//bhportalStep 6: (Adding voids to run when the portals are clicked)
Find;
Code:
case 14:And scroll down until you see some stuff like if(objectID and at the end of one of those add this;
Code:
if ((objectID == 7319) && (objectX == 3374) && (objectY == 9743))
{
leaveBounty();
}
if ((objectID == 7319) && (objectX == 3565) && (objectY == 9756))
{
leaveBounty();
}
if ((objectID == 7319) && (objectX == 3365) && (objectY == 9769))
{
leaveBounty();
}
if ((objectID == 7319) && (objectX == 3217) && (objectY == 3218))
{
enterBounty();
}
if ((objectID == 7319) && (objectX == 3217) && (objectY == 3219))
{
enterBounty();
}Save & Close Client.java
Step 7: (Making the NPC's talk)
Open NPCHandler.java
Find;
moo
You should see somthing like this if (npcs.npcType == 847) { but with a different ID, at the end of one of those add this;
Code:
if (npcs.npcType == 847) {
if (misc.random2(10) == 1) {
npcs.updateRequired = true;
npcs.textUpdateRequired = true;
npcs.textUpdate = "Are you brave enough to dare the bounty hunter?";
}
}Save and close NPChandler.java
Step 8: (Adding the spawns)
Open autospawn.cfg and add thease spawns;
Code:
spawn = 847 3221 3217 0 2491 5174 2485 5168 2 BH GUARD
spawn = 847 3221 3220 0 2491 5174 2485 5168 2 BH GUARDStep 9:
Find;
Code:
case 9154And replace it with;
Code:
case 9154: //Log out
if(isInBounty = true) {
teleportToX = 3222;
teleportToY = 3218;
savemoreinfo();
logout();
savefile = true;
}
if(cantLeaveTimer >= 0) {
sendMessage("Wait for the timer to run out then logout!");
}
break;
Step 10:
This is an edit you will need to edit the case 73 with the new one in this post.
Ok in your boolean ApplyDead() under;
Code:
actionAmount++;
actionTimer = 0;
ResetAttack();
ResetAttackNPC();
pEmote = 0x900;
IsDeadTimer = true;
ApplyDead();It dosent matter if its exactly the same.
Add;
Code:
isInBounty = false;
pickupTimer = 0;
cantLeaveTimer = 0;And then under that add;
Code:
if(isInBounty = true) {
client killerz = (client) server.playerHandler.players[KillerId];
if(killerz != null && PlayerHandler.players[KillerId] != null) {
killerz.BHkillCount += 1;
otherpkps = PlayerHandler.players[KillerId].pkpoints;
otherkillc = PlayerHandler.players[KillerId].killcount;
killerz.sendMessage("You have killed a person in bounty");
killerz.sendMessage("You now have a total of "+BHkillCount+" kills.");
}
}
else
{Also add an extra } at the end of the boolean.
OPTIONAL: Step 11: (Adding commands to get in and out of bounty hunter and also to give rewards)
IN CLIENT.JAVA
Find;
Code:
END OF FRAME TESTINGUnder that add;
Code:
if (command.startsWith("bhreward"))
{
giveReward();
}
if (command.startsWith("leave"))
{
leaveBounty();
}
if (command.startsWith("gobounty"))
{
enterBounty();
}
if (command.startsWith("bhob"))
{
makeGlobalObject(7319, 3374, 9743, 0, 10);//bhportal
makeGlobalObject(7319, 3383, 9756, 0, 10);//bhportal
makeGlobalObject(7319, 3367, 9769, 0, 10);//bhportal
makeGlobalObject(7319, 3218, 9769, 0, 10);//bhportal
makeGlobalObject(7319, 3219, 9769, 0, 10);//bhportal
}And also to set a target, this is very buggy because everyone has the same target but its a start add this void;
Code:
public void setTarget() {
clearQuestInterface();
for(int i = 0; i < server.playerHandler.maxPlayers; i++) {
if(server.playerHandler.players != null) { {
int playerTar = playerId;
client c = (client) server.playerHandler.players[playerTar];
targetPlayer = server.playerHandler.players.playerName;
}
}
}
}And replace the enterBounty() void with the one in the post.


