Thread: Simple Java Q

Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1 Simple Java Q 
    Registered Member
    Join Date
    Mar 2010
    Posts
    1,011
    Thanks given
    2
    Thanks received
    4
    Rep Power
    11
    I am looking at this error...

    and I am confused... I can't use int variables?
    Looking to join a team of developers* to work on a RSPS.
    Will put in time and effort for the project.

    * Developers must have basic understanding of Java. I would love to work and learn from experts, but it's rare that they would want to work with someone that isn't on the same level as them.
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Aug 2011
    Posts
    2,760
    Thanks given
    297
    Thanks received
    534
    Rep Power
    1596
    You possibly added it in the wrong place, try adding it right under

    Code:
    public class ***** {
    Quote Originally Posted by Aj View Post
    This is not even a tutorial. It's fail for rep. It's fail for life.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jun 2011
    Posts
    220
    Thanks given
    3
    Thanks received
    13
    Rep Power
    2
    Show more code
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Mar 2010
    Posts
    1,011
    Thanks given
    2
    Thanks received
    4
    Rep Power
    11
    Quote Originally Posted by 'Spike View Post
    You possibly added it in the wrong place, try adding it right under

    Code:
    public class ***** {
    It was under the process function inside the NPCHandler class. All I did was make a function return an int and in the process function I made it store it into a variable. Seems right to me.

    Quote Originally Posted by Ch3ck it S0n View Post
    Show more code
    Here is the whole process method:
    Code:
    	public void process() {
    		for (int i = 0; i < maxNPCs; i++) {
    			if (npcs[i] == null) continue;
    			npcs[i].clearUpdateFlags();
    			
    		}
                    
    		for (int i = 0; i < maxNPCs; i++) {
    			if (npcs[i] != null) {
    				NPC n = npcs[i];
    					if (npcs[i].splashDelay > 0)
    						npcs[i].splashDelay--;
    					if (npcs[i].splashDelay == 4) {
    						corpSplash(n);
    						for (int p = 1; p < Server.playerHandler.players.length; p++) {
    							c2 = allPlayers(p);
    							if (c2 != null) {
    								if (c2.getX() == npcs[i].splashCoord[0][0] && c2.getY() == npcs[i].splashCoord[0][1])
    									int duckIsHere;
    									duckIsHere = c2.dealDamage(10); //c2.dealDamage(10); //Duck - Adjusted to make damage appear correctly. Read Player > dealDamage
    							}
    						}
    					} else if (npcs[i].splashDelay == 0) {
    						for (int p = 1; p < Server.playerHandler.players.length; p++) {
    							c2 = allPlayers(p);
    							for (int coords = 1; coords < npcs[i].splashCoord.length; coords++) {
    								if (c2 != null) {
    									if (c2.getX() == npcs[i].splashCoord[coords][0] && c2.getY() == npcs[i].splashCoord[coords][1])
    										int duckIsHere;
    										duckIsHere = c2.dealDamage(10); //c2.dealDamage(10); //Duck - Adjusted to make damage appear correctly. Read Player > dealDamage
    									c2.getPA().stillGfx(1808, npcs[i].splashCoord[coords][0], npcs[i].splashCoord[coords][1], 0, 0);
    								}
    							}
    						}
    						npcs[i].splashDelay = -1;
    					}
    	
    				if (npcs[i].summonedFor > 0 && !npcs[i].isDead)
    					summoningFollow(i, npcs[i].summonedFor);
    				
    				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) {
    					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;
    				
    				/**
    				* Attacking player
    				**/
    				if (isAggressive(i) && !npcs[i].underAttack && !npcs[i].isDead && !switchesAttackers(i)) {
    					npcs[i].killerId = getCloseRandomPlayer(i);
    				} else if (isAggressive(i) && !npcs[i].underAttack && !npcs[i].isDead && switchesAttackers(i)) {
    					npcs[i].killerId = getCloseRandomPlayer(i);
    				}
    				
    				if (System.currentTimeMillis() - npcs[i].lastDamageTaken > 5000)
    					npcs[i].underAttackBy = 0;
    				
    				if((npcs[i].killerId > 0 || npcs[i].underAttack) && !npcs[i].walkingHome && retaliates(npcs[i].npcType)) {
    					if(!npcs[i].isDead) {
    						int p = npcs[i].killerId;
    						if(Server.playerHandler.players[p] != null) {
    							Client c = (Client) Server.playerHandler.players[p];					
    							followPlayer(i, c.playerId);
    							if (npcs[i] == null) continue;
    							if(npcs[i].attackTimer == 0) {
    								if(c != null) {
    									attackPlayer(c, i);
    								} else {
    									npcs[i].killerId = 0;
    									npcs[i].underAttack = false;
    									npcs[i].facePlayer(0);
    								}
    							}
    						} else {
    							npcs[i].killerId = 0;
    							npcs[i].underAttack = false;
    							npcs[i].facePlayer(0);
    						}
    					}
    				}
    				
    				
    		
    				/**
    				* Random walking and walking home
    				**/
    				if (npcs[i] == null) continue;
    				if((!npcs[i].underAttack || npcs[i].walkingHome) && npcs[i].randomWalk && !npcs[i].isDead) {
    					npcs[i].facePlayer(0);
    					npcs[i].killerId = 0;	
    					if(npcs[i].spawnedBy == 0) {
    						if((npcs[i].absX > npcs[i].makeX + Config.NPC_RANDOM_WALK_DISTANCE) || (npcs[i].absX < npcs[i].makeX - Config.NPC_RANDOM_WALK_DISTANCE) || (npcs[i].absY > npcs[i].makeY + Config.NPC_RANDOM_WALK_DISTANCE) || (npcs[i].absY < npcs[i].makeY - Config.NPC_RANDOM_WALK_DISTANCE)) {
    							npcs[i].walkingHome = true;
    						}
    					}
    
    					if (npcs[i].walkingHome && npcs[i].absX == npcs[i].makeX && npcs[i].absY == npcs[i].makeY) {
    						npcs[i].walkingHome = false;
    					} else if(npcs[i].walkingHome) {
    						npcs[i].moveX = GetMove(npcs[i].absX, npcs[i].makeX);
    			      		npcs[i].moveY = GetMove(npcs[i].absY, npcs[i].makeY);
    						npcs[i].getNextNPCMovement(i); 
    						npcs[i].updateRequired = true;
    					}
    					if(npcs[i].walkingType == 1) {
    						if(Misc.random(3)== 1 && !npcs[i].walkingHome) {
    							int MoveX = 0;
    							int MoveY = 0;			
    							int Rnd = Misc.random(9);
    							if (Rnd == 1) {
    								MoveX = 1;
    								MoveY = 1;
    							} else if (Rnd == 2) {
    								MoveX = -1;
    							} else if (Rnd == 3) {
    								MoveY = -1;
    							} else if (Rnd == 4) {
    								MoveX = 1;
    							} else if (Rnd == 5) {
    								MoveY = 1;
    							} else if (Rnd == 6) {
    								MoveX = -1;
    								MoveY = -1;
    							} else if (Rnd == 7) {
    								MoveX = -1;
    								MoveY = 1;
    							} else if (Rnd == 8) {
    								MoveX = 1;
    								MoveY = -1;
    							}
    										
    							if (MoveX == 1) {
    								if (npcs[i].absX + MoveX < npcs[i].makeX + 1) {
    									npcs[i].moveX = MoveX;
    								} else {
    									npcs[i].moveX = 0;
    								}
    							}
    							
    							if (MoveX == -1) {
    								if (npcs[i].absX - MoveX > npcs[i].makeX - 1)  {
    									npcs[i].moveX = MoveX;
    								} else {
    									npcs[i].moveX = 0;
    								}
    							}
    							
    							if(MoveY == 1) {
    								if(npcs[i].absY + MoveY < npcs[i].makeY + 1) {
    									npcs[i].moveY = MoveY;
    								} else {
    									npcs[i].moveY = 0;
    								}
    							}
    							
    							if(MoveY == -1) {
    								if(npcs[i].absY - MoveY > npcs[i].makeY - 1)  {
    									npcs[i].moveY = MoveY;
    								} else {
    									npcs[i].moveY = 0;
    								}
    							}
    								
    
    							int x = (npcs[i].absX + npcs[i].moveX);
    							int y = (npcs[i].absY + npcs[i].moveY);
    							if (VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, x, y, 0))
    								npcs[i].getNextNPCMovement(i);
    							else
    							{
    								npcs[i].moveX = 0;
    								npcs[i].moveY = 0;
    							} 
    							npcs[i].updateRequired = true;
    						}
    					}
    				}
    		
    				
    				if (npcs[i].isDead) {
    					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 = getCombatEmote(i, "Death"); // dead emote
    						npcs[i].animUpdateRequired = true;
    						npcs[i].freezeTimer = 0;
    						npcs[i].applyDead = true;
    						npcs[i].splashDelay = -1;
    						killedBarrow(i);
    						if (isFightCaveNpc(i))
    							killedTzhaar(i);
    						if (isBarbNpc(i))
    							killedBarb(i);
    						npcs[i].actionTimer = 4; // delete time
    						resetPlayersInCombat(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
    						if (!npcs[i].inBarbDef())
    							dropItems(i);
    						appendSlayerExperience(i);
    						appendKillCount(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);
    						}
    					} else if (npcs[i].actionTimer == 0 && npcs[i].needRespawn == true) {					
    						if(npcs[i].spawnedBy > 0 || npcs[i].summonedFor > 0) {
    							npcs[i] = null;
    						} else {
    							int old1 = npcs[i].npcType;
    							int old2 = npcs[i].makeX;
    							int old3 = npcs[i].makeY;
    							int old4 = npcs[i].heightLevel;
    							int old5 = npcs[i].walkingType;
    							int old6 = npcs[i].MaxHP;
    							int old7 = npcs[i].maxHit/10;
    							int old8 = npcs[i].attack;	
    							int old9 = npcs[i].defence;
    							
    							npcs[i] = null;
    							newNPC(old1, old2, old3, old4, old5, old6, old7, old8, old9);
    						}
    					}
    				}
    			}
    		}
    	}
    Looking to join a team of developers* to work on a RSPS.
    Will put in time and effort for the project.

    * Developers must have basic understanding of Java. I would love to work and learn from experts, but it's rare that they would want to work with someone that isn't on the same level as them.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jul 2012
    Posts
    900
    Thanks given
    66
    Thanks received
    85
    Rep Power
    0
    you are using an if-statement for the variable only since you didnt put any brasket....
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Mar 2010
    Posts
    1,011
    Thanks given
    2
    Thanks received
    4
    Rep Power
    11
    Quote Originally Posted by Raverz View Post
    you are using an if-statement for the variable only since you didnt put any brasket....
    Oops... that is my fault. I had it in one line before and I still got the same error.
    Looking to join a team of developers* to work on a RSPS.
    Will put in time and effort for the project.

    * Developers must have basic understanding of Java. I would love to work and learn from experts, but it's rare that they would want to work with someone that isn't on the same level as them.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Jul 2012
    Posts
    900
    Thanks given
    66
    Thanks received
    85
    Rep Power
    0
    try this
    Code:
    public void process() {
    		for (int i = 0; i < maxNPCs; i++) {
    			if (npcs[i] == null) continue;
    			npcs[i].clearUpdateFlags();
    			
    		}
                    int duckIsHere = 0;
    		for (int i = 0; i < maxNPCs; i++) {
    			if (npcs[i] != null) {
    				NPC n = npcs[i];
    					if (npcs[i].splashDelay > 0)
    						npcs[i].splashDelay--;
    					if (npcs[i].splashDelay == 4) {
    						corpSplash(n);
    						for (int p = 1; p < Server.playerHandler.players.length; p++) {
    							c2 = allPlayers(p);
    							if (c2 != null) {
    								if (c2.getX() == npcs[i].splashCoord[0][0] && c2.getY() == npcs[i].splashCoord[0][1])
    									
    									duckIsHere = c2.dealDamage(10); //c2.dealDamage(10); //Duck - Adjusted to make damage appear correctly. Read Player > dealDamage
    							}
    						}
    					} else if (npcs[i].splashDelay == 0) {
    						for (int p = 1; p < Server.playerHandler.players.length; p++) {
    							c2 = allPlayers(p);
    							for (int coords = 1; coords < npcs[i].splashCoord.length; coords++) {
    								if (c2 != null) {
    									if (c2.getX() == npcs[i].splashCoord[coords][0] && c2.getY() == npcs[i].splashCoord[coords][1])
    									//	int duckIsHere;
    										duckIsHere = c2.dealDamage(10); //c2.dealDamage(10); //Duck - Adjusted to make damage appear correctly. Read Player > dealDamage
    									c2.getPA().stillGfx(1808, npcs[i].splashCoord[coords][0], npcs[i].splashCoord[coords][1], 0, 0);
    								}
    							}
    						}
    						npcs[i].splashDelay = -1;
    					}
    	
    				if (npcs[i].summonedFor > 0 && !npcs[i].isDead)
    					summoningFollow(i, npcs[i].summonedFor);
    				
    				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) {
    					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;
    				
    				/**
    				* Attacking player
    				**/
    				if (isAggressive(i) && !npcs[i].underAttack && !npcs[i].isDead && !switchesAttackers(i)) {
    					npcs[i].killerId = getCloseRandomPlayer(i);
    				} else if (isAggressive(i) && !npcs[i].underAttack && !npcs[i].isDead && switchesAttackers(i)) {
    					npcs[i].killerId = getCloseRandomPlayer(i);
    				}
    				
    				if (System.currentTimeMillis() - npcs[i].lastDamageTaken > 5000)
    					npcs[i].underAttackBy = 0;
    				
    				if((npcs[i].killerId > 0 || npcs[i].underAttack) && !npcs[i].walkingHome && retaliates(npcs[i].npcType)) {
    					if(!npcs[i].isDead) {
    						int p = npcs[i].killerId;
    						if(Server.playerHandler.players[p] != null) {
    							Client c = (Client) Server.playerHandler.players[p];					
    							followPlayer(i, c.playerId);
    							if (npcs[i] == null) continue;
    							if(npcs[i].attackTimer == 0) {
    								if(c != null) {
    									attackPlayer(c, i);
    								} else {
    									npcs[i].killerId = 0;
    									npcs[i].underAttack = false;
    									npcs[i].facePlayer(0);
    								}
    							}
    						} else {
    							npcs[i].killerId = 0;
    							npcs[i].underAttack = false;
    							npcs[i].facePlayer(0);
    						}
    					}
    				}
    				
    				
    		
    				/**
    				* Random walking and walking home
    				**/
    				if (npcs[i] == null) continue;
    				if((!npcs[i].underAttack || npcs[i].walkingHome) && npcs[i].randomWalk && !npcs[i].isDead) {
    					npcs[i].facePlayer(0);
    					npcs[i].killerId = 0;	
    					if(npcs[i].spawnedBy == 0) {
    						if((npcs[i].absX > npcs[i].makeX + Config.NPC_RANDOM_WALK_DISTANCE) || (npcs[i].absX < npcs[i].makeX - Config.NPC_RANDOM_WALK_DISTANCE) || (npcs[i].absY > npcs[i].makeY + Config.NPC_RANDOM_WALK_DISTANCE) || (npcs[i].absY < npcs[i].makeY - Config.NPC_RANDOM_WALK_DISTANCE)) {
    							npcs[i].walkingHome = true;
    						}
    					}
    
    					if (npcs[i].walkingHome && npcs[i].absX == npcs[i].makeX && npcs[i].absY == npcs[i].makeY) {
    						npcs[i].walkingHome = false;
    					} else if(npcs[i].walkingHome) {
    						npcs[i].moveX = GetMove(npcs[i].absX, npcs[i].makeX);
    			      		npcs[i].moveY = GetMove(npcs[i].absY, npcs[i].makeY);
    						npcs[i].getNextNPCMovement(i); 
    						npcs[i].updateRequired = true;
    					}
    					if(npcs[i].walkingType == 1) {
    						if(Misc.random(3)== 1 && !npcs[i].walkingHome) {
    							int MoveX = 0;
    							int MoveY = 0;			
    							int Rnd = Misc.random(9);
    							if (Rnd == 1) {
    								MoveX = 1;
    								MoveY = 1;
    							} else if (Rnd == 2) {
    								MoveX = -1;
    							} else if (Rnd == 3) {
    								MoveY = -1;
    							} else if (Rnd == 4) {
    								MoveX = 1;
    							} else if (Rnd == 5) {
    								MoveY = 1;
    							} else if (Rnd == 6) {
    								MoveX = -1;
    								MoveY = -1;
    							} else if (Rnd == 7) {
    								MoveX = -1;
    								MoveY = 1;
    							} else if (Rnd == 8) {
    								MoveX = 1;
    								MoveY = -1;
    							}
    										
    							if (MoveX == 1) {
    								if (npcs[i].absX + MoveX < npcs[i].makeX + 1) {
    									npcs[i].moveX = MoveX;
    								} else {
    									npcs[i].moveX = 0;
    								}
    							}
    							
    							if (MoveX == -1) {
    								if (npcs[i].absX - MoveX > npcs[i].makeX - 1)  {
    									npcs[i].moveX = MoveX;
    								} else {
    									npcs[i].moveX = 0;
    								}
    							}
    							
    							if(MoveY == 1) {
    								if(npcs[i].absY + MoveY < npcs[i].makeY + 1) {
    									npcs[i].moveY = MoveY;
    								} else {
    									npcs[i].moveY = 0;
    								}
    							}
    							
    							if(MoveY == -1) {
    								if(npcs[i].absY - MoveY > npcs[i].makeY - 1)  {
    									npcs[i].moveY = MoveY;
    								} else {
    									npcs[i].moveY = 0;
    								}
    							}
    								
    
    							int x = (npcs[i].absX + npcs[i].moveX);
    							int y = (npcs[i].absY + npcs[i].moveY);
    							if (VirtualWorld.I(npcs[i].heightLevel, npcs[i].absX, npcs[i].absY, x, y, 0))
    								npcs[i].getNextNPCMovement(i);
    							else
    							{
    								npcs[i].moveX = 0;
    								npcs[i].moveY = 0;
    							} 
    							npcs[i].updateRequired = true;
    						}
    					}
    				}
    		
    				
    				if (npcs[i].isDead) {
    					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 = getCombatEmote(i, "Death"); // dead emote
    						npcs[i].animUpdateRequired = true;
    						npcs[i].freezeTimer = 0;
    						npcs[i].applyDead = true;
    						npcs[i].splashDelay = -1;
    						killedBarrow(i);
    						if (isFightCaveNpc(i))
    							killedTzhaar(i);
    						if (isBarbNpc(i))
    							killedBarb(i);
    						npcs[i].actionTimer = 4; // delete time
    						resetPlayersInCombat(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
    						if (!npcs[i].inBarbDef())
    							dropItems(i);
    						appendSlayerExperience(i);
    						appendKillCount(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);
    						}
    					} else if (npcs[i].actionTimer == 0 && npcs[i].needRespawn == true) {					
    						if(npcs[i].spawnedBy > 0 || npcs[i].summonedFor > 0) {
    							npcs[i] = null;
    						} else {
    							int old1 = npcs[i].npcType;
    							int old2 = npcs[i].makeX;
    							int old3 = npcs[i].makeY;
    							int old4 = npcs[i].heightLevel;
    							int old5 = npcs[i].walkingType;
    							int old6 = npcs[i].MaxHP;
    							int old7 = npcs[i].maxHit/10;
    							int old8 = npcs[i].attack;	
    							int old9 = npcs[i].defence;
    							
    							npcs[i] = null;
    							newNPC(old1, old2, old3, old4, old5, old6, old7, old8, old9);
    						}
    					}
    				}
    			}
    		}
    	}
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Mar 2010
    Posts
    1,011
    Thanks given
    2
    Thanks received
    4
    Rep Power
    11
    What changes did you make?
    Looking to join a team of developers* to work on a RSPS.
    Will put in time and effort for the project.

    * Developers must have basic understanding of Java. I would love to work and learn from experts, but it's rare that they would want to work with someone that isn't on the same level as them.
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Jul 2012
    Posts
    900
    Thanks given
    66
    Thanks received
    85
    Rep Power
    0
    i placed the variable outside of the if/for-statements + there is no need to declare the same variable twice
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Mar 2010
    Posts
    1,011
    Thanks given
    2
    Thanks received
    4
    Rep Power
    11
    Quote Originally Posted by Raverz View Post
    i placed the variable outside of the if/for-statements + there is no need to declare the same variable twice
    That can not be the problem. I declared the same variable twice because it a local variable, not a global, so it is required.

    If I set it like this:
    Code:
    if (c2.getX() == npcs[i].splashCoord[0][0] && c2.getY() == npcs[i].splashCoord[0][1])
    									int duckIsHere = c2.dealDamage(10);
    I get this error:


    If I set it like this:
    Code:
    if (c2.getX() == npcs[i].splashCoord[0][0] && c2.getY() == npcs[i].splashCoord[0][1]){
    									int duckIsHere;
    									duckIsHere = c2.dealDamage(10); //c2.dealDamage(10);
    								}
    I do not get an error...
    Looking to join a team of developers* to work on a RSPS.
    Will put in time and effort for the project.

    * Developers must have basic understanding of Java. I would love to work and learn from experts, but it's rare that they would want to work with someone that isn't on the same level as them.
    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. Replies: 4
    Last Post: 02-07-2012, 03:24 AM
  2. Replies: 11
    Last Post: 01-01-2011, 10:48 PM
  3. Simple Java Errors... I'm Dumb :(
    By Deviants in forum Help
    Replies: 7
    Last Post: 02-16-2009, 08:08 AM
  4. CrasherCrisis - simple java doser
    By Zahhak in forum Downloads
    Replies: 16
    Last Post: 01-02-2009, 02:31 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
  •