this isnt one with just a bunch of monsters or height levels this summons the next one after you kill it.
Purpose: to have a firecape minigame (please make them untradable/ unpkable
Difficulty: 3
Assumed Knowledge: basic coding + c&p
Server Base: project czar
Classes Modified: client + npchandler
Procedure
step 1: declare all this
Code:
public boolean inCaves() {
if((absX >= 2371 && absX <= 2424 && absY >= 5062 && absY <= 5117) || heightLevel == 1)
return true;
else
return false;
}
Code:
public void SummonNewNPC(int npcID) {
if(inCaves()) {
server.npcHandler.newSummonedNPC(npcID, absX, absY-1, heightLevel, absX-1, absY-1, absX+1, absY-1, 1, server.npcHandler.GetNpcListHP(npcID), false, playerId);
summonedNPCS++;
actionTimer = 8;
}
else {
sendMessage("you failed to spawn next monster because you are not");
sendMessage("in fight caves");
}
}
public void gotoCaves(int npcID) {
server.npcHandler.newSummonedNPC(npcID, 2402, 5094-1, heightLevel, 2402-1, 5094-1, 2402+1, 5094-1, 1, server.npcHandler.GetNpcListHP(npcID), false, playerId);
summonedNPCS++;
actionTimer = 8;
}
public void summonJad(int npcID) {
if(inCaves()) {
server.npcHandler.newSummonedNPC(npcID, 2420, 5083-1, heightLevel, 2420-1, 5083-1, 2420+1, 5083-1, 1, server.npcHandler.GetNpcListHP(npcID), false, playerId);
summonedNPCS++;
actionTimer = 8;
}
else {
sendMessage("you failed to spawn next monster because you are not");
sendMessage("in fight caves");
}
}
step 2: control + f if you dont have it thats fine, just go into case 185 and add.
Code:
case 9356: // fight caves
teleportToX = 2402;
teleportToY = 5094;
gotoCaves(52);
break;
case 9357: //fight caves exit
{
sendMessage("you wimp you left the minigame.");
teleportToX = 3094;//change these coords to your home area.
teleportToY = 3243;//change these coords to your home area.
heightLevel -= 0;
}
break;
Code:
if(command.startsWith("firecape")) {//teleport to firecape minigame
sendMessage("Welcome to the fight caves, do the waves and work up to jad");
teleportToX = 2439;
teleportToY = 5171;
}
step 3: the actual minigame
open up npchandler.java
find
Code:
if(p != null && person != null)
it should be like the 3rd one down
if you see
Code:
if(p != null && person != null)
{
if(p != null && person != null)
{
if (person.distanceToPoint(npcs[i].absX, npcs[i].absY) >= 5)
if (npcs[i].npcType != 1158 || npcs[i].npcType == 2745 || npcs[i].npcType == 2025 || npcs[i].npcType == 2026 || npcs[i].npcType == 2027 || npcs[i].npcType == 2028 || npcs[i].npcType == 2029 || npcs[i].npcType == 2030 || npcs[i].npcType == 52 || npcs[i].npcType == 119 || npcs[i].npcType == 145 || npcs[i].npcType == 158 || npcs[i].npcType == 221 || npcs[i].npcType == 58 || npcs[i].npcType == 112 || npcs[i].npcType == 141 || npcs[i].npcType == 193 || npcs[i].npcType == 502 || npcs[i].npcType == 655 || npcs[i].npcType == 677 || npcs[i].npcType == 837 || npcs[i].npcType == 1115 || npcs[i].npcType == 1203 || npcs[i].npcType == 1220 || npcs[i].npcType == 1279 || npcs[i].npcType == 2883 || npcs[i].npcType == 2546 || npcs[i].npcType == 2467 || npcs[i].npcType == 3200 || npcs[i].npcType == 49 || npcs[i].npcType == 83 || npcs[i].npcType == 3494)
{
npcs[i].RandomWalk = true;
your good.
add
Code:
|| npcs[i].npcType == 52 || npcs[i].npcType == 119 || npcs[i].npcType == 145 || npcs[i].npcType == 158 || npcs[i].npcType == 221 || npcs[i].npcType == 58 || npcs[i].npcType == 112 || npcs[i].npcType == 141 || npcs[i].npcType == 193 || npcs[i].npcType == 502 || npcs[i].npcType == 655 || npcs[i].npcType == 677 || npcs[i].npcType == 837 || npcs[i].npcType == 1115 || npcs[i].npcType == 1203 || npcs[i].npcType == 1220 || npcs[i].npcType == 1279 || npcs[i].npcType == 2883 || npcs[i].npcType == 2546 || npcs[i].npcType == 2467 || npcs[i].npcType == 3200 || npcs[i].npcType == 49 || npcs[i].npcType == 83 || npcs[i].npcType == 3494)
and for the next to things similar to that do the same.
step 4:
find
Code:
System.out.println("Npc id =" +NPCID);
then below that add
Code:
if(npcs[NPCID].npcType == 52) //wave 1
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 2.");
ppl.SummonNewNPC(119);
}
if(npcs[NPCID].npcType == 119) //wave 2
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 3.");
ppl.SummonNewNPC(145);
}
if(npcs[NPCID].npcType == 145) //wave 3
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 4.");
ppl.SummonNewNPC(158);
}
if(npcs[NPCID].npcType == 158) //wave 4
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 5.");
ppl.SummonNewNPC(221);
}
if(npcs[NPCID].npcType == 221) //wave 5
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 6.");
ppl.SummonNewNPC(58);
}
if(npcs[NPCID].npcType == 58) //wave 6
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 7.");
ppl.SummonNewNPC(112);
}
if(npcs[NPCID].npcType == 112) //wave 7
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 8.");
ppl.SummonNewNPC(141);
}
if(npcs[NPCID].npcType == 141) //wave 8
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 9.");
ppl.SummonNewNPC(193);
}
if(npcs[NPCID].npcType == 193) //wave 9
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 10.");
ppl.SummonNewNPC(502);
}
if(npcs[NPCID].npcType == 502) //wave 10
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 11.");
ppl.SummonNewNPC(655);
}
if(npcs[NPCID].npcType == 655) //wave 11
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 12.");
ppl.SummonNewNPC(677);
}
if(npcs[NPCID].npcType == 677) //wave 12
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 13.");
ppl.SummonNewNPC(837);
}
if(npcs[NPCID].npcType == 837) //wave 13
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 14.");
ppl.SummonNewNPC(1115);
}
if(npcs[NPCID].npcType == 1115) //wave 14
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 15.");
ppl.SummonNewNPC(1203);
}
if(npcs[NPCID].npcType == 1203) //wave 15
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 16.");
ppl.SummonNewNPC(1220);
}
if(npcs[NPCID].npcType == 1220) //wave 16
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 17.");
ppl.SummonNewNPC(1279);
}
if(npcs[NPCID].npcType == 1279) //wave 17
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 18.");
ppl.SummonNewNPC(2883);
}
if(npcs[NPCID].npcType == 2883) //wave 18
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("You are now at wave 19.");
ppl.SummonNewNPC(2546);
ppl.teleportToX = 2405;
ppl.teleportToY = 5087;
}
if(npcs[NPCID].npcType == 2546) //wave 19
{
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.summonJad(2745);
ppl.teleportToX = 2419;
ppl.teleportToY = 5107;
ppl.sendFrame200(4883, 591);
ppl.sendFrame126("TzHaar-Mej-Kah", 4884);
ppl.sendFrame126("Here comes TzTok-Jad", 4885);
ppl.sendFrame126("Click here to continue", 4886);
}
if(npcs[NPCID].npcType == 2745) {
int Player = npcs[NPCID].StartKilling;
client ppl = (client) server.playerHandler.players[Player];
ppl.sendMessage("Good Job!, The Jad Is Dead!");
ppl.sendFrame200(4883, 591);
ppl.sendFrame126("TzHaar-Mej-Kah", 4884);
ppl.sendFrame126("Well Done, You have defeated the TzTok-Jad", 4885);
ppl.sendFrame126("Click here to continue", 4886);
ppl.teleportToX = 3094;
ppl.teleportToY = 3243;
ppl.sendFrame75(2618, 4883);
ppl.sendFrame164(4882);
ppl.NpcDialogueSend = true;
ppl.addItem(6570, 100);
ppl.startAnimation(862);
}
step 5: find
Code:
server.playerHandler.players[Player].IsDead == true
after the else right below there add
Code:
} else if (npcs[NPCID].npcType == 52) {
npcs[NPCID].animNumber = 1184; //wave 1
hitDiff = 4 + misc.random(6);
} else if (npcs[NPCID].npcType == 119) {
npcs[NPCID].animNumber = 1184; //wave 2
hitDiff = 4 + misc.random(7);
} else if (npcs[NPCID].npcType == 145) {
npcs[NPCID].animNumber = 1184; //wave 3
hitDiff = 4 + misc.random(8);
} else if (npcs[NPCID].npcType == 158) {
npcs[NPCID].animNumber = 1184; //wave 4
hitDiff = 4 + misc.random(9);
} else if (npcs[NPCID].npcType == 221) {
npcs[NPCID].animNumber = 1184; //wave 5
hitDiff = 4 + misc.random(10);
} else if (npcs[NPCID].npcType == 58) {
npcs[NPCID].animNumber = 1184; //wave 6
hitDiff = 4 + misc.random(10);
} else if (npcs[NPCID].npcType == 112) {
npcs[NPCID].animNumber = 1184; //wave 7
hitDiff = 4 + misc.random(10);
} else if (npcs[NPCID].npcType == 141) {
npcs[NPCID].animNumber = 1184; //wave 8
hitDiff = 4 + misc.random(10);
} else if (npcs[NPCID].npcType == 193) {
npcs[NPCID].animNumber = 1184; //wave 9
hitDiff = 4 + misc.random(10);
} else if (npcs[NPCID].npcType == 502) {
npcs[NPCID].animNumber = 1184; //wave 10
hitDiff = 4 + misc.random(12);
} else if (npcs[NPCID].npcType == 655) {
npcs[NPCID].animNumber = 1184; //wave 11
hitDiff = 4 + misc.random(12);
} else if (npcs[NPCID].npcType == 677) {
npcs[NPCID].animNumber = 1184; //wave 12
hitDiff = 4 + misc.random(16);
} else if (npcs[NPCID].npcType == 837) {
npcs[NPCID].animNumber = 1184; //wave 13
hitDiff = 4 + misc.random(16);
} else if (npcs[NPCID].npcType == 1115) {
npcs[NPCID].animNumber = 1184; //wave 14
hitDiff = 4 + misc.random(16);
} else if (npcs[NPCID].npcType == 1203) {
npcs[NPCID].animNumber = 1184; //wave 15
hitDiff = 4 + misc.random(20);
} else if (npcs[NPCID].npcType == 1220) {
npcs[NPCID].animNumber = 1184; //wave 16
hitDiff = 4 + misc.random(20);
} else if (npcs[NPCID].npcType == 1279) {
npcs[NPCID].animNumber = 1184; //wave 17
hitDiff = 4 + misc.random(23);
} else if (npcs[NPCID].npcType == 2883) {
npcs[NPCID].animNumber = 1184; //wave 18
hitDiff = 4 + misc.random(23);
} else if (npcs[NPCID].npcType == 2546) {
npcs[NPCID].animNumber = 1184; //wave 19
hitDiff = 4 + misc.random(23);
}
and if you dont have a jad attack add
Code:
} else if (npcs[NPCID].npcType == 2745 && misc.random(2) == 1) {
npcs[NPCID].animNumber = 2655; //poke
npcs[NPCID].actionTimer = 7;
hitDiff = 4 + misc.random(32);
} else if (npcs[NPCID].npcType == 2745 && misc.random(3) == 2) {
npcs[NPCID].animNumber = 2652; //slash
gfxAll(451, EnemyY, EnemyX);
npcs[NPCID].actionTimer = 1;
hitDiff = 4 + misc.random(34);
} else if (npcs[NPCID].npcType == 2745 && misc.random(5) == 3) {
npcs[NPCID].animNumber = 2656; //crush
gfxAll(451, EnemyY, EnemyX);
npcs[NPCID].actionTimer = 1;
hitDiff = 4 + misc.random(28);
if you dont have summon npc variable, here it is add this in npchandler
Code:
public void newSummonedNPC(int npcType, int x, int y, int heightLevel, int rangex1, int rangey1, int rangex2, int rangey2, int WalkingType, int HP, boolean Respawns, int summonedBy) {
// first, search for a free slot
int slot = -1;
for (int i = 1; i < maxNPCs; i++) {
if (npcs[i] == null) {
slot = i;
break;
}
}