KBD Mini Game With Point System. (Pictures + Added AntiLeech)
ADDED ANTI-LEECH! Good luck fixing it. (Spelling errors and brackets. 5 total)
If you use this, please make a post, thats all I ask. if not I'll have to remove it, Thank you.
If you notice anything outta place just let me know and i'll add it.
Credits: BamBam.
Purpose: To make a KBD Mini Game with a rewards system.
Difficulty: 4.
Assumed Knowledge: Reading.
Server Base: Cheeze, Others.
Classes Modified: NPCHandler.java, Client.java, Autospawn.java
Step 1
Open up your Autospawn.cfg and add this.
Code:
spawn = 50 2587 3912 0 2591 3916 2583 3909 1 KBD By BamBam
Save and close Autospawn.cfg
Step 2
open up your NPCHandler.java and search for this, it will be above all yorur NPC death animations.
Code:
if (Npcs[i].actionTimer == 0 && npcs[i].DeadApply == false && npcs[i].NeedRespawn == false) {
Now addr this in with your other else if statements that follow your NPC death animations.
Code:
} else if (Npcs[i].npcType >= 50 && npcs[i].npcType <= 51) { //Black dragon by bambam
client c = (client) PlayerHandler.players[GetNpcKiller(i)];
T.Bdpoints += 1;
c.sendMessage("You killed the king black dragon and gained a kbd point.");
Save and close your NPCHandler.java
Step 3
now open up your Client.java and search for public boolean process, add this above it with your other ints.
Code:
public int bdpoints = 0;
Now after that is added, search for case 185: it should look something like this
Code:
case 185: //clicking most buttons
actionButtonId = misc.HexToInt(inStream.buffer, 0, packetSize);
if(playerName.equalsIgnoreCase(""))
println_debug("Case 185: "+actionButtonId);
switch(actionButtonId) {
Add all this below it.
Code:
case 55089:
{
if (bdpoints >= 50) { // kbd points by bambam
sendMessage("You used 50BDCP for a dragon medium helmet.");
bdpoints -= 50;
addItem(1149, 1);
updateRequired = true;
appearanceUpdateRequired = true;
} else if (bdpoints <= 50) {
sendMessage("Not enough BDCP.");
}
}
}
break;
case 39131:
{
if (bdpoints >= 100) { // kbd points by bambam
sendMessage("You used 100BDCP for a dragon platelegs.");
bdpoints -= 100;
addItem(4087, 1);
updateRequired = true;
appearanceUpdateRequired = true;
} else if (bdpoints <= 99) {
sendMessage("Not enough BDCP.");
}
}
break;
case 57012:
{
if (bdpoints >= 200) { // kbd points by bambam
sendMessage("You used 200BDCP for a dragon chain-mail.");
bdpoints -= 200;
addItem(3140, 1);
updateRequired = true;
appearanceUpdateRequired = true;
} else if (bdpoints <= 199) {
sendMessage("Not enough BDCP.");
}
}
break;
case 28192:
{
if (bdpoints >= 350) { // kbd points by bambam
sendMessage("You used 350BDCP for a dragon two-handed sword.");
bdpoints -= 350;
addItem(7158, 1);
updateRequired = true;
appearanceUpdateRequired = true;
} else if (bdpoints <= 349) {
sendMessage("Not enough BDCP.");
}
}
break;
case 47250:
{
if (bdpoints >= 400) { // kbd points by bambam
sendMessage("You used 400BDCP for a dragon battle axe.");
bdpoints -= 400;
addItem(1377, 1);
updateRequired = true;
appearanceUpdateRequired = true;
} else if (bdpoints <= 399) {
sendMessage("Not enough BDCP.");
}
}
break;
Now after you added all of that, search for update(); and under it add all this
Code:
sendQuest("@[email protected]", 7357); // by bambam
sendQuest("@[email protected]@[email protected]@[email protected]", 12836); // by bambam
sendQuest("@[email protected]", 7358); // by bambam
sendQuest("", 7359); //spacer // by bambam
sendQuest("Dragon Med - 50BDCP", 14169); // by bambam
sendQuest("Dragon Legs - 100BDCP", 10115); // by bambam
sendQuest("Dragon Chain - 200BDCP", 14604); // by bambam
sendQuest("Dragon 2H - 350BDCP", 7360); // by bambam
sendQuest("Dragon Baxe - 400BDCP", 12282); // by bambam
and now add this with your other tokens.
Code:
} else if (token.equals("character-bdpoints")) {
bdpoints = Integer.parseInt(token2); // by bambam
now add theses with your other crap in public boolean savemoreinfo() {
Code:
characterfile.write("character-bdpoints = ", 0, 21);
characterfile.write(Integer.toString(bdpoints), 0, Integer.toString(bdpoints).length()); // by bambam
characterfile.newLine();
Now that, that is done, lets add our teleport to enter the KBD mini game so lets search for /*OBJECT CLICK ONE*/ and add this.
Code:
case 12260:
if(GoodDistance2(absX, absY, objectX, objectY, 3)) { // by bambam
if(combat >= 100)
{
Selectoption("@[email protected] to take the Black Dragon Challenge?", "Oh, I've been ready!", "Im scared, I'm not going.","");
OptionObject = objectID;
}
else if(combat <= 100) {
sendMessage("You need 100 combat to play this mini-game. By BamBam");
}
}
break;
Now search for public void OBJECTS() and add this with your other addaobject code. note: not all servers have this object method since i put this in a while ago.
Code:
Addobject(2603,3861,12260,4,10,0);// Dragon Portal by BamBam
now search for case 9157: you see something that looks likes this
Code:
case 9157:
if (NpcDialogue == 2) {
NpcDialogue = 0;
NpcDialogueSend = false;
openUpBank();
}else if (duelring){
teleportToX = 3311;
teleportToy = 3234;
heightLevel = 0;
sendMessage("You teleport to the duel arena!");
duelring = false;
add this somewhere inside of case 9157:
Code:
} else if(OptionObject == 12260) { // by bambam
sendMessage("You black out and appear on this island dazed and confused..");
teleportToX = 2577;
teleportToY = 3908;
bdcdead = 1;
BDC();
actionTimer = 1;
setAnimation(0x2770);
stillgfx(384, absY, absX);
pEmote = 2770;
updateRequired = true;
appearanceUpdateRequired = true;
OptionObject = -1;
Now search for case 9158: and add this inside of it near the bottom
Code:
} else if(OptionObject == 12260) { // by bambam
RemoveAllWindows();
after that is done, now lets add our menu that will pop up on entering the mini game,
add this with your other menu voids.
Code:
public void bDC() { // by bambam
sendQuest(" Black Dragon Challenge", 8144); //menu KBD MG
clearQuestInterface();
sendQuest("", 8145);
sendQuest("@[email protected] This is Black Dragon Challenge", 8147);
sendQuest("@[email protected] What you do here is, kill as many dragons as", 8149);
sendQuest("@[email protected] you can, and collect rare items, you will get ", 8150);
sendQuest("@[email protected] Dragon Challenge points refered to as BDCP,", 8151);
sendQuest("@[email protected] will be able to purchase other items", 8152);
sendQuest("@[email protected] not listed with the PKP rewards.", 8153);
sendQuest("@[email protected] Points: "+bdpoints, 8155);
sendQuest("@[email protected]", 8156);
sendQuest("@[email protected]", 8157);
sendQuest("@[email protected]", 8158);
sendQuest("@[email protected]", 8159);
sendQuest("@[email protected]", 8160);
sendQuest("@[email protected]", 8161);
sendQuest("@[email protected]", 8162);
sendQuest("@[email protected]", 8163);
sendQuestSomething(8143);
showInterface(8134);
flushOutStream();
}
Okay so were done with that!
Step 4
Okay so now since its a mini game, we don't want our users dying and losing there good items, so we're gonna added a custom death method for this reason
Now place this with all your other voids
Code:
public void resetbdc() { // by bambam
sendMessage("Oh dear, you died in black dragon challenge. :(");
sendMessage("You lose 1 BDCP but you kept all your items! :D");
bdpoints -= 1;
bdcdead = 0;
}
After that is done, you'll need to add this above your public boolean process with your other ints.
Code:
public int bdcdead = 0; // by bambam
now search for //If killed apply dead and add this under it.
Code:
//KBD MINI GAME DEATH SPAWN
if (IsDead == true && NewHP <= 1 && bdcdead == 1) { // by bambam
Bdcdead();
}
Now search for public boolean ApplyDead() and add this below the last }
Code:
public boolean Bdcdead() { // by bambam
if (IsDeadTimer == false) {
actionAmount++;
actionTimer = 0;
resetBDC();
ResetAttack();
ResetAttackNPC();
pEmote = 0x900;
IsDeadTimer = true;
Bdcdead();
}
}
if (actionTimer == 0 && IsDeadTimer == true) {
teleportToX = 2605;
teleportToY = 3859;
heightLevel = 0;
IsDeadTeleporting = true;
frame1();
updateRequired = true;
appearanceUpdateRequired = true;
NewHP = getLevelForXP(playerXP[3]);
setSkillLevel(3, getLevelForXP(playerXP[3]), playerXP[playerHitpoints]);
playerLevel[3] = getLevelForXP(playerXP[3]);
PoisonDelay = 9999999;
KillerId = playerId;
}
return true;
}
Now add this if you want to where you added your bdpoints tokens etc
Code:
} else if (token.equals("character-bdcdead")) {
bdcdead = Integer.parseInt(token2); // by bambam
now add theses with your other crap in public boolean savemoreinfo() {
Code:
characterfile.write("character-bdcdead = ", 0, 21);
characterfile.write(Integer.toString(bdcdead), 0, Integer.toString(bdcdead).length());
characterfile.newLine();
Pictures:
point system
[Only registered and activated users can see links. Click Here To Register...]
The portal to get there
[Only registered and activated users can see links. Click Here To Register...]
when using the portal
[Only registered and activated users can see links. Click Here To Register...]
Arriving in the mini game
[Only registered and activated users can see links. Click Here To Register...]
random picture
[Only registered and activated users can see links. Click Here To Register...]
killing the black dragon
[Only registered and activated users can see links. Click Here To Register...]
dying in black dragon challenge
[Only registered and activated users can see links. Click Here To Register...]