Thread: [FightCaves] Player has to relog after wave 12 to start wave 12 again then 13?

Results 1 to 3 of 3
  1. #1 [FightCaves] Player has to relog to start wave 12 & disc. after 14? 
    Registered Member Dev_RyanJ's Avatar
    Join Date
    Sep 2013
    Age
    30
    Posts
    210
    Thanks given
    46
    Thanks received
    34
    Rep Power
    1
    Note: My waves start at 0. <Might not be relevant but thought I should add.

    When doing fight caves the player has to log out at the beginning or after wave 12 & on login wave 12 starts & the npc's spawn... I've read through the class & couldn't find anything. Anyone help me figure out where it's going wrong?

    FightCaves Class:

    Code:
    package rezzion.model.minigames;
    
    import rezzion.Rezzion;
    import rezzion.model.npcs.NpcHandler;
    import rezzion.model.players.Client;
    
    /**
     * @author Sanity
     */
    
    public class FightCaves {
    	private static FightCaves fightCaves = new FightCaves();
    
    	public static FightCaves getFightCaves() {
    		return fightCaves;
    	}
    
    	public int[][] WAVES = {
    			{2627},
    			{2627}, 
    			{2627, 2627}, 
    			{2630}, 
    			{2630, 2627}, 
    			{2630, 2627, 2627}, 
    			{2630, 2630, }, 
    			{2631}, 
    			{2631, 2627}, 
    			{2631, 2627, 2627}, 
    			{2631, 2630}, 
    			{2631, 2630, 2627}, 
    			{2631, 2630, 2627, 2627}, 
    			{2631, 2630, 2630}, 
    			{2631, 2631}, 
    			{2741}, 
    			{2741, 2627}, 
    			{2741, 2627, 2627}, 
    			{2741, 2630}, 
    			{2741, 2630, 2627}, 
    			{2741, 2630, 2627, 2627}, 
    			{2741, 2630, 2630}, 
    			{2741, 2631}, 
    			{2741, 2631, 2627}, 
    			{2741, 2631, 2627, 2627}, 
    			{2741, 2631, 2630}, 
    			{2741, 2631, 2630, 2627}, 
    			{2741, 2631, 2630, 2627, 2627}, 
    			{2741, 2631, 2630, 2630}, 
    			{2741, 2631, 2631}, 
    			{2741, 2741}, 
    			{2743}, 
    			{2743, 2627}, 
    			{2743, 2627, 2627}, 
    			{2743, 2630}, 
    			{2743, 2630, 2627}, 
    			{2743, 2630, 2627, 2627}, 
    			{2743, 2630, 2630}, 
    			{2743, 2631}, 
    			{2743, 2631, 2627}, 
    			{2743, 2631, 2627, 2627}, 
    			{2743, 2631, 2630}, 
    			{2743, 2631, 2630, 2627}, 
    			{2743, 2631, 2630, 2627, 2627}, 
    			{2743, 2631, 2630, 2630}, 
    			{2743, 2631, 2631}, 
    			{2743, 2741}, 
    			{2743, 2741, 2627}, 
    			{2743, 2741, 2627, 2627}, 
    			{2743, 2741, 2630}, 
    			{2743, 2741, 2630, 2627}, 
    			{2743, 2741, 2630, 2627, 2627}, 
    			{2743, 2741, 2630, 2630}, 
    			{2743, 2741, 2631}, 
    			{2743, 2741, 2631, 2627}, 
    			{2743, 2741, 2631, 2627, 2627}, 
    			{2743, 2741, 2631, 2630}, 
    			{2743, 2741, 2631, 2630, 2627}, 
    			{2743, 2741, 2631, 2630, 2627, 2627}, 
    			{2743, 2741, 2631, 2630, 2630}, 
    			{2743, 2741, 2631, 2631}, 
    			{2743, 2741, 2741}, 
    			{2743, 2744},
    			{2745},
    		};
    
    	private int[][] coordinates = { { 2398, 5086 }, { 2387, 5095 }, { 2407, 5098 }, { 2417, 5082 }, { 2390, 5076 }, { 2410, 5090 } };
    
    	public void spawnNextWave(Client c) {
    		if (c != null) {
    
    			if (c.waveId >= WAVES.length) {
    				c.waveId = 0;
    				return;
    			}
    			if (c.waveId < 0) {
    				return;
    			}
    
    			int npcAmount = WAVES[c.waveId].length;
    			
    			c.sendMessage("Wave "+c.waveId+" has just started.");
    
    			for (int j = 0; j < npcAmount; j++) {
    				int npc = WAVES[c.waveId][j];
    				int X = coordinates[j][0];
    				int Y = coordinates[j][1];
    				int H = c.heightLevel;
    				int hp = getHp(npc);
    				int max = getMax(npc);
    				int atk = getAtk(npc);
    				int def = getDef(npc);
    				NpcHandler.getNpcHandler().spawnNpc(c, npc, X, Y, H, 0, hp, max, atk, def, true, false);
    			}
    
    			c.tzhaarToKill = npcAmount;
    			c.tzhaarKilled = 0;
    		}
    	}
    
    	public int getHp(int npc) {
    		switch (npc) {
    		case 2627:
    			return 10;
    		case 2630:
    			return 20;
    		case 2631:
    			return 40;
    		case 2741:
    			return 80;
    		case 2743:
    			return 150;
    		case 2745:
    			return 250;
    		}
    		return 100;
    	}
    
    	public int getMax(int npc) {
    		switch (npc) {
    		case 2627:
    			return 4;
    		case 2630:
    			return 7;
    		case 2631:
    			return 13;
    		case 2741:
    			return 28;
    		case 2743:
    			return 54;
    		case 2745:
    			return 500;
    		}
    		return 5;
    	}
    
    	public int getAtk(int npc) {
    		switch (npc) {
    		case 2627:
    			return 30;
    		case 2630:
    			return 50;
    		case 2631:
    			return 100;
    		case 2741:
    			return 150;
    		case 2743:
    			return 450;
    		case 2745:
    			return 1500;
    		}
    		return 100;
    	}
    
    	public int getDef(int npc) {
    		switch (npc) {
    		case 2627:
    			return 30;
    		case 2630:
    			return 50;
    		case 2631:
    			return 100;
    		case 2741:
    			return 150;
    		case 2743:
    			return 300;
    		case 2745:
    			return 500;
    		}
    		return 100;
    	}
    
    }
    And after wave 14 I get this error in my client's cmd:

    Code:
    java.lang.ArrayIndexOutOfBoundsException: 65407
            at rezzion.ItemDef.forID(ItemDef.java:192)
            at rezzion.Client.spawnGroundItem(Client.java:1109)
            at rezzion.Client.method137(Client.java:11433)
            at rezzion.Client.parsePacket(Client.java:13495)
            at rezzion.Client.mainGameProcessor(Client.java:3362)
            at rezzion.Client.processGameLoop(Client.java:2603)
            at rezzion.RSApplet.run(RSApplet.java:118)
            at rezzion.Client.run(Client.java:5281)
            at java.lang.Thread.run(Unknown Source)
    Error: T2 - 215,65,81 - 7,2402,5085 - -1,-1,84,0,2,0,0,
    Reply With Quote  
     

  2. #2  
    Registered Member
    Mylyn's Avatar
    Join Date
    Dec 2012
    Posts
    1,536
    Thanks given
    602
    Thanks received
    278
    Rep Power
    119
    Well the client error seems pretty irrelevant.. but npcs that are spawned for a certain player are removed from the game if they are over 20 or 30 (not sure)steps away from the player. It often removes fight cave npcs too since they are spawned all around the cave. Look around in npchandler process method and you should find the fix.
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member Dev_RyanJ's Avatar
    Join Date
    Sep 2013
    Age
    30
    Posts
    210
    Thanks given
    46
    Thanks received
    34
    Rep Power
    1
    [nvm. I found what you were talking about.]
    Reply With Quote  
     


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. Replies: 9
    Last Post: 04-11-2013, 10:45 PM
  2. how to know if player has all 99s? [rep++]
    By shlomi84 in forum Help
    Replies: 12
    Last Post: 07-07-2012, 04:27 AM
  3. Replies: 11
    Last Post: 02-20-2012, 10:29 AM
  4. [PI] Boolean To Check If Player Has Nothing
    By Moronic in forum Snippets
    Replies: 24
    Last Post: 04-13-2011, 05:51 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •