Working On: Adding bandages to heal instead of ****ty sharks!
Purpose: To add a fully working, nice version of Castle Wars.
Difficulty: However hard YOU MAKE IT.
Assumed Knowledge: .<>. Depends .<>.
Server Base: Any
Classes Modified: client.java, autospawn, shops, npchandler
Procedure
Step 1: Open you autospawn and add this spawn
Code:
spawn = 1375 2444 3087 0 3104 5068 3104 5068 0 CW Guy - Newb 2341
Step 2: Open npchandler.java and search for
you should see
Code:
if (npcs[i].npcType == 81 || npcs[i].npcType == 397 || npcs[i].npcType == 1766 || npcs[i].npcType == 1767 || npcs.npcType == 1768) {
if (misc.random2(50) == 1) {
[i] npcs.updateRequired = true;
[i] npcs.textUpdateRequired = true;
[i] npcs.textUpdate = "Moo";
}
}
Step 3: Press enter after the two }'s and add
[i]
Code:
if (npcs.npcType == 1375) {
if (misc.random2(30) == 1) {
[i] npcs.updateRequired = true;
[i] npcs.textUpdateRequired = true;
[i] npcs.textUpdate = "Yes, I do sell CW stuff for the 'CW addict.'";
}
}
Step 4: Open shops and add this shop
Code:
shop = 501 @blu@Castle @red@Wars @blu@Stuff 1 1 4068 1000 4069 1000 4071 1000 4072 1000 4503 1000 4504 1000 4506 1000 4507 1000 4508 1000 4509 1000 4511 1000 4512 1000
Step 5: Open your client.java and search for
you should see something like
Code:
else if (NPCID == ) { // ...
Code:
PutNPCCoords = true;
WanneShop = ;
}
Step 6: Press enter after the } and add
Code:
else if (NPCID == 1375) { //CW Guy - Newb 2341
Code:
PutNPCCoords = true;
WanneShop = 501;
}
Step 7: In client.java, search for
until you see
Code:
public boolean nonWild() {
Code:
if((absX >= .... && absX <= .... && absY >= .... && absY <= .... )||
heightLevel == 1)
return true;
else
return false;
}
Step 8: Copy and paste this after the last ||
so the boolean looks like
Code:
public boolean nonWild() {
Code:
if((absX >= .... && absX <= .... && absY >= .... && absY <= ....) || (absX >= 2435 && absX <= 2447 && absY >= 3080 && absY <= 3099 )||
heightLevel == 1)
return true;
else
return false;
}
Step 9: Search for
and two enters above it, add
Code:
/* Newb 2341's CW */
Code:
public String Winner = "Nobody";
public int CWA = 0;
public int CWT = 0;
public int SS;
public int ZS;
public boolean playerIsSara = false;
public boolean playerIsZammy = false;
public boolean CWon = false;
public void CWscore()
{
String zammyColor;
String saraColor;
if(zammyScore > saraScore)
{
zammyColor = "@whi@";
saraColor = "@red@";
}
else if(zammyScore < saraScore)
{
zammyColor = "@red@";
saraColor = "@whi@";
}
else
{
zammyColor = "@bla@";
saraColor = "@bla@";
}
sendQuest("@blu@~~~***~~~***~~~*** CW Score ~~~***~~~***~~~***", 8144);
clearQuestInterface();
sendQuest("@or3@Zammy: "+zammyColor+zammyScore, 8147);
sendQuest("@or3@Sara: "+saraColor+saraScore, 8148);
sendQuestSomething(8143);
showInterface(8134);
flushOutStream();
}
Step 10: Search for
Code:
int objectX = inStream.readSignedWordBigEndianA();
int objectID = inStream.readUnsignedWord();
int objectY = inStream.readUnsignedWordA();
int face = 0;
int face2 = 0;
int GateID = 1;
and you'll see
Code:
int objectX = inStream.readSignedWordBigEndianA();
int objectID = inStream.readUnsignedWord();
int objectY = inStream.readUnsignedWordA();
int face = 0;
int face2 = 0;
int GateID = 1;
if(objectID == 6912) { // Xerozcheez: This object requires to be 3 sqs minium, so we change it ;)
destinationRange = 3;
}
else if(objectID == 6672 || objectID == 6673) { // Xerozcheez: These objects requires to be 1 sqs max, so we change it ;)
destinationRange = 1;
}
else {
destinationRange = 2;
}
if(GoodDistance(absX, absY, objectX, objectY, destinationRange)) {
viewTo(objectX, objectY);
objectClick(objectID, objectX, objectY, 0, 0, 1);
}
else {
ActionType = 1;
destinationX = objectX;
destinationY = objectY;
destinationID = objectID;
WalkingTo = true;
}
Step 11: Press enter twice after }, and add
Code:
if (objectID == 4484)
Code:
{
castleWarsScore();
}
if (objectID == 4388 && (objectX == 2436) && (objectY == 3082))
{
if(CWon == false)
{
teleportToX = 2372;
teleportToY = 3130;
heightLevel = 1;
playerIsZamorak = true;
addItem(4042, 1);
sendMessage("You joined the Zammy Team!");
sendMessage("You cannot log out while in Castle Wars - if you wish to, leave!");
}
else
{
sendMessage("A game is currently running. Please wait "+CWT/2+" more seconds.");
}
}
if (objectID == 4387 && (objectX == 2436) && (objectY == 3096))
{
if(CWon == false)
{
teleportToX = 2427;
teleportToY = 3077;
heightLevel = 1;
playerIsSaradomin = true;
addItem(4041, 1);
wear(4041, getItemSlot(4041));
sendMessage("You joined the Sara Team!");
sendMessage("You cannot log out while in castle Wars - if you wish to, leave!");
}
if (objectID == 4911 && (objectX == 2421) && (objectY == 3074))
{
if (absX == 2421) {
teleportToX = 2421;
teleportToY = 3073;
heightLevel = 1;
}
}
if (objectID == 4427 && (objectX == 2373) && (objectY == 3119))
{
if (absY == 3120) {
teleportToX = 2373;
teleportToY = 3119;
}
if (absY == 3119) {
teleportToX = 2373;
teleportToY = 3120;
}
}
if (objectID == 4428 && (objectX == 2372) && (objectY == 3119))
{
if (absY == 3120) {
teleportToX = 2372;
teleportToY = 3119;
}
if (absY == 3119) {
teleportToX = 2372;
teleportToY = 3120;
}
}
if (objectID == 4420 && (objectX == 2382) && (objectY == 3131))
{
if (absX == 2383) {
teleportToX = 2382;
teleportToY = 3130;
}
if (absX == 2382) {
teleportToX = 2383;
teleportToY = 3133;
}
}
if (objectID == 4467 && (objectX == 2384) && (objectY == 3134))
{
if (absX == 2384) {
teleportToX = 2385;
teleportToY = 3134;
}
if (absX == 2385) {
teleportToX = 2384;
teleportToY = 3134;
}
}
if (objectID == 4470 && (objectX == 2377) && (objectY == 3131))
{
if(playerIsSaradomin == true)
{
sendMessage("You are not allowed into the enemy's area!");
} else {
if (absX == 2376) {
teleportToX = 2377;
teleportToY = 3131;
}
if (absX == 2377) {
teleportToX = 2376;
teleportToY = 3131;
}
}
}
if (objectID == 4470 && (objectX == 2373) && (objectY == 3126))
{
if(playerIsSaradomin == true)
{
sendMessage("You are not allowed into the enemy's area!");
} else {
if (absY == 3127) {
teleportToX = 2373;
teleportToY = 3126;
}
if (absY == 3126) {
teleportToX = 2373;
teleportToY = 3127;
}
}
}
//Tables, bandages etc.
if ((objectID == 4458) && (objectX == 2376) && (objectY == 3128)) //Sharks
{
addItem(385, 1);
//sendMessage ("You take a shark - have fun eating it in battle!");
}
if ((objectID == 1275) && (objectX == 2376) && (objectY == 3133)) //Picks
{
addItem(1275, 1);
//sendMessage ("You take a pick - go mine, buddy!");
}
if ((objectID == 4460) && (objectX == 2376) && (objectY == 3131)) //Rocks
{
addItem(4043, 1);
//sendMessage ("You take a rock - is it needed? Tell me.");
}
if ((objectID == 4463) && (objectX == 2373) && (objectY == 3131)) //Exploding Pots
{
addItem(4045, 1);
//sendMessage ("You take an exploding pot - go own someone!");
}
if ((objectID == 4462) && (objectX == 2373) && (objectY == 3133)) //Ropes
{
addItem(954, 1);
//sendMessage ("You take some rope - don't hang yourself!");
}
if ((objectID == 4459) && (objectX == 2370) && (objectY == 3131)) //Toolbox
{
addItem(4051, 1);
//sendMessage ("You take a toolbox - is it needed? Tell me.!");
}
if ((objectID == 4461) && (objectX == 2370) && (objectY == 3133)) //Barricades
{
addItem(4053, 1);
//sendMessage ("You take a barricade - impede the enemy!");
}
if (objectID == 4903)
{
if(playerIsZamorak == true)
{
if((playerHasItem(4037)) || (playerEquipment[3] == 4037))
{
PlayerHandler.messageToAll = playerName+" scored a point for Zammy!";
addItem(995, 5000000);
addItem(1042, 1);
txt4 = "I owned you guys with my skills! Go Zammy!";
string4UpdateRequired = true;
setAnimation(2109);
sendMessage("You win a phat and money for scoring!");
ZS += 1;
remove(4037, 3);
deleteItem(4037, getItemSlot(4037), 1);
}
else
{
sendMessage("This is YOUR flag. Go get the other teams'!");
}
}
else if(playerIsSaradomin == true && (playerHasItem(4039) || playerEquipment[3] == 4039))
{
sendMessage("You already stole the flag!");
} else {
PlayerHandler.messageToAll = playerName+" stole the Zamorak team's flag! Go get 'em!";
addItem(4039, 1);
wear(4039, getItemSlot(4039));
}
}
if (objectID == 4902)
{
if(playerIsSaradomin == true)
{
if((playerEquipment[playerWeapon] == 4039))
{
PlayerHandler.messageToAll = playerName+" scored a point for Sara!";
addItem(995, 5000000);
addItem(1040, 1);
txt4 = "I owned you guys with my skills! Go Sara!";
string4UpdateRequired = true;
setAnimation(2109);
sendMessage("You win a phat and money for scoring!");
SS += 1;
remove(4039, 3);
deleteItem(4039, getItemSlot(4039), 1);
}
else
{
sendMessage("This is YOUR flag. Go get the other teams'!");
}
}
else if(playerIsSaradomin == false && (playerHasItem(4037) || playerEquipment[3] == 4037))
{
sendMessage("You already stole the flag - back off.");
} else {
PlayerHandler.messageToAll = playerName+" stole the Saradomin team's flag! Go get 'em!";
addItem(4037, 1);
wear(4037, getItemSlot(4037));
}
}
if(objectID == 4483)
{
openUpBank();
}
if (objectID == 4417 && (objectX == 2419) && (objectY == 3078))
{
if (absX == 2420) {
teleportToX = 2419;
teleportToY = 3077;
heightLevel = 0;
}
if (absX == 2419) {
teleportToX = 2420;
teleportToY = 3080;
heightLevel = 1;
}
}
if (objectID == 4415 && (objectX == 2419) && (objectY == 3080))
{
if (absX == 2419) {
teleportToX = 2420;
teleportToY = 3080;
heightLevel = 1;
}
if (absX == 2420) {
teleportToX = 2419;
teleportToY = 3077;
heightLevel = 0;
}
}
if (objectID == 4417 && (objectX == 2428) && (objectY == 3081))
{
if (absY == 3080) {
teleportToX = 2427;
teleportToY = 3081;
heightLevel = 1;
}
if (absY == 3081) {
teleportToX = 2430;
teleportToY = 3080;
heightLevel = 2;
}
}
if (objectID == 4415 && (objectX == 2430) && (objectY == 3081))
{
if (absY == 3081) {
teleportToX = 2430;
teleportToY = 3080;
heightLevel = 2;
}
if (absY == 3080) {
teleportToX = 2427;
teleportToY = 3081;
heightLevel = 1;
}
}
if (objectID == 4417 && (objectX == 2425) && (objectY == 3074))
{
if (absX == 2426) {
teleportToX = 2425;
teleportToY = 3077;
heightLevel = 2;
}
if (absX == 2425) {
teleportToX = 2426;
teleportToY = 3074;
heightLevel = 3;
}
}
if (objectID == 4415 && (objectX == 2425) && (objectY == 3074))
{
if (absX == 2425) {
teleportToX = 2426;
teleportToY = 3074;
heightLevel = 3;
}
if (absX == 2426) {
teleportToX = 2425;
teleportToY = 3077;
heightLevel = 2;
}
}
if (objectID == 4406)
{
teleportToX = 2440; //Teleport to lobby
teleportToY = 3095; //Teleport to lobby
heightLevel = 0; //Teleport to lobby
deleteItem(4041, getItemSlot(4041), 1);
deleteItem(4039, getItemSlot(4039), 1);
playerIsSaradomin = false; //Remove player from team
sendMessage("You left castle wars. Play again!");
}
if (objectID == 4407)
{
teleportToX = 2440;
teleportToY = 3085;
heightLevel = 0;
deleteItem(4042, getItemSlot(4042), 1);
deleteItem(4037, getItemSlot(4037), 1);
playerIsZamorak = false;
sendMessage("You left castle wars. Play again pl0x!");
}
if (objectID == 4418 && (objectX == 2380) && (objectY == 3127))
{
if (absX == 2379) {
teleportToX = 2380;
teleportToY = 3130;
heightLevel = 0;
}
if (absX == 2380) {
teleportToX = 2379;
teleportToY = 3127;
heightLevel = 1;
}
}
if (objectID == 4415 && (objectX == 2380) && (objectY == 3127))
{
if (absX == 2380) {
teleportToX = 2379;
teleportToY = 3127;
heightLevel = 1;
}
if (absX == 2379) {
teleportToX = 2380;
teleportToY = 3130;
heightLevel = 0;
}
}
if (objectID == 4418 && (objectX == 2369) && (objectY == 3126))
{
if (absY == 3127) {
teleportToX = 2372;
teleportToY = 3126;
heightLevel = 1;
}
if (absY == 3126) {
teleportToX = 2369;
teleportToY = 3127;
heightLevel = 2;
}
}
if (objectID == 4415 && (objectX == 2369) && (objectY == 3126))
{
if (absY == 3126) {
teleportToX = 2369;
teleportToY = 3127;
heightLevel = 2;
}
if (absY == 3127) {
teleportToX = 2372;
teleportToY = 3126;
heightLevel = 1;
}
}
if (objectID == 4418 && (objectX == 2374) && (objectY == 3131))
{
if (absX == 2373) {
teleportToX = 2374;
teleportToY = 3130;
heightLevel = 2;
}
if (absX == 2374) {
teleportToX = 2373;
teleportToY = 3133;
heightLevel = 3;
}
}
if (objectID == 4415 && (objectX == 2374) && (objectY == 3133))
{
if (absX == 2374) {
teleportToX = 2373;
teleportToY = 3133;
heightLevel = 3;
}
if (absX == 2373) {
teleportToX = 2374;
teleportToY = 3130;
heightLevel = 2;
}
}
if (objectID == 4424 && (objectX == 2427) && (objectY == 3088))
{
if (absY == 3087) {
teleportToX = 2427;
teleportToY = 3088;
}
if (absY == 3088) {
teleportToX = 2427;
teleportToY = 3087;
}
}
if (objectID == 4423 && (objectX == 2426) && (objectY == 3088))
{
if (absY == 3087) {
teleportToX = 2426;
teleportToY = 3088;
}
if (absY == 3088) {
teleportToX = 2426;
teleportToY = 3087;
}
}
if (objectID == 4465 && (objectX == 2415) && (objectY == 3073))
{
if (absX == 2415) {
teleportToX = 2414;
teleportToY = 3073;
}
if (absX == 2414) {
teleportToX = 2415;
teleportToY = 3073;
}
}
if (objectID == 4419 && (objectX == 2417) && (objectY == 3074))
{
if (absX == 2416) {
teleportToX = 2417;
teleportToY = 3077;
}
if (absX == 2417) {
teleportToX = 2416;
teleportToY = 3074;
}
}
if (objectID == 4469 && (objectX == 2422) && (objectY == 3076))
{
if(playerIsZamorak == true)
{
sendMessage("You are not allowed into the enemy's area!");
} else {
if (absX == 2423) {
teleportToX = 2422;
teleportToY = 3076;
}
if (absX == 2422) {
teleportToX = 2423;
teleportToY = 3076;
}
}
}
if (objectID == 4469 && (objectX == 2426) && (objectY == 3081))
{
if(playerIsZamorak == true)
{
sendMessage("You are not allowed into the enemy's area!");
} else {
if (absY == 3081) {
teleportToX = 2426;
teleportToY = 3080;
}
if (absY == 3080) {
teleportToX = 2426;
teleportToY = 3081;
}
}
}
if ((objectID == 4458) && (objectX == 2423) && (objectY == 3078)) //Sharks
{
addItem(385, 1);
//sendMessage ("You take a shark - have fun eating it in battle!");
}
if ((objectID == 1275) && (objectX == 2423) && (objectY == 3073)) //Picks
{
addItem(1275, 1);
//sendMessage ("You got a pick!");
}
if ((objectID == 4460) && (objectX == 2423) && (objectY == 3075)) //Rock (needed? Tell me...)
{
addItem(4043, 1);
//sendMessage ("You got a rock - is it needed? Tell me.");
}
if ((objectID == 4463) && (objectX == 2426) && (objectY == 3075)) //Exploding Pots
{
addItem(4045, 1);
//sendMessage ("Oh no! Use this pot to explode stuff!");
}
if ((objectID == 4462) && (objectX == 2426) && (objectY == 3073)) //Ropes
{
addItem(954, 1);
//sendMessage ("You got some rope - don't hang yourself!");
}
if ((objectID == 4459) && (objectX == 2429) && (objectY == 3075)) //Toolbox
{
addItem(4051, 1);
//sendMessage ("You got a toolbox - is it needed? Tell me.");
}
if ((objectID == 4461) && (objectX == 2429) && (objectY == 3073)) //Barricades
{
addItem(4053, 1);
//sendMessage ("You got a barricade - impede the ememy!");
}
b]Step 12: [/b]Search for
Code:
else if(!savemoreinfo() && attempts >= 5)
and you'll see
Code:
else if(!savemoreinfo() && attempts >= 5)
Code:
{
//println_debug("Attempts: "+attempts+" - Giving up saving moreinfo file!");
attempts += 1;
smitimer = 14000000;
}
}
Step 13: Press enter twice after the two }'s and add
Code:
{
CWA = 0;
}
if (CWT > 0)
{
CWT-=1;
if(CWT == 0)
{
cWon = false;
sendMessage("A Castle Wars match ended! Go play, guys!");
teleportToX = 2440;
teleportToY = 3089;
heightLevel = 0;
remove(0,1);
deleteItem(4041, getItemSlot(4041), 1);
if(saraScore > zammyScore)
{
Winner = "Saradomin";
sendMessage("The game is over! "+Winner+" won the match! Go "+Winner+"!");
}
else if(zammyScore > saraScore)
{
Winner = "Zamorak";
sendMessage("The game is over! "+Winner+" won the match! Go "+Winner+"!");
}
else
{
sendMessage("The game ended in an epic tie!");
}
}
}
Step 13: Search for
Code:
public void update()
Step 14: Look up and you'll see some frames. Add this one after one.
Code:
sendFrame126("@red@CW@blu@ars", 182);
Step 15: Search for
Code:
case 165: // angry emote
startAnimation(0x35B);
break;
Step 16: Press enter twice after the break;, and add
Code:
case 161: // Castle Wars
Code:
if(emotes == 0)
{
teleportToX = 2441;
teleportToY = 3091;
heightLevel = 0;
}
else
{
emotes = 0;
pEmote = playerSE;
updateRequired = true; appearanceUpdateRequired = true;
}
break;
Step 17: Now, to add a woring CATAPULT, find this
Step 18: After a break, add
Code:
case 671: //CW Catapult - Newb 2341
Code:
if(actionTimer <= 1){
if(playerHasItemAmount(968, 1)){
deleteItem(968, getItemSlot(968), 1);
attackPlayersWithin(300, 40, 10);
attackPlayersWithin(300, 40, 10);
attackPlayersWithin(500, 40, 10);
attackPlayersWithin(400, 40, 10);
staticAnimation(2109, absX, absY, 100);
stillgfx(567, absY, absX);
hitDiff = 8 + misc.random(20);
inCombat();
sendMessage("You shot the catapult at a player...");
sendMessage("Hopefully it didn't hit YOUR team!");
txt4 = "I shot the cannon - move, team!";
string4UpdateRequired = true;
actionTimer = 45;
} else {
sendMessage("Don't click so fast!");
}
}
break;
Step 18: To add WORKING bandages, search for
Step 19: After the break;, add
Code:
startAnimation(918);
NewHP += 15 + (playerLevel[6] / 3);
if(NewHP > getLevelForXP(playerXP[3]))
NewHP = getLevelForXP(playerXP[3]);
deleteItem(4049, getItemSlot(4049), 1);
sendMessage("You patched yourself up!");
break;
[i]Credits: Newb 2341, Owned Irl & Bobby for suggesting
COMMENT, IT TOKE A LONG TIME FFS!