MegaMediaLife
Welcome to MegaMediaLife. Register to post Have fun!!!!
MegaMediaLife
Welcome to MegaMediaLife. Register to post Have fun!!!!
MegaMediaLife
Would you like to react to this message? Create an account in a few clicks or log in to continue.


MegaMediaLife
 
HomeHomeLatest imagesSearchRegisterLog in

 

 adding pest control with npc's and portals

Go down 
2 posters
AuthorMessage
java
Pwner
Pwner



Posts : 22
Reputation : 2
Join date : 2009-11-16

adding pest control with npc's and portals Empty
PostSubject: adding pest control with npc's and portals   adding pest control with npc's and portals EmptyWed Nov 18, 2009 5:01 am

make fully working pest control with randomly spwning monsters..
Difficulty: 2/10
Files modified: client.java, NPCHandler.java, player.java, playerHandler.java. npc.cfg, textHandler.java, npc1.java (new file)

Alright it's only about 85% like PC, I'm working on getting the NPCs to attack the void knight (need model) and spinners healing the portals.

Updates :
Random NPCs spawn until portal is destroyed
Game ends after 10 minutes
Reward system (i edited this to make it more appropriate)
Faster respawn time for NPCs if more players are in the game
Interface
Removed gates
Log out exits you from PC
Commands
Portal Timers
playersInPc
Teleport whole boat not just one person
Portal counts in game, not if killed when spawned by ::npc

Step 0.5a (you might not need this)

If you don't have this add it with your other voids in NPCHandler.java

Code:

public void spawnANPC(int npcID, int absX, int absY, int height)
   {
server.npcHandler.newNPC(npcID, (absX), (absY), height, absX + 3, absY + 3, absX - 3, absY - 3, 0, server.npcHandler.GetNpcListHP(npcID), false);
   }
                  
    public void newNPC(int npcType, int x, int y, int heightLevel, int rangex1, int rangey1, int rangex2, int rangey2, int WalkingType, int HP, boolean Respawns) {
        // first, search for a free slot
        int slot = -1;

        for (int i = 1; i < maxNPCs; i++) {
            if (npcs[i] == null) {
                slot = i;
                break;
            }
        }

        if (slot == -1) {
            return;
        }      // no free slot found
        if (HP <= 0) { // This will cause client crashes if we don't use this :) - ****
            HP = 3000;
        }
        NPC newNPC = new NPC(slot, npcType);

        newNPC.absX = x;
        newNPC.absY = y;
        newNPC.makeX = x;
        newNPC.makeY = y;
        newNPC.moverangeX1 = rangex1;
        newNPC.moverangeY1 = rangey1;
        newNPC.moverangeX2 = rangex2;
        newNPC.moverangeY2 = rangey2;
        newNPC.walkingType = WalkingType;
        newNPC.HP = HP;
        newNPC.MaxHP = HP;
        newNPC.MaxHit = (int) Math.floor((HP / 100));
        if (newNPC.MaxHit < 1) {
            newNPC.MaxHit = 1;
        }
        newNPC.heightLevel = heightLevel;
        newNPC.Respawns = Respawns;
        npcs[slot] = newNPC;
    }


Step 0.5b
Search for
Code:
public void initialize()
in client.java
and in there add
Code:

if(inPcGame()){
teleportToX = 2657;
teleportToY = 2639;
}

if(isInPcGame()){
teleportToX = 2657;
teleportToY = 2639;
}

if(inPcBoat()){
teleportToX = 2657;
teleportToY = 2639;
PlayerHandler.playersInPc = 0;
}

This means noone can log in and be in a Pc game straight away.

Step 1: Declaring Stuff

First open up player.java and add the following with the rest of your booleans and stuff:

Code:

public boolean inGame;
public int pcPoints;
public int option;
public boolean isInPc() {
   if((absX >= 2624 && absX <= 2688 && absY >= 2560 && absY <=2622))
   return true;
   else
   return false;
   }

Close and save.

Now open playerHandler.java and declare these things

Code:

   public static boolean portal1 = false;
   public static boolean portal2 = false;
   public static boolean portal3 = false;
   public static boolean portal4 = false;
   public static int pcWaitTimer = 300;
   public static int pcGame = 1200; //10 minutes by jellybean732
   public static int playersInPc = 0; //made by jellybean732

Step 2: Client.java stuff

Open up client.java and decalre these things

Code:

  public boolean inPcGame() {
    if (absX >= 2624 && absX <= 2690 && absY >= 2550 && absY <=2619) {
      return true;

    } else {
      return false;
    }
  }
  public boolean inPcBoat() {
    if (absX >= 2660 && absX <= 2663 && absY >= 2638 && absY <=2643) {
      return true;

    } else {
      return false;
    }
  }
public boolean isInPcGame() {
   if((absX >= 2624 && absX <= 2686 && absY >= 2560 && absY <=2625))
   return true;
   else
   return false;
   }

Then this

Code:

public void resetpc() {
      for (int i = 0; i < server.npcHandler.maxNPCs; i++) {
         if (server.npcHandler.npcs[i] != null) {
if(server.npcHandler.npcs[i].npcType == 3777 || server.npcHandler.npcs[i].npcType == 3778 || server.npcHandler.npcs[i].npcType == 3779 || server.npcHandler.npcs[i].npcType == 3780){
server.npcHandler.npcs[i].absX = 0;
server.npcHandler.npcs[i].absY = 0;
}
}
}
}

Step 2.5: Useful commands

I made these two short commands which may be very useful to you. Put them with your others.

Code:

if (command.startsWith("skippc") && command.length() > 7 && playerRights >= 2 && (inPcBoat())) {
int time = Integer.parseInt(command.substring(7));
PlayerHandler.pcWaitTimer = time;
sendMessage("Wait Time is now " + time);
}

      if (command.startsWith("pest")) {
         if (teleblock == true) {
            sendMessage("A magical force stops you from teleporting.");
         } else {
         teleportToX = 2657;
         teleportToY = 2639;
      }
}

To use the first command, type ::skippc timeYouWantToBeLeft

Step 3: Process()

So find your process() void or boolean and add this:

Code:

if(inPcBoat() && PlayerHandler.pcWaitTimer <= 4 && !inGame){
PlayerHandler.pcGame = 1200;
inGame = true;
resetpc();
teleportToX = 2658 + misc.random(1);
teleportToY = 2611 + misc.random(3);
server.npcHandler.spawnANPC(3777, 2628, 2591,0);
server.npcHandler.spawnANPC(3778, 2680, 2588,0);
server.npcHandler.spawnANPC(3779, 2669, 2570,0);
server.npcHandler.spawnANPC(3780, 2645, 2569,0);
PlayerHandler.portal1 = false;
PlayerHandler.portal2 = false;
PlayerHandler.portal3 = false;
PlayerHandler.portal4 = false;
ResetAttackNPC();
}

if((PlayerHandler.portal1 && PlayerHandler.portal2 && PlayerHandler.portal3 && PlayerHandler.portal4 && inGame)  || (PlayerHandler.pcGame <= 5 && inGame)){
inGame = false;
resetpc();
pcPoints += 2;
PlayerHandler.playersInPc = 0;
teleportToX = 2657;
teleportToY = 2639;
PlayerHandler.pcWaitTimer = 300;
playerLevel[0] = getLevelForXP(playerXP[0]);
playerLevel[1] = getLevelForXP(playerXP[1]);
playerLevel[2] = getLevelForXP(playerXP[2]);
playerLevel[4] = getLevelForXP(playerXP[4]);
playerLevel[5] = getLevelForXP(playerXP[5]);
playerLevel[6] = getLevelForXP(playerXP[6]);
sendMessage("You have defeated pest control! You now have "+pcPoints+" points!");
ResetAttackNPC();
refreshSkills();
}

Now you're gonna need to get on to the boat so add this in case 132 (search for case 132: )

Code:

if(objectID == 14315 && actionTimer == 0){
sendMessage("You enter the boat, "+PlayerHandler.pcWaitTimer+" till next game starts.");
teleportToX = 2660;
teleportToY = 2639;
PlayerHandler.playersInPc += 1;
actionTimer = 5;
}

if(objectID == 14314 && actionTimer == 0){
sendMessage("You leave the boat.");
teleportToX = 2657;
teleportToY = 2639;
PlayerHandler.playersInPc -= 1;
actionTimer = 5;
}


Step 4: NPCHandler

Open up NPCHander.java and search for where you have your drops (randomBronze() or something for example). Under the last } in that method, add this:

Code:

{
                                int Player = npcs[NPCID].StartKilling;
                                client ppl = (client) server.playerHandler.players[Player];
 
                     if (npcs[NPCID].npcType == 3777 && ppl.inPcGame()) {
PlayerHandler.portal1 = true;
}
                     if (npcs[NPCID].npcType == 3780 && ppl.inPcGame()) {
PlayerHandler.portal2 = true;
}
                     if (npcs[NPCID].npcType == 3779 && ppl.inPcGame()) {
PlayerHandler.portal3 = true;
}
                     if (npcs[NPCID].npcType == 3778 && ppl.inPcGame()) {
PlayerHandler.portal4 = true;
}

}

Step 5: Monsters (made by me)

This will only make monsters for the east portal but it's not hard to copy and paste and change the coordinates is it?

First, in client.java, above void process() or boolean process(), add

Code:

   public int portalTimer1 = 0;
   public int portalTimer2 = 0;
   public int portalTimer3 = 0;
   public int portalTimer4 = 0;

Then in your process() void or boolean, add this

Code:

if (portalTimer1 == 0 && !PlayerHandler.portal1 && inPcGame()) {
server.npcHandler.spawnANPC(npc1.randompcnpc(), 2630, 2592,0);
portalTimer1 = 20 + (100/PlayerHandler.playersInPc);
}
if (portalTimer2 == 0 && !PlayerHandler.portal2 && inPcGame()) {
server.npcHandler.spawnANPC(npc1.randompcnpc(), 2646, 2571,0);
portalTimer2 = 20 + (100/PlayerHandler.playersInPc);
}
if (portalTimer3 == 0 && !PlayerHandler.portal3 && inPcGame()) {
server.npcHandler.spawnANPC(npc1.randompcnpc(), 2670, 2572,0);
portalTimer3 = 20 + (100/PlayerHandler.playersInPc);
}
if (portalTimer4 == 0 && !PlayerHandler.portal4 && inPcGame()) {
server.npcHandler.spawnANPC(npc1.randompcnpc(), 2680, 2589,0);
portalTimer4 = 20 + (100/PlayerHandler.playersInPc);
}

and don't forget to make the timer go down using this (also in process() )

Code:

      if (portalTimer1 > 0) {
         portalTimer1 -= 1;
      }

      if (portalTimer2 > 0) {
         portalTimer2 -= 1;
      }

      if (portalTimer3 > 0) {
         portalTimer3 -= 1;
      }

      if (portalTimer4 > 0) {
         portalTimer4 -= 1;
      }


      if (PlayerHandler.pcGame > 0) {
         PlayerHandler.pcGame -= 1;
      }

      if (PlayerHandler.pcGame < 0) {
         PlayerHandler.pcGame = 1200;
      }

Massive update, made by me

Create a new file called npc1.java and paste this in it:

Code:

//created by joshua mustill (C)

import java.io.*;

public class npc1 {

