Thread: [PI] Pest Control Portals Bug

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 [PI] Pest Control Portals Bug 
    Banned

    Join Date
    May 2011
    Posts
    1,238
    Thanks given
    193
    Thanks received
    267
    Rep Power
    0
    What happens is when you kill the portals they respawn, I've tried changing the respawn timer but that didn't work. Here's my PestControl.java:


    Code:
    package server.model.minigames;
    
    import server.model.players.Client;
    import server.Server;
    
    /**
     * @author Sanity
     */
    
    public class PestControl {
    	
    	public PestControl() {
    		
    	}
    	
    	public final int GAME_TIMER = 70; //5 minutes
    	public final int WAIT_TIMER = 7;
    	
    	public int gameTimer = -1;
    	public int waitTimer = 15;
    	public int properTimer = 0;
    	
    	public void process() {
    		setInterface();
    		if (properTimer > 0) {
    			properTimer--;
    			return;
    		} else {
    			properTimer = 4;
    		}
    		if (waitTimer > 0)
    			waitTimer--;
    		else if (waitTimer == 0)
    			startGame();
    		if (gameTimer > 0) {
    			gameTimer--;
    			if (allPortalsDead()) {
    				endGame(true);
    			}
    		} else if (gameTimer == 0)
    			endGame(false);
    	}
    	
    	public void startGame() {
    		if (playersInBoat() > 2) {
    			gameTimer = GAME_TIMER;
    			waitTimer = -1;
    			//spawn npcs
    			spawnNpcs();	
    			//move players into game
    			for (int j = 0; j < Server.playerHandler.players.length; j++) {
    				if (Server.playerHandler.players[j] != null) {
    					if (Server.playerHandler.players[j].inPcBoat()) {
    						movePlayer(j);
    					}			
    				}		
    			}
    		} else {
    			waitTimer = WAIT_TIMER;
    			for (int j = 0; j < Server.playerHandler.players.length; j++) {
    				if (Server.playerHandler.players[j] != null) {
    					if (Server.playerHandler.players[j].inPcBoat()) {
    						Client c = (Client)Server.playerHandler.players[j];
    						c.sendMessage("There need to be at least 3 players to start a game of pest control.");
    					}			
    				}		
    			}
    		}
    	}
    
    	public void setInterface() {
    		for (int j = 0; j < Server.playerHandler.players.length; j++) {
    			if (Server.playerHandler.players[j] != null) {
    				if (Server.playerHandler.players[j].inPcBoat()) {
    					Client c = (Client) Server.playerHandler.players[j];
    					c.getPA().sendFrame126("Next Departure: "+waitTimer+"", 21006);
    					c.getPA().sendFrame126("Players Ready: "+playersInBoat()+"", 21007);
    					c.getPA().sendFrame126("(Need 3 to 25 players)", 21008);
    					c.getPA().sendFrame126("EPP: "+c.pkPoints+"", 21009);
    				}
     				if (Server.playerHandler.players[j].inPcGame()) {
    					Client c = (Client) Server.playerHandler.players[j];
    					for (j = 0; j < Server.npcHandler.npcs.length; j++) {
    						if (Server.npcHandler.npcs[j] != null) {
    							if (Server.npcHandler.npcs[j].npcType == 6142)
    								c.getPA().sendFrame126("" + Server.npcHandler.npcs[j].HP + "", 21111);
    							if (Server.npcHandler.npcs[j].npcType == 6143)
    								c.getPA().sendFrame126("" + Server.npcHandler.npcs[j].HP + "", 21112);
    							if (Server.npcHandler.npcs[j].npcType == 6144)
    								c.getPA().sendFrame126("" + Server.npcHandler.npcs[j].HP + "", 21113);
    							if (Server.npcHandler.npcs[j].npcType == 6145)
    								c.getPA().sendFrame126("" + Server.npcHandler.npcs[j].HP + "", 21114);
    						}
    					}
    					c.getPA().sendFrame126("0", 21115);
    						if (c.pcDamage < 10) {
    c.getPA().sendFrame126("@red@"+c.pcDamage+".", 21116);
    	} else {
    c.getPA().sendFrame126("@gre@"+c.pcDamage+".", 21116);
    }
    					c.getPA().sendFrame126("Time remaining: "+gameTimer+"", 21117);
    				}
    			}
    		}
    	}
    	
    	public int playersInBoat() {
    		int count = 0;
    		for (int j = 0; j < Server.playerHandler.players.length; j++) {
    			if (Server.playerHandler.players[j] != null) {
    				if (Server.playerHandler.players[j].inPcBoat()) {
    						count++;
    				}
    			}
    		}
    		return count;
    	}
    	
    	public void endGame(boolean won) {
    		gameTimer = -1;
    		waitTimer = WAIT_TIMER;
    		for (int j = 0; j < Server.playerHandler.players.length; j++) {
    			if (Server.playerHandler.players[j] != null) {
    				if (Server.playerHandler.players[j].inPcGame()) {
    					Client c = (Client)Server.playerHandler.players[j];
    					c.getPA().movePlayer(2657, 2639, 0);
    					if (won && c.pcDamage > 10) {
    						c.sendMessage("You have won the pest control game and have been awarded 4 pest control points.");
    						c.pkPoints += 4;
    						c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
    						c.playerLevel[5] = c.getLevelForXP(c.playerXP[5]);
    						c.specAmount = 10;
    						c.getItems().addItem(995, c.combatLevel * 50);
    						c.getPA().refreshSkill(3);
    						c.getPA().refreshSkill(5);
    					} else if (won) {
    						c.sendMessage("The void knights notice your lack of zeal.");
    					} else {
    						c.sendMessage("You failed to kill all the portals in 5 minutes and have not been awarded any points.");
    					}
    					c.pcDamage = 0;
    					c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
    					c.getCombat().resetPrayers();
    				}			
    			}		
    		}
    
    		for (int j = 0; j < Server.npcHandler.npcs.length; j++) {
    			if (Server.npcHandler.npcs[j] != null) {
    				if (Server.npcHandler.npcs[j].npcType >= 6142 && Server.npcHandler.npcs[j].npcType <= 6145)
    					Server.npcHandler.npcs[j] = null;
    			}			
    		}
    	}
    	
    	public boolean allPortalsDead() {
    		int count = 0;
    		for (int j = 0; j < Server.npcHandler.npcs.length; j++) {
    			if (Server.npcHandler.npcs[j] != null) {
    				if (Server.npcHandler.npcs[j].npcType >= 6142 && Server.npcHandler.npcs[j].npcType <= 6145)
    					if (Server.npcHandler.npcs[j].needRespawn)
    						count++;		
    			}			
    		}
    		return count >= 4;	
    	}
    	
    	public void movePlayer(int index) {
    		Client c = (Client)Server.playerHandler.players[index];
    		if (c.combatLevel < 40) {
    			c.sendMessage("You must be at least combat level 40 to enter this boat.");
    			return;
    		}
    		c.getPA().movePlayer(2658,2611,0);
    	}
    	
    	public void spawnNpcs() {
    		Server.npcHandler.spawnNpc2(6142,2628,2591,0,0,200,0,0,100);
    		Server.npcHandler.spawnNpc2(6143,2680,2588,0,0,200,0,0,100);
    		Server.npcHandler.spawnNpc2(6144,2669,2570,0,0,200,0,0,100);
    		Server.npcHandler.spawnNpc2(6145,2645,2569,0,0,200,0,0,100);
    	}
    
    
    }
    Any ideas? Thanks.
    Reply With Quote  
     

  2. #2  
    Registered Member
    gomomo11's Avatar
    Join Date
    May 2010
    Posts
    2,379
    Thanks given
    268
    Thanks received
    196
    Rep Power
    177
    I see you have changed the portals ID, is that done on purpose?
    Attached image
    no external links without affiliate
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    May 2011
    Posts
    1,238
    Thanks given
    193
    Thanks received
    267
    Rep Power
    0
    Yes gomomo11 it's the ID's for the base I'm using (ErasedPkz)
    Reply With Quote  
     

  4. #4  
    Registered Member Nutella's Avatar
    Join Date
    May 2011
    Posts
    181
    Thanks given
    16
    Thanks received
    5
    Rep Power
    1
    Quote Originally Posted by gomomo11 View Post
    I see you have changed the portals ID, is that done on purpose?
    These are the same ids from my old source, and pest control used to work fine. But now the portals spawn back..and I already changed the spawn rate to like 50000 o_O
    Reply With Quote  
     

  5. #5  
    Registered Member
    gomomo11's Avatar
    Join Date
    May 2010
    Posts
    2,379
    Thanks given
    268
    Thanks received
    196
    Rep Power
    177
    Have you changed anything in spawn-config.cfg?
    Attached image
    no external links without affiliate
    Reply With Quote  
     

  6. #6  
    Registered Member Nutella's Avatar
    Join Date
    May 2011
    Posts
    181
    Thanks given
    16
    Thanks received
    5
    Rep Power
    1
    Nope they aren't even in there.
    Reply With Quote  
     

  7. #7  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    Reply With Quote  
     

  8. #8  
    Donator

    Kickyamom's Avatar
    Join Date
    Jul 2010
    Posts
    1,606
    Thanks given
    208
    Thanks received
    157
    Rep Power
    835
    I have the same issue. Was perfect Pest Control until I added 602 npcs. Then it got fucked up like this!


    Spoiler for Respect for the Truest:

    #TWTMP GANG 4 LYFE
    Reply With Quote  
     

  9. #9  
    Registered Member Nutella's Avatar
    Join Date
    May 2011
    Posts
    181
    Thanks given
    16
    Thanks received
    5
    Rep Power
    1
    Bump
    Reply With Quote  
     

  10. #10  
    Banned Right man's Avatar
    Join Date
    Jun 2011
    Posts
    476
    Thanks given
    26
    Thanks received
    5
    Rep Power
    0
    i'm going to follow that link. however i have the same issue. my portals keep re-spawning no matter what rate i change at.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. Fully Working Pest Control with Portals
    By Jellybean732 in forum Tutorials
    Replies: 59
    Last Post: 04-11-2012, 04:23 PM
  2. [PI] Pest Control-Fixing Portals 200 HP
    By NathanCoder in forum Snippets
    Replies: 17
    Last Post: 08-10-2011, 02:52 AM
  3. PI Pest Control Help
    By nMik in forum Help
    Replies: 2
    Last Post: 12-22-2010, 08:11 PM
  4. Pest control
    By bracket in forum Requests
    Replies: 6
    Last Post: 03-01-2010, 08:28 PM
  5. pest control
    By mike623030 in forum Help
    Replies: 1
    Last Post: 06-11-2009, 09:25 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •