JAD MINIGAME ( SCRIPT )Purpose: Add full fight pit waves
Difficulty: 5
Assumed Knowledge: Common Sense
Server Base: Any
Classes Modified: client.java, npc.java, npcHandler.java player.java
Procedure:
Go ahead and stuff this into client.java, or make it a handler if you so please. (You will need to edit the codes a bit if you make a handler!)
Step 1:
Code:
public void startPit() {
if (myPit == 0) {
myPit = maxPits+1;
maxPits++;
sendMessage("You are now registered for Fight Pits.");
sendMessage("Get your stuff ready and enter the door...");
}
if (myPit != 0) {
wave1();
pitin = myPit;
sendMessage("Good Luck!");
server.npcHandler.canAdd = 1;
teleportToX = 2412;
teleportToY = 5117;
}
}
public void wave1()
{
spawnPit(2627, 2402, 5097);
spawnPit(2627, 2397, 5095);
spawnPit(2627, 2391, 5093);
spawnPit(2629, 2390, 5087);
spawnPit(2629, 2393, 5082);
}
public void wave2()
{
spawnPit(2629, 2400, 5080);
spawnPit(2627, 2394, 5579);
spawnPit(2598, 2391, 5084);
spawnPit(2598, 2389, 5089);
spawnPit(2631, 2395, 5090);
}
public void wave3()
{
spawnPit(2631, 2410, 5081);
spawnPit(2631, 2402, 5067);
spawnPit(2591, 2405, 5079);
spawnPit(2591, 2390, 5089);
spawnPit(2591, 2386, 5081);
}
public void wave4()
{
spawnPit(2627, 2402, 5097);
spawnPit(2627, 2397, 5095);
spawnPit(2627, 2391, 5093);
spawnPit(2629, 2390, 5087);
spawnPit(2629, 2393, 5082);
}
public void wave5()
{
spawnPit(2629, 2400, 5080);
spawnPit(2627, 2394, 5579);
spawnPit(2598, 2391, 5084);
spawnPit(2598, 2389, 5089);
spawnPit(2631, 2395, 5090);
}
public void wave6()
{
spawnPit(2591, 2396, 5077);
spawnPit(2591, 2403, 5078);
spawnPit(2591, 2392, 5084);
spawnPit(2604, 2385, 5087);
spawnPit(2604, 2390, 5094);
}
public void wave7()
{
spawnPit(2604, 2397, 5100);
spawnPit(2604, 2407, 5097);
spawnPit(2610, 2412, 5083);
spawnPit(2610, 2408, 5070);
spawnPit(2610, 2403, 5078);
}
public void wave8()
{
spawnPit(2629, 2400, 5080);
spawnPit(2627, 2394, 5579);
spawnPit(2598, 2391, 5084);
spawnPit(2598, 2389, 5089);
spawnPit(2631, 2395, 5090);
}
public void wave9()
{
spawnPit(2591, 2396, 5077);
spawnPit(2591, 2403, 5078);
spawnPit(2591, 2392, 5084);
spawnPit(2604, 2385, 5087);
spawnPit(2604, 2390, 5094);
}
public void wave10()
{
spawnPit(2745, 2396, 5077);
spawnPit(2627, 2402, 5097);
spawnPit(2627, 2397, 5095);
spawnPit(2627, 2391, 5093);
}
public static int maxPits = 0;
public void spawnPit(int id, int x, int y) {
pitNPC(myPit, id, x, y, 1);
}
public void pitNPC(int pit, int npcType, int x, int y, int WalkingType) {
int HP = server.npcHandler.GetNpcListHP(npcType);
// first, search for a free slot
int slot = -1;
for (int i = 1; i < server.npcHandler.maxNPCs; i++) {
if (server.npcHandler.npcs
== null) {
slot = i;
break;
}
}
if(slot == -1) return; // no free slot found
if(HP <= 0) {
HP = 1;
}
NPC newNPC = new NPC(slot, npcType);
newNPC.absX = x;
newNPC.absY = y;
newNPC.makeX = x;
newNPC.makeY = y;
newNPC.Pit = pit;
newNPC.moverangeX1 = x;
newNPC.moverangeY1 = y;
newNPC.moverangeX2 = x;
newNPC.moverangeY2 = y;
newNPC.walkingType = WalkingType;
newNPC.HP = HP;
newNPC.Respawns= false;
newNPC.MaxHP = HP;
newNPC.MaxHit = (int)Math.floor((HP / 10));
if (newNPC.MaxHit < 1) {
newNPC.MaxHit = 1;
}
newNPC.heightLevel = 0;
server.npcHandler.npcs = newNPC;
}
public int ccadd = 0;
In your boolean process add
Code:
if (server.npcHandler.tzhaarkillz == 4 && server.npcHandler.canAdd == 1 && ccadd == 0) {
wave2();
server.npcHandler.canAdd = 2;
ccadd = 1;
}
if (server.npcHandler.tzhaarkillz == 8 && server.npcHandler.canAdd == 2 && ccadd == 1) {
wave3();
server.npcHandler.canAdd = 3;
ccadd = 2;
}
if (server.npcHandler.tzhaarkillz == 12 && server.npcHandler.canAdd == 3 && ccadd == 2) {
wave4();
server.npcHandler.canAdd = 4;
ccadd = 3;
}
if (server.npcHandler.tzhaarkillz == 16 && server.npcHandler.canAdd == 4 && ccadd == 3) {
wave5();
server.npcHandler.canAdd = 5;
ccadd = 4;
}
if (server.npcHandler.tzhaarkillz == 20 && server.npcHandler.canAdd == 5 && ccadd == 4) {
wave6();
server.npcHandler.canAdd = 6;
ccadd = 5;
}
if (server.npcHandler.tzhaarkillz == 24 && server.npcHandler.canAdd == 6 && ccadd == 5) {
wave7();
server.npcHandler.canAdd = 7;
ccadd = 6;
}
if (server.npcHandler.tzhaarkillz == 28 && server.npcHandler.canAdd == 7 && ccadd == 6) {
wave8();
server.npcHandler.canAdd = 8;
ccadd = 7;
}
if (server.npcHandler.tzhaarkillz == 32 && server.npcHandler.canAdd == 8 && ccadd == 7) {
wave9();
server.npcHandler.canAdd = 9;
ccadd = 8;
}
if (server.npcHandler.tzhaarkillz == 36 && server.npcHandler.canAdd == 9 && ccadd == 8) {
wave10();
server.npcHandler.canAdd = 10;
ccadd = 0;
}
if (server.npcHandler.tzhaarkillz == 40 && server.npcHandler.canAdd == 10) {
sendMessage("Congratulations, You beat the Fight Pit Waves!");
server.npcHandler.canAdd = 0;
server.npcHandler.tzhaarkillz = 0;
sendMessage("You are awarded a fire cape!");
teleportToX = 3254;
teleportToY = 3426;
addItem(6570, 1);
}
Step 2: This stuff goes in player.java
Code:
public int myPit = 0;
public int pitin = 0;
Find public boolean withinDistance
Replace those two booleans with this...
Code:
public boolean withinDistance(Player otherPlr) {
if(heightLevel != otherPlr.heightLevel /*|| WhosHouse != otherPlr.WhosHouse*/ || pitin != otherPlr.pitin) return false;
int deltaX = otherPlr.absX-absX, deltaY = otherPlr.absY-absY;
return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
}
public boolean withinDistance(NPC npc) {
if (heightLevel != npc.heightLevel /*|| npc.NWhosHouse != WhosHouse */|| npc.Pit != pitin) return false;
if (npc.NeedRespawn == true) return false;
int deltaX = npc.absX-absX, deltaY = npc.absY-absY;
return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
}
Step 3: This stuff goes in npc.java
Code:
public int Pit = 0;
Step 4: Lastly this stuff goes in npcHANDLER.java
Code:
public int canAdd = 0;
public int tzhaarkillz = 0;
Find
Code:
rat deadadd this under that
Code:
} else if (npcs.npcType == 2591 ||
npcs.npcType == 2592 ||
npcs.npcType == 2593 ||
npcs.npcType == 2594 ||
npcs.npcType == 2595 ||
npcs.npcType == 2596 ||
npcs.npcType == 2597 ||
npcs.npcType == 2598 ||
npcs.npcType == 2599 ||
npcs.npcType == 2600 ||
npcs.npcType == 2601 ||
npcs.npcType == 2602 ||
npcs.npcType == 2603 ||
npcs.npcType == 2604 ||
npcs.npcType == 2605 ||
npcs.npcType == 2606 ||
npcs.npcType == 2607 ||
npcs.npcType == 2608 ||
npcs.npcType == 2609 ||
npcs.npcType == 2610 ||
npcs.npcType == 2611 ||
npcs.npcType == 2612 ||
npcs.npcType == 2613 ||
npcs.npcType == 2614 ||
npcs.npcType == 2615 ||
npcs.npcType == 2616 ||
npcs.npcType == 2627 ||
npcs.npcType == 2628 ||
npcs.npcType == 2629 ||
npcs.npcType == 2630 ||
npcs.npcType == 2631 ||
npcs.npcType == 2632 ||
npcs.npcType == 2740 ||
npcs.npcType == 2745) {
tzhaarkillz += 1;
================================================
Theres the base, you can make the cases for clicking on the cave entrance, just make it call my void.
Here is a command for people who can't do that much..
Code:
if (command.startsWith("pits")) {
startPit();
}
================================================
thanks for the pits idea :)
Re: JAD MINIGAME ( SCRIPT )
Purpose: Add full fight pit waves
Difficulty: 5
Assumed Knowledge: Common Sense
Server Base: Any
Classes Modified: client.java, npc.java, npcHandler.java player.java
Procedure:
Go ahead and stuff this into client.java, or make it a handler if you so please. (You will need to edit the codes a bit if you make a handler!)
Step 1:
Code:
public void startPit() {
if (myPit == 0) {
myPit = maxPits+1;
maxPits++;
sendMessage("You are now registered for Fight Pits.");
sendMessage("Get your stuff ready and enter the door...");
}
if (myPit != 0) {
wave1();
pitin = myPit;
sendMessage("Good Luck!");
server.npcHandler.canAdd = 1;
teleportToX = 2412;
teleportToY = 5117;
}
}
public void wave1()
{
spawnPit(2627, 2402, 5097);
spawnPit(2627, 2397, 5095);
spawnPit(2627, 2391, 5093);
spawnPit(2629, 2390, 5087);
spawnPit(2629, 2393, 5082);
}
public void wave2()
{
spawnPit(2629, 2400, 5080);
spawnPit(2627, 2394, 5579);
spawnPit(2598, 2391, 5084);
spawnPit(2598, 2389, 5089);
spawnPit(2631, 2395, 5090);
}
public void wave3()
{
spawnPit(2631, 2410, 5081);
spawnPit(2631, 2402, 5067);
spawnPit(2591, 2405, 5079);
spawnPit(2591, 2390, 5089);
spawnPit(2591, 2386, 5081);
}
public void wave4()
{
spawnPit(2627, 2402, 5097);
spawnPit(2627, 2397, 5095);
spawnPit(2627, 2391, 5093);
spawnPit(2629, 2390, 5087);
spawnPit(2629, 2393, 5082);
}
public void wave5()
{
spawnPit(2629, 2400, 5080);
spawnPit(2627, 2394, 5579);
spawnPit(2598, 2391, 5084);
spawnPit(2598, 2389, 5089);
spawnPit(2631, 2395, 5090);
}
public void wave6()
{
spawnPit(2591, 2396, 5077);
spawnPit(2591, 2403, 5078);
spawnPit(2591, 2392, 5084);
spawnPit(2604, 2385, 5087);
spawnPit(2604, 2390, 5094);
}
public void wave7()
{
spawnPit(2604, 2397, 5100);
spawnPit(2604, 2407, 5097);
spawnPit(2610, 2412, 5083);
spawnPit(2610, 2408, 5070);
spawnPit(2610, 2403, 5078);
}
public void wave8()
{
spawnPit(2629, 2400, 5080);
spawnPit(2627, 2394, 5579);
spawnPit(2598, 2391, 5084);
spawnPit(2598, 2389, 5089);
spawnPit(2631, 2395, 5090);
}
public void wave9()
{
spawnPit(2591, 2396, 5077);
spawnPit(2591, 2403, 5078);
spawnPit(2591, 2392, 5084);
spawnPit(2604, 2385, 5087);
spawnPit(2604, 2390, 5094);
}
public void wave10()
{
spawnPit(2745, 2396, 5077);
spawnPit(2627, 2402, 5097);
spawnPit(2627, 2397, 5095);
spawnPit(2627, 2391, 5093);
}
public static int maxPits = 0;
public void spawnPit(int id, int x, int y) {
pitNPC(myPit, id, x, y, 1);
}
public void pitNPC(int pit, int npcType, int x, int y, int WalkingType) {
int HP = server.npcHandler.GetNpcListHP(npcType);
// first, search for a free slot
int slot = -1;
for (int i = 1; i < server.npcHandler.maxNPCs; i++) {
if (server.npcHandler.npcs == null) {
slot = i;
break;
}
}
if(slot == -1) return; // no free slot found
if(HP <= 0) {
HP = 1;
}
NPC newNPC = new NPC(slot, npcType);
newNPC.absX = x;
newNPC.absY = y;
newNPC.makeX = x;
newNPC.makeY = y;
newNPC.Pit = pit;
newNPC.moverangeX1 = x;
newNPC.moverangeY1 = y;
newNPC.moverangeX2 = x;
newNPC.moverangeY2 = y;
newNPC.walkingType = WalkingType;
newNPC.HP = HP;
newNPC.Respawns= false;
newNPC.MaxHP = HP;
newNPC.MaxHit = (int)Math.floor((HP / 10));
if (newNPC.MaxHit < 1) {
newNPC.MaxHit = 1;
}
newNPC.heightLevel = 0;
server.npcHandler.npcs = newNPC;
}
public int ccadd = 0;
In your boolean process add
Code:
if (server.npcHandler.tzhaarkillz == 4 && server.npcHandler.canAdd == 1 && ccadd == 0) {
wave2();
server.npcHandler.canAdd = 2;
ccadd = 1;
}
if (server.npcHandler.tzhaarkillz == 8 && server.npcHandler.canAdd == 2 && ccadd == 1) {
wave3();
server.npcHandler.canAdd = 3;
ccadd = 2;
}
if (server.npcHandler.tzhaarkillz == 12 && server.npcHandler.canAdd == 3 && ccadd == 2) {
wave4();
server.npcHandler.canAdd = 4;
ccadd = 3;
}
if (server.npcHandler.tzhaarkillz == 16 && server.npcHandler.canAdd == 4 && ccadd == 3) {
wave5();
server.npcHandler.canAdd = 5;
ccadd = 4;
}
if (server.npcHandler.tzhaarkillz == 20 && server.npcHandler.canAdd == 5 && ccadd == 4) {
wave6();
server.npcHandler.canAdd = 6;
ccadd = 5;
}
if (server.npcHandler.tzhaarkillz == 24 && server.npcHandler.canAdd == 6 && ccadd == 5) {
wave7();
server.npcHandler.canAdd = 7;
ccadd = 6;
}
if (server.npcHandler.tzhaarkillz == 28 && server.npcHandler.canAdd == 7 && ccadd == 6) {
wave8();
server.npcHandler.canAdd = 8;
ccadd = 7;
}
if (server.npcHandler.tzhaarkillz == 32 && server.npcHandler.canAdd == 8 && ccadd == 7) {
wave9();
server.npcHandler.canAdd = 9;
ccadd = 8;
}
if (server.npcHandler.tzhaarkillz == 36 && server.npcHandler.canAdd == 9 && ccadd == 8) {
wave10();
server.npcHandler.canAdd = 10;
ccadd = 0;
}
if (server.npcHandler.tzhaarkillz == 40 && server.npcHandler.canAdd == 10) {
sendMessage("Congratulations, You beat the Fight Pit Waves!");
server.npcHandler.canAdd = 0;
server.npcHandler.tzhaarkillz = 0;
sendMessage("You are awarded a fire cape!");
teleportToX = 3254;
teleportToY = 3426;
addItem(6570, 1);
}
Step 2: This stuff goes in player.java
Code:
public int myPit = 0;
public int pitin = 0;
Find public boolean withinDistance
Replace those two booleans with this...
Code:
public boolean withinDistance(Player otherPlr) {
if(heightLevel != otherPlr.heightLevel /*|| WhosHouse != otherPlr.WhosHouse*/ || pitin != otherPlr.pitin) return false;
int deltaX = otherPlr.absX-absX, deltaY = otherPlr.absY-absY;
return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
}
public boolean withinDistance(NPC npc) {
if (heightLevel != npc.heightLevel /*|| npc.NWhosHouse != WhosHouse */|| npc.Pit != pitin) return false;
if (npc.NeedRespawn == true) return false;
int deltaX = npc.absX-absX, deltaY = npc.absY-absY;
return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
}
Step 3: This stuff goes in npc.java
Code:
public int Pit = 0;
Step 4: Lastly this stuff goes in npcHANDLER.java
Code:
public int canAdd = 0;
public int tzhaarkillz = 0;
Find
Code:
rat deadadd this under that
Code:
} else if (npcs.npcType == 2591 ||
npcs.npcType == 2592 ||
npcs.npcType == 2593 ||
npcs.npcType == 2594 ||
npcs.npcType == 2595 ||
npcs.npcType == 2596 ||
npcs.npcType == 2597 ||
npcs.npcType == 2598 ||
npcs.npcType == 2599 ||
npcs.npcType == 2600 ||
npcs.npcType == 2601 ||
npcs.npcType == 2602 ||
npcs.npcType == 2603 ||
npcs.npcType == 2604 ||
npcs.npcType == 2605 ||
npcs.npcType == 2606 ||
npcs.npcType == 2607 ||
npcs.npcType == 2608 ||
npcs.npcType == 2609 ||
npcs.npcType == 2610 ||
npcs.npcType == 2611 ||
npcs.npcType == 2612 ||
npcs.npcType == 2613 ||
npcs.npcType == 2614 ||
npcs.npcType == 2615 ||
npcs.npcType == 2616 ||
npcs.npcType == 2627 ||
npcs.npcType == 2628 ||
npcs.npcType == 2629 ||
npcs.npcType == 2630 ||
npcs.npcType == 2631 ||
npcs.npcType == 2632 ||
npcs.npcType == 2740 ||
npcs.npcType == 2745) {
tzhaarkillz += 1;
================================================
Theres the base, you can make the cases for clicking on the cave entrance, just make it call my void.
Here is a command for people who can't do that much..
Code:
if (command.startsWith("pits")) {
startPit();
}
================================================If Blobboy aggrees, we can try it =D
good idea Halson
HALSONS NAME HAS BACKSTABBER IN IT >.<