Thread: Arrayindexoutofboundsexception: 3 error (crash)

Results 1 to 6 of 6
  1. #1 Arrayindexoutofboundsexception: 3 error (crash) 
    Registered Member
    Join Date
    Mar 2013
    Posts
    72
    Thanks given
    2
    Thanks received
    1
    Rep Power
    11
    Hey guys can anyone help me with this error




    Here is the NPCHandler.java
    Code:
    	public void dropItems(int i) {
    		int npc = 0;
    		Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
    		if(c != null) {
    			for(int o = 0; o < c.barrowsNpcs.length; o++){
    				if(npcs[i].npcType == c.barrowsNpcs[o][0]) {
    					c.barrowsNpcs[o][1] = 2; // 2 for dead
    					//c.barrowsKillCount++;
    				}
    			}
    			if (npcs[i].npcType == 912 || npcs[i].npcType == 913 || npcs[i].npcType == 914)
    				c.magePoints += 1;
    
    			for(npc = 0; npc < Config.NPC_DROPS.length; npc++){
    				if(npcs[i].npcType == Config.NPC_DROPS[npc][0]) {
    					if(Misc.random(Config.NPC_DROPS[npc][3]) == 0) {
    						if (c.clanId >= 0)
    						Server.clanChat.handleLootShare(c, Config.NPC_DROPS[npc][1], Config.NPC_DROPS[npc][2]);
    						Server.itemHandler.createGroundItem(c, Config.NPC_DROPS[npc][1], npcs[i].absX, npcs[i].absY, Config.NPC_DROPS[npc][2], c.playerId);
    					}
    				}
    			}
    		}
    	}
    Process();
    Code:
    		public void process() {
    		for (int i = 0; i < maxNPCs; i++) {
    			if (npcs[i] == null) continue;
    			npcs[i].clearUpdateFlags();
    			
    		}
    /*         if (npcs[i].npcType == 812){
    				if (Misc.random(10) == 4)
    				npcs[i].forceChat(guardRandomTalk[Misc.random3(guardRandomTalk.length)]);
    			}  */ 
    		for (int i = 0; i < maxNPCs; i++) {
    			if (npcs[i] != null) {
    				if (npcs[i].actionTimer > 0) {
    					npcs[i].actionTimer--;
    				}
    				
    				if (npcs[i].freezeTimer > 0) {
    					npcs[i].freezeTimer--;
    				}
    				
    				if (npcs[i].hitDelayTimer > 0) {
    					npcs[i].hitDelayTimer--;
    				}
    				
    				if (npcs[i].hitDelayTimer == 1) {
    					npcs[i].hitDelayTimer = 0;
    					applyDamage(i);
    				}
    				
    				if(npcs[i].attackTimer > 0) {
    					npcs[i].attackTimer--;
    				}
    					
    				if(npcs[i].spawnedBy > 0) { // delete summons npc
    					if(Server.playerHandler.players[npcs[i].spawnedBy] == null
    					|| Server.playerHandler.players[npcs[i].spawnedBy].heightLevel != npcs[i].heightLevel	
    					|| Server.playerHandler.players[npcs[i].spawnedBy].respawnTimer > 0 
    					|| !Server.playerHandler.players[npcs[i].spawnedBy].goodDistance(npcs[i].getX(), npcs[i].getY(), Server.playerHandler.players[npcs[i].spawnedBy].getX(), Server.playerHandler.players[npcs[i].spawnedBy].getY(), 20)) {
    							
    						if(Server.playerHandler.players[npcs[i].spawnedBy] != null) {
    							for(int o = 0; o < Server.playerHandler.players[npcs[i].spawnedBy].barrowsNpcs.length; o++){
    								if(npcs[i].npcType == Server.playerHandler.players[npcs[i].spawnedBy].barrowsNpcs[o][0]) {
    									if (Server.playerHandler.players[npcs[i].spawnedBy].barrowsNpcs[o][1] == 1)
    										Server.playerHandler.players[npcs[i].spawnedBy].barrowsNpcs[o][1] = 0;
    								}
    							}
    						}
    						npcs[i] = null;
    					}
    				}
    				if (npcs[i] == null) continue;

    and i dont think its this--
    Code:
    public class NPCHandler {
    	public static int maxNPCs = 99999;
    	public static int maxListedNPCs = 99999;
    	public static int maxNPCDrops = 99999;
    	public static NPC npcs[] = new NPC[maxNPCs];
    	public static NPCList NpcList[] = new NPCList[maxListedNPCs];
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Aug 2007
    Posts
    1,289
    Thanks given
    130
    Thanks received
    340
    Rep Power
    862
    Which line is 1382 and 228
    Reply With Quote  
     

  3. #3  
    Registered Member Keepin_Green's Avatar
    Join Date
    Oct 2012
    Posts
    225
    Thanks given
    12
    Thanks received
    19
    Rep Power
    13
    What effects does this have on your server? Has it been like that from the beginning?

    If the server crashes, from what I can tell, one of the NPC's you've added is crashing the server when killed. Find which NPC it is, and then let me know.
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Dec 2012
    Age
    26
    Posts
    66
    Thanks given
    9
    Thanks received
    43
    Rep Power
    64
    One array is out of bounds. Try to increase the array size and it should be fixed. It's common knowledge, and explaining any further would make you lazy, even tough it's hinted out too much in the beginning already.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Mar 2013
    Posts
    72
    Thanks given
    2
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by 123sk8 View Post
    Which line is 1382 and 228
    1228 =
    Spoiler for Code:
    Code:
    				if (npcs[i].isDead == true) {
    					if (npcs[i].actionTimer == 0 && npcs[i].applyDead == false && npcs[i].needRespawn == false) {
    						npcs[i].updateRequired = true;
    						npcs[i].facePlayer(0);
    						npcs[i].killedBy = getNpcKillerId(i);
    						npcs[i].animNumber = getDeadEmote(i); // dead emote
    						npcs[i].animUpdateRequired = true;
    						npcs[i].freezeTimer = 0;
    						npcs[i].applyDead = true;
    						killedBarrow(i);
    						npcs[i].actionTimer = 4; // delete time
    						resetPlayersInCombat(i);
    						npcs[i].dagColor = "";
    						getDtLastKill(i);
    					} else if (npcs[i].actionTimer == 0 && npcs[i].applyDead == true &&  npcs[i].needRespawn == false) {						
    						npcs[i].needRespawn = true;
    						npcs[i].actionTimer = getRespawnTime(i); // respawn time
    1228----------------------------------------dropItems(i); // npc drops items!-----------------------------------------------------------------
    						appendSlayerExperience(i);
    						appendKillCount(i);
    						//appendJailKc(i);
    						npcs[i].absX = npcs[i].makeX;
    						npcs[i].absY = npcs[i].makeY;				
    						npcs[i].HP = npcs[i].MaxHP;
    						npcs[i].animNumber = 0x328;
    						npcs[i].updateRequired = true;
    						npcs[i].animUpdateRequired = true;
    						if (npcs[i].npcType >= 2440 && npcs[i].npcType <= 2446) {
    							Server.objectManager.removeObject(npcs[i].absX, npcs[i].absY);
    						}
    						if (npcs[i].npcType == 2745) {
    							handleJadDeath(i);
    						}



    1382 =
    Spoiler for Code:
    Code:
    			for(npc = 0; npc < Config.NPC_DROPS.length; npc++){
    				if(npcs[i].npcType == Config.NPC_DROPS[npc][0]) {
    1382---------------------------------------if(Misc.random(Config.NPC_DROPS[npc][3]) == 0) {----------------------------------------------------
    						if (c.clanId >= 0)
    						Server.clanChat.handleLootShare(c, Config.NPC_DROPS[npc][1], Config.NPC_DROPS[npc][2]);
    						Server.itemHandler.createGroundItem(c, Config.NPC_DROPS[npc][1], npcs[i].absX, npcs[i].absY, Config.NPC_DROPS[npc][2], c.playerId);
    					}
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Mar 2013
    Posts
    72
    Thanks given
    2
    Thanks received
    1
    Rep Power
    11
    can anyone help me?
    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. [525]error crashing - stablity[525]
    By Sam A.A in forum Help
    Replies: 12
    Last Post: 07-12-2011, 04:53 AM
  2. error crash
    By kopjekoffiee in forum Help
    Replies: 0
    Last Post: 02-06-2011, 08:07 PM
  3. Run Errors - Crashes the server:
    By Mergim in forum Help
    Replies: 7
    Last Post: 06-03-2010, 05:51 PM
  4. Error crashing server
    By X tee in forum Help
    Replies: 4
    Last Post: 10-03-2009, 06:21 AM
  5. Replies: 5
    Last Post: 04-24-2009, 01:58 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
  •