    public static int pcnpc[] = {
   3732, //shifter
   3733, //shifter
   3734, //shifter
   3735, //shifter
   3736, //shifter
   3737, //shifter
   3738, //shifter
   3739, //shifter
   3740, //shifter
   3741, //shifter

   3752, //torcher
   3753, //torcher
   3754, //torcher
   3755, //torcher
   3756, //torcher
   3757, //torcher
   3758, //torcher
   3759, //torcher
   3760, //torcher
   3761, //torcher

   3747, //spinner
   3748, //spinner
   3749, //spinner
   3750, //spinner
   3751, //spinner

   3742, //ravager
   3743, //ravager
   3744, //ravager
   3745, //ravager
   3746, //ravager

   3762, //defiler
   3763, //defiler
   3764, //defiler
   3765, //defiler
   3766, //defiler
   3767, //defiler
   3768, //defiler
   3769, //defiler
   3770, //defiler
   3771, //defiler

   3772, //brawler
   3773, //brawler
   3774, //brawler
   3775, //brawler
   3776, //brawler
};

    public static int randompcnpc() {
        return pcnpc[(int) (Math.random() * pcnpc.length)];
    }   
}

(sorry for the bad layout, i used excel to minimise writing.

What this does is it spawns a random pc npc instead of always the same. hope u like it!

There you go, post any problems, I might post coords for more monsters later.

Step 6 (to make your NPCs killable)

Just a reminder to add any NPC ids you are using into your npc.cfg as they are unlikely to already be in there, like this.

Code:

npc = 3777   Portal_1         0   500
npc = 3778   Portal_2         0   500
npc = 3779   Portal_3         0   500
npc = 3780   Portal_4         0   500
npc = 3732   Shifter            37   30
npc = 3733   Shifter            37   30
npc = 3734   Shifter            56   40
npc = 3735   Shifter            56   40
npc = 3736   Shifter            75   60
npc = 3737   Shifter            75   60
npc = 3738   Shifter            94   73
npc = 3739   Shifter            94   73
npc = 3740   Shifter            113   82
npc = 3741   Shifter            113   82

npc = 3752   Torcher            33   25
npc = 3753   Torcher            33   25
npc = 3754   Torcher            49   37
npc = 3755   Torcher            49   37
npc = 3756   Torcher            67   52
npc = 3757   Torcher            67   52
npc = 3758   Torcher            83   64
npc = 3759   Torcher            83   64
npc = 3760   Torcher            100   78
npc = 3761   Torcher            100   78

npc = 3747   Spinner            37   40
npc = 3748   Spinner            55   60
npc = 3749   Spinner            74   80
npc = 3750   Spinner            87   95
npc = 3751   Spinner            92   100

npc = 3742   Ravager            35   30
npc = 3743   Ravager            52   45
npc = 3744   Ravager            70   60
npc = 3745   Ravager            88   75
npc = 3746   Ravager            105   90

npc = 3762   Defiler            33   34
npc = 3763   Defiler            33   34
npc = 3764   Defiler            50   52
npc = 3765   Defiler            50   52
npc = 3766   Defiler            67   69
npc = 3767   Defiler            67   69
npc = 3768   Defiler            84   85
npc = 3769   Defiler            84   85
npc = 3770   Defiler            100   104
npc = 3771   Defiler            100   104

npc = 3772   Brawler            50   60
npc = 3773   Brawler            75   90
npc = 3774   Brawler            100   120
npc = 3775   Brawler            128   150
npc = 3776   Brawler            157   180

Step 7 (Optional)

You might want to add this to your case 9154 (logout) to stop people being allowed to log out in PC

So search for case 9154 and you should see something like

Code:

{
               if (LogoutDelay >= 1) {
                  sendMessage(
                        "You must wait 10 seconds after combat to log out!");
               } else if (LogoutDelay == 0) {
                  logout();
                  savefile = true;
               }
            }
            break;

Add this after the FIRST {

Code:

   if (inPcGame() == true)
   {
   teleportToX = 2657;
   teleportToY = 2639;
   logout();
   savefile = true;
   }
   if (inPcBoat() == true)
   {
   teleportToX = 2657;
   teleportToY = 2639;
   PlayerHandler.playersInPc -= 1;
   logout();
   savefile = true;
   }


Step 8: The Interface
Add this void:

Code:

public void checkPortals()
{
int gameTime = PlayerHandler.pcGame;
        sendQuest("@dbl@Pest Control", 15894);
        sendQuest("", 15895);
        sendQuest("", 15896);
if (!PlayerHandler.portal1 && inPcGame())
{
sendQuest("@whi@East Portal: @gre@Alive", 15897);
}
if (PlayerHandler.portal1 && inPcGame())
{
sendQuest("@whi@East Portal: @red@Dead", 15897);
}

if (!PlayerHandler.portal2 && inPcGame())
{
sendQuest("@whi@South West Portal: @gre@Alive", 15898);
}
if (PlayerHandler.portal2 && inPcGame())
{
sendQuest("@whi@South West Portal: @red@Dead", 15898);
}

if (!PlayerHandler.portal3 && inPcGame())
{
sendQuest("@whi@South East Portal: @gre@Alive", 15899);
}
if (PlayerHandler.portal3 && inPcGame())
{
sendQuest("@whi@South East Portal: @red@Dead", 15899);
}

if (!PlayerHandler.portal4 && inPcGame())
{
sendQuest("@whi@West Portal: @gre@Alive", 15900);
}
if (PlayerHandler.portal4 && inPcGame())
{
sendQuest("@whi@West Portal: @red@Dead", 15900);
}

   if(gameTime <= 1320 && gameTime >= 1200)
{
   sendQuest("@gre@ 11 minutes", 15901);
}
if(gameTime <= 1200 && gameTime >= 1080 )
{
sendQuest("@gre@ 10 minutes left", 15901);
appearanceUpdateRequired = true;
}
if(gameTime <= 1080 && gameTime >= 960 )
{
sendQuest("@gre@ 9 minutes left", 15901);

appearanceUpdateRequired = true;
}
if(gameTime <= 960 && gameTime >= 840 )
{
sendQuest("@gre@ 8 minutes left", 15901);

appearanceUpdateRequired = true;
}
if(gameTime <= 840 && gameTime >= 720)
{
sendQuest("@gre@ 7 minutes left", 15901);

appearanceUpdateRequired = true;
}
if(gameTime <= 720 && gameTime >= 600)
{
sendQuest("@gre@ 6 minutes left", 15901);

appearanceUpdateRequired = true;
}
if(gameTime <= 600 && gameTime >= 480)
{
sendQuest("@gre@ 5 minutes left", 15901);

appearanceUpdateRequired = true;
}
if(gameTime <= 480 && gameTime >= 360)
{
sendQuest("@gre@ 4 minutes left", 15901);

appearanceUpdateRequired = true;
}
if(gameTime <= 360 && gameTime >= 240)
{
sendQuest("@gre@ 3 minutes left", 15901);

appearanceUpdateRequired = true;
}
if(gameTime <= 240 && gameTime >= 120)
{
sendQuest("@gre@ 2 minutes left", 15901);

appearanceUpdateRequired = true;
}
if(gameTime <= 120 && gameTime >= 0)
{
sendQuest("@gre@ 1 minute left", 15901);

appearanceUpdateRequired = true;
}



        sendQuest("", 15902);
        sendQuest("", 15903);
        sendQuest("", 15904);
        sendQuest("", 15905);
        sendQuest("", 15906);
        setInterfaceWalkable(15892);
    }

Then search in your process void for something like
Code:

if(nonWild())
{
outStream.createFrame(208);
outStream.writeWordBigEndian_dup(197);
sendQuest("@gre@Safe", 199);
      }

and change it to

Code:

if(nonWild() && (!inPcGame()))
{
outStream.createFrame(208);
outStream.writeWordBigEndian_dup(197);
sendQuest("@gre@Safe", 199);
      }

Then find
Code:
public boolean nonWild()

and add these two lines

Code:

            || (absX >= 2624 && absX <= 2690 && absY >= 2550 && absY <= 2619)
            || (absX >= 2660 && absX <= 2663 && absY >= 2638 && absY <= 2643)

Now, you'll see an interface displaying which portals are dead and you'll also be in a safe zone.

Step 9: Removing Gates
Find
Code:
public void Deletewalls()

and add these

Code:

//pest
      deletethatwall(2643, 2593);
      deletethatwall(2643, 2592);
      deletethatwall(2657, 2585);
      deletethatwall(2658, 2585);
      deletethatwall(2670, 2593);
      deletethatwall(2670, 2592);
//end pest

Thanks

A few quick pics

adding pest control with npc's and portals Picture9-1
adding pest control with npc's and portals Picture8-1
adding pest control with npc's and portals Picture7-1
adding pest control with npc's and portals Picture6-1

Step 10: Rewards
Add this with your
Code:
OBJECT CLICK ONE

Code:

case 3377:
customCommand("buypc");
break;

Then add this customCommand by searching
Code:
command.equalsIgnore

and adding this after the last }

Code:

if (command.equalsIgnoreCase("buypc")) {
showInterface(18691);
flushOutStream();
}

Then add this to your newObjects() void

Code:
      makeGlobalObject(2660, 2648, 3377, 0, 10);

Now declare these voids (they will change the colour of the choice you have clicked) (most creds to Justah, I added default red and made it say points + converted for non-Delta)

Code:

public void PCOP1() {
      sendQuest("@gre@20000 Xp (10)", 18767);
      sendQuest("@dre@20000 Xp (10)", 18768);
      sendQuest("@dre@20000 Xp (10)", 18769);
      sendQuest("@dre@20000 Xp (10)", 18770);
      sendQuest("@dre@20000 Xp (10)", 18771);
      sendQuest("@dre@20000 Xp (10)", 18772);
      sendQuest("@dre@20000 Xp (10)", 18773);
      sendQuest("@gre@Attack", 18782);
   }
   public void PCOP2() {
      sendQuest("@dre@20000 Xp (10)", 18767);
      sendQuest("@gre@20000 Xp (10)", 18768);
      sendQuest("@dre@20000 Xp (10)", 18769);
      sendQuest("@dre@20000 Xp (10)", 18770);
      sendQuest("@dre@20000 Xp (10)", 18771);
      sendQuest("@dre@20000 Xp (10)", 18772);
      sendQuest("@dre@20000 Xp (10)", 18773);
      sendQuest("@gre@Strength", 18782);
   }
   public void PCOP3() {
      sendQuest("@dre@20000 Xp (10)", 18767);
      sendQuest("@dre@20000 Xp (10)", 18768);
      sendQuest("@gre@20000 Xp (10)", 18769);
      sendQuest("@dre@20000 Xp (10)", 18770);
      sendQuest("@dre@20000 Xp (10)", 18771);
      sendQuest("@dre@20000 Xp (10)", 18772);
      sendQuest("@dre@20000 Xp (10)", 18773);
      sendQuest("@gre@Defence", 18782);
   }
   public void PCOP4() {
      sendQuest("@dre@20000 Xp (10)", 18767);
      sendQuest("@dre@20000 Xp (10)", 18768);
      sendQuest("@dre@20000 Xp (10)", 18769);
      sendQuest("@gre@20000 Xp (10)", 18770);
      sendQuest("@dre@20000 Xp (10)", 18771);
      sendQuest("@dre@20000 Xp (10)", 18772);
      sendQuest("@dre@20000 Xp (10)", 18773);
      sendQuest("@gre@Range", 18782);
   }
   public void PCOP5() {
      sendQuest("@dre@20000 Xp (10)", 18767);
      sendQuest("@dre@20000 Xp (10)", 18768);
      sendQuest("@dre@20000 Xp (10)", 18769);
      sendQuest("@dre@20000 Xp (10)", 18770);
      sendQuest("@gre@20000 Xp (10)", 18771);
      sendQuest("@dre@20000 Xp (10)", 18772);
      sendQuest("@dre@20000 Xp (10)", 18773);
      sendQuest("@gre@Magic", 18782);
   }
   public void PCOP6() {
      sendQuest("@dre@20000 Xp (10)", 18767);
      sendQuest("@dre@20000 Xp (10)", 18768);
      sendQuest("@dre@20000 Xp (10)", 18769);
      sendQuest("@dre@20000 Xp (10)", 18770);
      sendQuest("@dre@20000 Xp (10)", 18771);
      sendQuest("@gre@20000 Xp (10)", 18772);
      sendQuest("@dre@20000 Xp (10)", 18773);
      sendQuest("@gre@Hitpoints", 18782);
   }
   public void PCOP7() {
      sendQuest("@dre@20000 Xp (10)", 18767);
      sendQuest("@dre@20000 Xp (10)", 18768);
      sendQuest("@dre@20000 Xp (10)", 18769);
      sendQuest("@dre@20000 Xp (10)", 18770);
      sendQuest("@dre@20000 Xp (10)", 18771);
      sendQuest("@dre@20000 Xp (10)", 18772);
      sendQuest("@gre@20000 Xp (10)", 18773);
      sendQuest("@gre@Prayer", 18782);
   }
Next add this in case 185 (clicking most buttons AKA clickingMost.java in Delta)

Code:

//pc
case 73072:
case 73079:
option = 5;
PCOP1();
break;
case 73073:
case 73080:
option = 6;
PCOP2();
break;
case 73074:
case 73081:
option = 7;
PCOP3();
break;
case 73082:
case 73075:
option = 8;
PCOP4();
break;
case 73083:
case 73076:
option = 9;
PCOP5();
break;
case 73084:
case 73077:
option = 10;
PCOP6();
break;
case 73085:
case 73078:
option = 11;
PCOP7();
break;
case 73091:
if(option == 0 && actionTimer == 0){
sendMessage("You forgot to choose a reward.");
actionTimer = 4;
}
if(option == 5 && pcPoints > 9 && actionTimer == 0){
sendMessage("You have been rewarded with attack XP");
addSkillXP(20000, 0);
pcPoints -= 10;
closeInterface();
actionTimer = 4;
}
if(option == 5 && pcPoints < 10 && actionTimer == 0){
sendMessage("You do not have enough points!");
actionTimer = 4;
}
if(option == 6 && pcPoints > 9 && actionTimer == 0){
sendMessage("You have been rewarded with Strength XP");
addSkillXP(20000, 2);
pcPoints -= 10;
closeInterface();
actionTimer = 4;
}
if(option == 6 && pcPoints < 10 && actionTimer == 0){
sendMessage("You do not have enough points!");
actionTimer = 4;
}
if(option == 7 && pcPoints > 9 && actionTimer == 0){
sendMessage("You have been rewarded with Defence XP!");
addSkillXP(20000, 1);
pcPoints -= 10;
closeInterface();
actionTimer = 4;
}
if(option == 7 && pcPoints < 10 && actionTimer == 0){
sendMessage("You do not have enough points!");
actionTimer = 4;
}
if(option == 8 && pcPoints > 9 && actionTimer == 0){
sendMessage("You have been rewarded with ranged XP!");
addSkillXP(20000, 4);
pcPoints -= 10;
closeInterface();
actionTimer = 4;
}
if(option == 8 && pcPoints < 10 && actionTimer == 0){
sendMessage("You do not have enough points!");
actionTimer = 4;
}
if(option == 9 && pcPoints > 9 && actionTimer == 0){
sendMessage("You have been rewarded with Magic XP!");
addSkillXP(20000, 6);
pcPoints -= 10;
closeInterface();
actionTimer = 4;
}
if(option == 9 && pcPoints < 10 && actionTimer == 0){
sendMessage("You do not have enough points!");
actionTimer = 4;
}
if(option == 10 && pcPoints > 9 && actionTimer == 0){
sendMessage("You have been rewarded with Hitpoints XP!");
addSkillXP(20000, 3);
pcPoints -= 10;
closeInterface();
actionTimer = 4;
}
if(option == 10 && pcPoints < 10 && actionTimer == 0){
sendMessage("You do not have enough points!");
actionTimer = 4;
}
if(option == 11 && pcPoints > 9 && actionTimer == 0){
sendMessage("You have been rewarded with Prayer XP!");
addSkillXP(20000, 5);
pcPoints -= 10;
closeInterface();
actionTimer = 4;
}
if(option == 11 && pcPoints < 10 && actionTimer == 0){
sendMessage("You do not have enough points!");
actionTimer = 4;
}
//end pc

In your textHandler.java add this anywhere

Code:

//pc
p.sendQuest("@dre@20000 Xp (10)", 18767);
p.sendQuest("@dre@20000 Xp (10)", 18768);
p.sendQuest("@dre@20000 Xp (10)", 18769);
p.sendQuest("@dre@20000 Xp (10)", 18770);
p.sendQuest("@dre@20000 Xp (10)", 18771);
p.sendQuest("@dre@20000 Xp (10)", 18772);
p.sendQuest("@dre@20000 Xp (10)", 18773);
p.sendQuest("@yel@Confirm", 18780);
p.sendQuest("Points: "+p.pcPoints+"", 18783);
p.sendQuest("", 18782);

And you're done! Remember to check back for updates!

UPDATE: Saving points

In client.java search for:

Code:

    } else if (token.equals("character-starter")) {
    starter = Integer.parseInt(token2);

and add after it

Code:

               } else if (token.equals("character-pcpoints")) {
                  pcPoints = Integer.parseInt(token2);

Then search again for:

Code:

    } else if (token.equals("character-starter")) {
    starter = Integer.parseInt(token2);

and after it add

Code:

               } else if (token.equals("character-pcpoints")) {
                  pcPoints = Integer.parseInt(token2);
again

Finally search for
Code:

         characterfile.write("character-starter = ", 0, 20);
         characterfile.write(Integer.toString(starter), 0,
               Integer.toString(starter).length());
         characterfile.newLine();

and after it add

Code:

         characterfile.write("character-pcpoints = ", 0, 21);
         characterfile.write(Integer.toString(pcPoints), 0, Integer.toString(pcPoints).length());
         characterfile.newLine();
Back to top Go down
Trey
Pwner
Pwner



Posts : 20
Reputation : 1
Join date : 2009-11-18

adding pest control with npc's and portals Empty
PostSubject: Re: adding pest control with npc's and portals   adding pest control with npc's and portals EmptyWed Nov 18, 2009 5:18 am

A lot of it can be shortened/improved.

For instance, all of your isIn methods:
Code:

public boolean inPcGame() {
    if (absX >= 2624 && absX <= 2690 && absY >= 2550 && absY <=2619) {
      return true;

    } else {
      return false;
    }
  }

Code:

public boolean inPcGame() {
    return (absX >= 2624 && absX <= 2690 && absY >= 2550 && absY <=2619);
}
Back to top Go down
java
Pwner
Pwner



Posts : 22
Reputation : 2
Join date : 2009-11-16

adding pest control with npc's and portals Empty
PostSubject: Re: adding pest control with npc's and portals   adding pest control with npc's and portals EmptyWed Nov 18, 2009 5:22 am

i know but.. i like doing it that way.=] thanks for advice
Back to top Go down
Trey
Pwner
Pwner



Posts : 20
Reputation : 1
Join date : 2009-11-18

adding pest control with npc's and portals Empty
PostSubject: Re: adding pest control with npc's and portals   adding pest control with npc's and portals EmptyThu Nov 19, 2009 4:13 am

java wrote:
i know but.. i like doing it that way.=] thanks for advice

No need to generate more bytecode =P.
Back to top Go down
Sponsored content





adding pest control with npc's and portals Empty
PostSubject: Re: adding pest control with npc's and portals   adding pest control with npc's and portals Empty

Back to top Go down
 
adding pest control with npc's and portals
Back to top 
Page 1 of 1
 Similar topics
-
» Adding XP Lock to your server (Stops your getting EXP when activated.)
» Adding Health and Prayer at top of client screen.

Permissions in this forum:You cannot reply to topics in this forum
MegaMediaLife :: Runescape Private Servers :: 317 Related Boards :: Tutorials-
Jump to: