Thread: Fully Working Pest Control with Portals

Page 1 of 6 123 ... LastLast
Results 1 to 10 of 60
  1. #1 Fully Working Pest Control with Portals 
    Registered Member
    Join Date
    Nov 2007
    Posts
    48
    Thanks given
    0
    Thanks received
    0
    Rep Power
    5
    What it does: Makes fully working Pest Control, with random monsters and less respawn time if more players are playing (both made and coded by me, not dleta_
    Difficulty: 3/10
    Credits: 5% Me (i took off Deltascape, made it spawn NPCs and posted, i deserve some credit right?)
    95% Deltascape
    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 by me not Delta
    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 :kippc 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("@[email protected] Control", 15894);
            sendQuest("", 15895);
            sendQuest("", 15896);
    if (!PlayerHandler.portal1 && inPcGame())
    {
    sendQuest("@[email protected] Portal: @[email protected]", 15897);
    }
    if (PlayerHandler.portal1 && inPcGame())
    {
    sendQuest("@[email protected] Portal: @[email protected]", 15897);
    }
    
    if (!PlayerHandler.portal2 && inPcGame())
    {
    sendQuest("@[email protected] West Portal: @[email protected]", 15898);
    }
    if (PlayerHandler.portal2 && inPcGame())
    {
    sendQuest("@[email protected] West Portal: @[email protected]", 15898);
    }
    
    if (!PlayerHandler.portal3 && inPcGame())
    {
    sendQuest("@[email protected] East Portal: @[email protected]", 15899);
    }
    if (PlayerHandler.portal3 && inPcGame())
    {
    sendQuest("@[email protected] East Portal: @[email protected]", 15899);
    }
    
    if (!PlayerHandler.portal4 && inPcGame())
    {
    sendQuest("@[email protected] Portal: @[email protected]", 15900);
    }
    if (PlayerHandler.portal4 && inPcGame())
    {
    sendQuest("@[email protected] Portal: @[email protected]", 15900);
    }
    
    	if(gameTime <= 1320 && gameTime >= 1200)
    {
    	sendQuest("@[email protected] 11 minutes", 15901);
    }
    if(gameTime <= 1200 && gameTime >= 1080 )
    {
    sendQuest("@[email protected] 10 minutes left", 15901);
    appearanceUpdateRequired = true;
    }
    if(gameTime <= 1080 && gameTime >= 960 )
    {
    sendQuest("@[email protected] 9 minutes left", 15901);
    
    appearanceUpdateRequired = true;
    }
    if(gameTime <= 960 && gameTime >= 840 )
    {
    sendQuest("@[email protected] 8 minutes left", 15901);
    
    appearanceUpdateRequired = true;
    }
    if(gameTime <= 840 && gameTime >= 720)
    {
    sendQuest("@[email protected] 7 minutes left", 15901);
    
    appearanceUpdateRequired = true;
    }
    if(gameTime <= 720 && gameTime >= 600)
    {
    sendQuest("@[email protected] 6 minutes left", 15901);
    
    appearanceUpdateRequired = true;
    }
    if(gameTime <= 600 && gameTime >= 480)
    {
    sendQuest("@[email protected] 5 minutes left", 15901);
    
    appearanceUpdateRequired = true;
    }
    if(gameTime <= 480 && gameTime >= 360)
    {
    sendQuest("@[email protected] 4 minutes left", 15901);
    
    appearanceUpdateRequired = true;
    }
    if(gameTime <= 360 && gameTime >= 240)
    {
    sendQuest("@[email protected] 3 minutes left", 15901);
    
    appearanceUpdateRequired = true;
    }
    if(gameTime <= 240 && gameTime >= 120)
    {
    sendQuest("@[email protected] 2 minutes left", 15901);
    
    appearanceUpdateRequired = true;
    }
    if(gameTime <= 120 && gameTime >= 0)
    {
    sendQuest("@[email protected] 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("@[email protected]", 199);
    		}
    and change it to

    Code:
    if(nonWild() && (!inPcGame()))
    {
    outStream.createFrame(208);
    outStream.writeWordBigEndian_dup(197);
    sendQuest("@[email protected]", 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






    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("@[email protected] Xp (10)", 18767);
    		sendQuest("@[email protected] Xp (10)", 18768);
    		sendQuest("@[email protected] Xp (10)", 18769);
    		sendQuest("@[email protected] Xp (10)", 18770);
    		sendQuest("@[email protected] Xp (10)", 18771);
    		sendQuest("@[email protected] Xp (10)", 18772);
    		sendQuest("@[email protected] Xp (10)", 18773);
    		sendQuest("@[email protected]", 18782);
    	}
    	public void PCOP2() {
    		sendQuest("@[email protected] Xp (10)", 18767);
    		sendQuest("@[email protected] Xp (10)", 18768);
    		sendQuest("@[email protected] Xp (10)", 18769);
    		sendQuest("@[email protected] Xp (10)", 18770);
    		sendQuest("@[email protected] Xp (10)", 18771);
    		sendQuest("@[email protected] Xp (10)", 18772);
    		sendQuest("@[email protected] Xp (10)", 18773);
    		sendQuest("@[email protected]", 18782);
    	}
    	public void PCOP3() {
    		sendQuest("@[email protected] Xp (10)", 18767);
    		sendQuest("@[email protected] Xp (10)", 18768);
    		sendQuest("@[email protected] Xp (10)", 18769);
    		sendQuest("@[email protected] Xp (10)", 18770);
    		sendQuest("@[email protected] Xp (10)", 18771);
    		sendQuest("@[email protected] Xp (10)", 18772);
    		sendQuest("@[email protected] Xp (10)", 18773);
    		sendQuest("@[email protected]", 18782);
    	}
    	public void PCOP4() {
    		sendQuest("@[email protected] Xp (10)", 18767);
    		sendQuest("@[email protected] Xp (10)", 18768);
    		sendQuest("@[email protected] Xp (10)", 18769);
    		sendQuest("@[email protected] Xp (10)", 18770);
    		sendQuest("@[email protected] Xp (10)", 18771);
    		sendQuest("@[email protected] Xp (10)", 18772);
    		sendQuest("@[email protected] Xp (10)", 18773);
    		sendQuest("@[email protected]", 18782);
    	}
    	public void PCOP5() {
    		sendQuest("@[email protected] Xp (10)", 18767);
    		sendQuest("@[email protected] Xp (10)", 18768);
    		sendQuest("@[email protected] Xp (10)", 18769);
    		sendQuest("@[email protected] Xp (10)", 18770);
    		sendQuest("@[email protected] Xp (10)", 18771);
    		sendQuest("@[email protected] Xp (10)", 18772);
    		sendQuest("@[email protected] Xp (10)", 18773);
    		sendQuest("@[email protected]", 18782);
    	}
    	public void PCOP6() {
    		sendQuest("@[email protected] Xp (10)", 18767);
    		sendQuest("@[email protected] Xp (10)", 18768);
    		sendQuest("@[email protected] Xp (10)", 18769);
    		sendQuest("@[email protected] Xp (10)", 18770);
    		sendQuest("@[email protected] Xp (10)", 18771);
    		sendQuest("@[email protected] Xp (10)", 18772);
    		sendQuest("@[email protected] Xp (10)", 18773);
    		sendQuest("@[email protected]", 18782);
    	}
    	public void PCOP7() {
    		sendQuest("@[email protected] Xp (10)", 18767);
    		sendQuest("@[email protected] Xp (10)", 18768);
    		sendQuest("@[email protected] Xp (10)", 18769);
    		sendQuest("@[email protected] Xp (10)", 18770);
    		sendQuest("@[email protected] Xp (10)", 18771);
    		sendQuest("@[email protected] Xp (10)", 18772);
    		sendQuest("@[email protected] Xp (10)", 18773);
    		sendQuest("@[email protected]", 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("@[email protected] Xp (10)", 18767);
    p.sendQuest("@[email protected] Xp (10)", 18768);
    p.sendQuest("@[email protected] Xp (10)", 18769);
    p.sendQuest("@[email protected] Xp (10)", 18770);
    p.sendQuest("@[email protected] Xp (10)", 18771);
    p.sendQuest("@[email protected] Xp (10)", 18772);
    p.sendQuest("@[email protected] Xp (10)", 18773);
    p.sendQuest("@[email protected]", 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();
    Reply With Quote  
     

  2. #2  
    Registered Member
    LunarKnight's Avatar
    Join Date
    Jan 2009
    Age
    29
    Posts
    676
    Thanks given
    7
    Thanks received
    29
    Rep Power
    87
    Whoa...
    There's so much info there that I don't even wanna try adding it.
    Nice.

    EDIT:
    Un-doable I guess.
    Your not telling us where to put things in the beginning.
    VERY irritating.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Nov 2007
    Posts
    48
    Thanks given
    0
    Thanks received
    0
    Rep Power
    5
    OK it goes in NPCHandler.java, thanks for pointing out the error. It was so long I couldn't be bothered to explain what each thing does. Just take my word for it that it works or play my server to test it out.
    Reply With Quote  
     

  4. #4  
    Registered Member
    LunarKnight's Avatar
    Join Date
    Jan 2009
    Age
    29
    Posts
    676
    Thanks given
    7
    Thanks received
    29
    Rep Power
    87
    Quote Originally Posted by Jellybean732 View Post
    OK it goes in NPCHandler.java, thanks for pointing out the error. It was so long I couldn't be bothered to explain what each thing does. Just take my word for it that it works or play my server to test it out.
    Well yeah I bet it does work.
    I'm just mad that almost nothing is compatible with my server and people have servers that are compatible with all of the tutorials >.<

    EDIT:
    See I couldn't even search for public void initialize()
    Fuck me
    I don't even have "initialize" in my NPCHandler..

    EDIT#2:
    I found it in client.Java.
    Yet you never said that in the tutorial which threw me off hardcore.

    EDIT#3:
    -Sigh/Barf/Sigh-
    100 errors MINIMUM.
    Reply With Quote  
     

  5. #5  
    //

    Join Date
    Jun 2007
    Posts
    45
    Thanks given
    2
    Thanks received
    14
    Rep Power
    654
    This can be done so much easier, yet so much less code. Your code is not BAD, but it can be improved. And for a suggestion you should do things in a class file, I'll show you example...

    Code:
    public class PestControl
    {
    
    	public PestControl(Client c)
    	{
    		this.c = Client;
    	}
    	
    	public void checkPortal()
    	{
    		int gameTime = PlayerHandler.pcGame;
            c.sendQuest("@[email protected] Control", 15894);
            c.sendQuest("", 15895);
            c.sendQuest("", 15896);
    		
    		if (!PlayerHandler.portEast && inPCGame())
    		{
    			c.sendQuest("East Portal: @[email protected]", 15897);
    		}
    		if (PlayerHandler.portEast && inPCGame())
    		{	
    			sendQuest("East Portal: @[email protected]", 15897);
    		}
    
    		if (!PlayerHandler.portSouthWest && inPCGame())
    		{
    			sendQuest("South West Portal: @[email protected]", 15898);
    		}
    		if (PlayerHandler.portWest && inPCGame())
    		{
    			sendQuest("South West Portal: @[email protected]", 15898);
    		}
    
    		if (!PlayerHandler.portSouthEast && inPCGame())
    		{
    			sendQuest("South East Portal: @[email protected]", 15899);
    		}
    		if (PlayerHandler.portSouthEast && inPCGame())
    		{
    			c.sendQuest("South East Portal: @[email protected]", 15899);
    		}
    
    		if (!PlayerHandler.portWest && inPCGame())
    		{
    			c.sendQuest("West Portal: @[email protected]", 15900);
    		}
    		if (PlayerHandler.portWest && inPCGame())
    		{
    			c.sendQuest("West Portal: @[email protected]", 15900);
    		}
    
    		if(gameTime <= 960 && gameTime >= 840 )
    		{
    			c.sendQuest("8 minutes left", 15901);
    			c.appearanceUpdateRequired = true;
    		}
    		if(gameTime <= 840 && gameTime >= 720)
    		{
    			c.sendQuest("7 minutes left", 15901);
    			c.appearanceUpdateRequired = true;
    		}
    		if(gameTime <= 720 && gameTime >= 600)
    		{
    			c.sendQuest("6 minutes left", 15901);
    			c.appearanceUpdateRequired = true;
    		}	
    		if(gameTime <= 600 && gameTime >= 480)
    		{
    			c.sendQuest("5 minutes left", 15901);
    			c.appearanceUpdateRequired = true;
    		}
    		if(gameTime <= 480 && gameTime >= 360)
    		{
    			c.sendQuest("4 minutes left", 15901);
    			c.appearanceUpdateRequired = true;
    		}
    		if(gameTime <= 360 && gameTime >= 240)
    		{
    			c.sendQuest("3 minutes left", 15901);
    			c.appearanceUpdateRequired = true;
    		}
    		if(gameTime <= 240 && gameTime >= 120)
    		{
    			c.sendQuest("2 minutes left", 15901);
    			c.appearanceUpdateRequired = true;
    		}
    		if(gameTime <= 120 && gameTime >= 0)
    		{
    			c.sendQuest("1 minute left", 15901);
    			c.appearanceUpdateRequired = true;
    		}
            c.sendQuest("", 15902);
            c.sendQuest("", 15903);
            c.sendQuest("", 15904);
            c.sendQuest("", 15905);
            c.sendQuest("", 15906);
            c.setInterfaceWalkable(15892);
    	}
    	
    	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;
    	}
    	
        public static int pcNPC[] = 
    	{
    		// Shifter NPC's add under here.
    		3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741,
    		//Torcher NPC's add under here
    		3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 
    		//Spinner NPC's add under here
    		3747, 3748, 3749, 3750, 3751,
    		//Ravager NPC's add under here
    		3742, 3743, 3744, 3745, 3746, 
    		//Defiler NPC's add under here
    		3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 
    		//Brawler NPC's add under here
    		3772, 3773, 3774, 3775, 3776 
    	};
    
        public static int createPCNPC() 
    	{
            return pcNPC[(int) (Math.random() * pcNPC.length)];
        }	
    }
    You can load many things through one class no problem, will be easier for future edits. I did not edit the code, I just adjusted it into one class, and it should possibly work. *That code I placed above is not my work, it's yours.

    EDIT: You should add the other methods into the other class, so it works. But this is a substitution instead of throwing everything in the Client class.
    :-)
    Reply With Quote  
     

  6. #6  
    Registered Member
    minutes's Avatar
    Join Date
    Apr 2008
    Posts
    1,926
    Thanks given
    2
    Thanks received
    19
    Rep Power
    465
    nice try lool 99% leached any another source ..... and i think if you make it whit you self you make on handler it lol...

    i think you leach all those thing on rich V4 or delta... sry... lol
    [Only registered and activated users can see links. ]
    click banner to join gtracer!
    Reply With Quote  
     

  7. #7  
    DeathTouch
    Guest
    Nice, Very nice Pest Control.
    Reply With Quote  
     

  8. #8  
    Registered Member
    Santaher0's Avatar
    Join Date
    Sep 2008
    Posts
    2,033
    Thanks given
    324
    Thanks received
    49
    Rep Power
    1282
    Hm, If I was you , I should change the tittle of this topic.
    You say its full Pc , but it isn't !
    - Support my project [Only registered and activated users can see links. ]

    - Santaher0's [Only registered and activated users can see links. ]

    - Santaher0's [Only registered and activated users can see links. ]
    Reply With Quote  
     

  9. #9  
    Registered Member

    Join Date
    Jun 2008
    Posts
    225
    Thanks given
    0
    Thanks received
    0
    Rep Power
    137
    Very nice I did something similar but i didn't make npcs spawn from the portals, would have been too much of a headache with mysql. Nice job
    Reply With Quote  
     

  10. #10  
    Registered Member
    Core's Avatar
    Join Date
    Sep 2007
    Posts
    4,194
    Thanks given
    11
    Thanks received
    393
    Rep Power
    1985
    Spinners don't heal the portals so it isn't 100%.
    Reply With Quote  
     

Page 1 of 6 123 ... LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •