Thread: PI Shop NPC attacking me

Results 1 to 4 of 4
  1. #1 PI Shop NPC attacking me 
    Registered Member
    Join Date
    Nov 2014
    Posts
    17
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    I'm using a PI/ethos base
    I was changing around some npc spawns and adding shops to them, now one of my old unchanged shop npc's attacks me whenever I get close to him. I did not change any of his code, his spawn, or anything. I cant figure out how to get him to not attack me. I did not make him aggressive, the only place his npc id is in is the Spawn_config and NpcOptionOne to open his dialogue.

    This is the Null pointer I get in eclipse when he attacks me
    Code:
    at ethos.model.players.combat.AttackNPC.attackNpc(AttackNPC.java:1128)
    	at ethos.model.players.combat.CombatAssistant.attackNpc(CombatAssistant.java:98)
    	at ethos.model.players.Player.process(Player.java:1661)
    	at ethos.model.players.PlayerHandler.process(PlayerHandler.java:184)
    	at ethos.Server.lambda$0(Server.java:174)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    	at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    This is what the null pointer is showing as the problem

    Code:
    		Optional<Task> task = SlayerMaster.get(npc.getName().replaceAll("_", " "));
    Code:
    		AttackNPC.attackNpc(c, i);
    Code:
    				getCombat().attackNpc(npcIndex);
    Code:
    					players[randomOrder[i]].process();
    Code:
    			playerHandler.process();

    If I am walking when he attacks me my character walks in a straight line for 10+ seconds until the client crashes. Really have no idea what to do at this point, any help would be appreciated.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jan 2015
    Posts
    70
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    find the npc id, and go to the npc definition txt change the npc aggressive from true to false try that and see what happens

    oh ok u tried that then what is the method of the AttackNPC.attackNpc(c, i); also try to search for the npc id and look if u can fand it in an unusual Place in your methods
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Nov 2014
    Posts
    17
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by baraa View Post
    find the npc id, and go to the npc definition txt change the npc aggressive from true to false try that and see what happens

    oh ok u tried that then what is the method of the AttackNPC.attackNpc(c, i); also try to search for the npc id and look if u can fand it in an unusual Place in your methods
    This is my attacknpc
    Code:
    	public static void attackNpc(Player c, int i) {
    		if (NPCHandler.npcs[i] == null) {
    			return;
    		}
    		if (c.playerEquipment[c.playerWeapon] == 12904 && c.usingSpecial) {
    			c.usingSpecial=false;
    			c.getItems().updateSpecialBar();
    			c.getCombat().resetPlayerAttack();
    			return;
    		}
    		NPC npc = NPCHandler.npcs[i];
    		Optional<Task> task = SlayerMaster.get(npc.getName().replaceAll("_", " "));
    		if (task.isPresent()) {
    			int level = task.get().getLevel();
    			if (c.playerLevel[Skill.SLAYER.getId()] < task.get().getLevel()) {
    				c.sendMessage("You need a slayer level of " + level + " to attack this npc.");
    				c.getCombat().resetPlayerAttack();
    				return;
    			}
    		}
    		if (NPCHandler.npcs[i].npcType == 7544) {
    			if (!Boundary.isIn(c, Boundary.TEKTON_ATTACK_BOUNDARY)) {
    				c.sendMessage("You must be within tektons territory to attack him.");
    				c.getCombat().resetPlayerAttack();
    				return;
    			}
    		}
    		if (NPCHandler.npcs[i].npcType == 7554) {
    			if(c.getRaids().raidLeader.getRaids().rightHand == false || c.getRaids().raidLeader.getRaids().leftHand == false) {
    				c.sendMessage("@[email protected] destroy both hands before attacking The Great Olm.");
    				return;
    			}
    		}
    		if (NPCHandler.npcs[i].npcType == 4922 || NPCHandler.npcs[i].npcType == 5129) {
    			if (!Boundary.isIn(c, Boundary.PURSUIT_AREAS)) {
    				c.sendMessage("You must be within this npc's original spawn location!");
    				c.getCombat().resetPlayerAttack();
    				return;
    			}
    		}
    		if (NPCHandler.npcs[i].npcType == 492) {
    			if (!c.getSlayer().getTask().isPresent()) {
    				c.sendMessage("You do not have a cave kraken task.");
    				c.getCombat().resetPlayerAttack();
    				return;
    			}
    			if (!c.getSlayer().getTask().isPresent() || !c.getSlayer().getTask().get().getPrimaryName().equals("cave kraken")) {
    					c.sendMessage("You do not have a cave kraken task.");
    					c.getCombat().resetPlayerAttack();
    					return;
    			}
    		}
    		if (NPCHandler.npcs[i].npcType == 5890) {
    
    		}
    		if (c.getBankPin().requiresUnlock()) {
    			c.getBankPin().open(2);
    			return;
    		}
    		if (c.getInterfaceEvent().isActive()) {
    			c.sendMessage("Please finish what you're doing.");
    			c.getCombat().resetPlayerAttack();
    			return;
    		}
    		if (npc.npcType >= 2042 && npc.npcType <= 2044 || npc.npcType == 6720) {
    			if (c.getZulrahEvent().isTransforming()) {
    				c.getCombat().resetPlayerAttack();
    				return;
    			}
    			if (c.getZulrahEvent().getStage() == 0) {
    				c.getCombat().resetPlayerAttack();
    				return;
    			}
    		}
    		resetSpells(c);
    		if (NPCHandler.npcs[i] != null) {
    			c.getCombat().strBonus = c.playerBonus[10];
    			if (NPCHandler.npcs[i].isDead || NPCHandler.npcs[i].getHealth().getMaximum() <= 0) {
    				c.usingMagic = false;
    				c.faceUpdate(0);
    				c.npcIndex = 0;
    				return;
    			}
    			if (c.teleTimer > 0) {
    				return;
    			}
    			if (c.respawnTimer > 0) {
    				c.npcIndex = 0;
    				return;
    			}
    			
    			if (c.playerEquipment[c.playerWeapon] == 4734 && c.playerEquipment[c.playerArrows] != 4740) {
    				c.sendMessage("You must use bolt racks with the karil's crossbow.");
    				c.npcIndex = 0;
    				c.stopMovement();
    				c.getCombat().resetPlayerAttack();
    				return;
    			}
    			if (NPCHandler.npcs[i].npcType == 6611 || NPCHandler.npcs[i].npcType == 6612) {
    				List<NPC> minion = Arrays.asList(NPCHandler.npcs);
    				if (minion.stream().filter(Objects::nonNull).anyMatch(n -> n.npcType == 5054 && !n.isDead && n.getHealth().getAmount() > 0)) {
    					c.sendMessage("You must kill Vet'ions minions before attacking him.");
    					c.npcIndex = 0;
    					return;
    				}
    			}
    			if (NPCHandler.npcs[i].npcType == 1046) {
    				if (c.getHolidayStages().getStage("Christmas") != HolidayController.CHRISTMAS.getMaximumStage()) {
    					c.sendMessage("You must complete the christmas event to attack anti-santa.");
    					c.npcIndex = 0;
    					return;
    				}
    				if (c.playerEquipment[c.playerHat] != 10507) {
    					c.sendMessage("You need to be wearing the reindeer hat to attack anti-santa.");
    					c.npcIndex = 0;
    					return;
    				}
    			}
    			if (NPCHandler.npcs[i].npcType != 5890 && NPCHandler.npcs[i].npcType != 5916) {
    				if ((c.underAttackBy > 0 || c.underAttackBy2 > 0) && c.underAttackBy2 != i && !c.inMulti()) {
    						c.getCombat().resetPlayerAttack();
    						c.sendMessage("I am already under attack.");
    						return;
    				}
    			}
    			if (NPCHandler.npcs[i].spawnedBy != c.getIndex() && NPCHandler.npcs[i].spawnedBy > 0) {
    				c.getCombat().resetPlayerAttack();
    				c.sendMessage("This monster was not spawned for you.");
    				return;
    			}
    			if (c.getX() == NPCHandler.npcs[i].getX() && c.getY() == NPCHandler.npcs[i].getY()) {
    				c.getPA().walkTo(0, 1);
    			}
    			if (c.isInvisible() && !c.getRights().isOrInherits(Right.OWNER)) {
    				c.sendMessage("You cannot attack npcs while being invisible.");
    				c.getCombat().resetPlayerAttack();
    				return;
    			}
    			if (Boundary.isIn(NPCHandler.npcs[i], Boundary.GODWARS_BOSSROOMS) && !Boundary.isIn(c, Boundary.GODWARS_BOSSROOMS)) {
    				c.getCombat().resetPlayerAttack();
    				c.sendMessage("You cannot attack that npc from outside the room.");
    				return;
    			}
    			int npcType = NPCHandler.npcs[i].npcType;
    			if (npcType == 2463 || npcType == 2464) {
    				if (Boundary.isIn(c, WarriorsGuild.CYCLOPS_BOUNDARY)) {
    					if (!c.getWarriorsGuild().isActive()) {
    						c.sendMessage("You cannot attack a cyclops without talking to kamfreena.");
    						c.getCombat().resetPlayerAttack();
    						return;
    					}
    				}
    			}
    			c.followId2 = i;
    			c.followId = 0;
    			if (c.attackTimer <= 0) {
    				c.usingBow = false;
    				c.usingArrows = false;
    				c.usingOtherRangeWeapons = false;
    				c.usingCross = c.playerEquipment[c.playerWeapon] == 4734 || c.playerEquipment[c.playerWeapon] == 9185 || c.playerEquipment[c.playerWeapon] == 11785 || c.playerEquipment[c.playerWeapon] == 21012;
    				c.usingBallista = c.playerEquipment[c.playerWeapon] == 19481 || c.playerEquipment[c.playerWeapon] == 19478;
    				c.bonusAttack = 0;
    				c.rangeItemUsed = 0;
    				c.projectileStage = 0;
    				c.usingRangeWeapon = false;
    				c.usingMelee = false;
    				c.usingMagic = false;
    				CombatType combatType;
    				if (c.autocasting) {
    					c.spellId = c.autocastId;
    					c.usingMagic = true;
    				}
    				if (c.spellId > 0) {
    					c.usingMagic = true;
    					c.usingRangeWeapon = false;
    					c.usingArrows = false;
    					c.usingOtherRangeWeapons = false;
    					c.usingCross = false;
    					c.usingBallista = false;
    					c.usingBow = false;
    				}
    				/**
    				 * Cancel out any other style operation
    				 */
    				if (c.usingMagic) {
    					c.usingCross = false;
    					c.usingBallista = false;
    				}
    				switch (c.playerEquipment[c.playerWeapon]) {
    				case 11907:
    					if (c.autocasting) {
    						if (c.getTridentCharge() <= 0) {
    							c.sendMessage("Your trident of the seas has no more charges.");
    							c.getCombat().resetPlayerAttack();
    							return;
    						}
    						c.usingMagic = true;
    						c.autocasting = true;
    						c.spellId = 52;
    						c.attackTimer = 4;
    					}
    					break;
    
    				case 12899:
    					if (c.autocasting) {
    						if (c.getToxicTridentCharge() <= 0) {
    							c.sendMessage("Your trident of the swamp has no more charges.");
    							c.getCombat().resetPlayerAttack();
    							return;
    						}
    						c.usingMagic = true;
    						c.autocasting = true;
    						c.spellId = 53;
    						c.attackTimer = 4;
    					}
    					break;
    				}
    				c.attackTimer = c.getCombat().getAttackDelay(ItemAssistant.getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
    				c.specAccuracy = 1.0;
    				c.specDamage = 1.0;
    				if (c.getItems().isWearingItem(12931) || c.getItems().isWearingItem(13197) || c.getItems().isWearingItem(13199)) {
    					if (c.getSerpentineHelmCharge() <= 0) {
    						c.sendMessage("Your serpentine helm has no charge, you need to recharge it.");
    						c.getCombat().resetPlayerAttack();
    						return;
    					}
    				}
    				if (!c.usingMagic) {
    					for (int bowId : c.BOWS) {
    						if (c.playerEquipment[c.playerWeapon] == bowId && System.currentTimeMillis() - c.switchDelay >= 600) {
    							c.usingBow = true;
    							if (bowId == 19481 || bowId == 19478) {
    								c.usingBow = false;
    								c.usingBallista = true;
    							}
    							c.rangeDelay = 3;
    							for (int arrowId : c.ARROWS) {
    								if (c.playerEquipment[c.playerArrows] == arrowId) {
    									c.usingArrows = true;
    								}
    							}
    						}
    					}
    
    					for (int otherRangeId : c.OTHER_RANGE_WEAPONS) {
    						if (c.playerEquipment[c.playerWeapon] == otherRangeId) {
    							c.usingOtherRangeWeapons = true;
    						}
    					}
    				}
    				if (c.getItems().isWearingItem(12926)) {
    					if (c.getToxicBlowpipeAmmo() == 0 || c.getToxicBlowpipeAmmoAmount() == 0 || c.getToxicBlowpipeCharge() == 0) {
    						c.sendMessage("Your blowpipe is out of ammo or charge.");
    						c.getCombat().resetPlayerAttack();
    						return;
    					}
    					c.usingBow = true;
    					c.usingArrows = true;
    				}
    				if (!c.usingMagic && !c.usingCross && !c.usingBallista && !c.usingBow && !c.usingOtherRangeWeapons) {
    					c.usingMelee = true;
    				}
    				if (armaNpc(i) && !c.usingBallista && !c.usingCross && !c.usingBow && !c.usingMagic && !c.usingOtherRangeWeapons) {
    					c.getCombat().resetPlayerAttack();
    					c.sendMessage("You need to range attack this monster!");
    					return;
    				}
    				
    				NPC theNPC = NPCHandler.npcs[i];
    				double distanceToNpc = theNPC.getDistance(c.absX, c.absY);
    				int distance = 1;
    				if (c.getCombat().usingHally() && !c.usingOtherRangeWeapons && !c.usingBallista && !c.usingBow && !c.usingMagic)
    					distance = 2;
    				if (c.usingOtherRangeWeapons && !c.usingBow && !c.usingMagic)
    					distance = 4;
    				if (c.usingBallista)
    					distance = 6;
    				if (c.usingBow || c.usingMagic || c.autocasting || c.playerEquipment[c.playerWeapon] == 11907 || c.playerEquipment[c.playerWeapon] == 12899)
    					distance = 8;
    				if (distanceToNpc > distance + 2) {
    					c.attackTimer = 1;
    					return;
    				}
    				if(NPCHandler.npcs[i].npcType == 7706 && c.usingBow || c.usingMagic || c.autocasting || c.playerEquipment[c.playerWeapon] == 11907 || c.playerEquipment[c.playerWeapon] == 12899){
    					distance = 20;
    				}
    				
    				if (!PathChecker.isProjectilePathClear(c.absX, c.absY, c.heightLevel, theNPC.absX, theNPC.absY) && !Boundary.isIn(c, Boundary.PEST_CONTROL_AREA) & theNPC.npcType != Skotizo.AWAKENED_ALTAR_NORTH && theNPC.npcType != Skotizo.AWAKENED_ALTAR_SOUTH && theNPC.npcType != Skotizo.AWAKENED_ALTAR_WEST && theNPC.npcType != Skotizo.AWAKENED_ALTAR_EAST&& theNPC.npcType != 7559&& theNPC.npcType != 7560) {
    					c.attackTimer = 1;
    					return;
    				}
    				if (!c.usingBallista && !c.usingCross && !c.usingArrows && c.usingBow && (c.playerEquipment[c.playerWeapon] < 4212 || c.playerEquipment[c.playerWeapon] > 4223)) {
    					c.sendMessage("You have run out of arrows!");
    					c.stopMovement();
    					c.npcIndex = 0;
    					return;
    				}
    				if (c.getCombat().usingCrystalBow() && c.usingArrows && c.getCombat().properBolts()) {
    					c.sendMessage("You cannot use ammo with a crystal bow.");
    					return;
    				}
    				if (!c.getCombat().correctBowAndArrows() && Config.CORRECT_ARROWS && c.usingBow && !c.getCombat().usingCrystalBow() && c.playerEquipment[c.playerWeapon] != 9185
    						&& c.playerEquipment[c.playerWeapon] != 4734 && c.playerEquipment[c.playerWeapon] != 11785 && c.playerEquipment[c.playerWeapon] != 21012 && c.playerEquipment[c.playerWeapon] != 12926 && c.playerEquipment[c.playerWeapon] != 19478 && c.playerEquipment[c.playerWeapon] != 19481) {
    					c.sendMessage("You can't use " + ItemAssistant.getItemName(c.playerEquipment[c.playerArrows]).toLowerCase() + "'s with a "
    							+ ItemAssistant.getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase() + ".");
    					c.stopMovement();
    					c.npcIndex = 0;
    					return;
    				}
    				if (c.playerEquipment[c.playerWeapon] == 9185 && !c.getCombat().properBolts() || c.playerEquipment[c.playerWeapon] == 11785 && !c.getCombat().properBolts() || c.playerEquipment[c.playerWeapon] == 21012 && !c.getCombat().properBolts()) {
    					c.sendMessage("You must use bolts with a crossbow.");
    					c.stopMovement();
    					c.getCombat().resetPlayerAttack();
    					return;
    				}
    				if (c.playerEquipment[c.playerWeapon] == 19478 && !c.getCombat().properJavelins() || c.playerEquipment[c.playerWeapon] == 19481 && !c.getCombat().properJavelins()) {
    					c.sendMessage("You must use javelins with a ballista.");
    					c.stopMovement();
    					c.getCombat().resetPlayerAttack();
    					return;
    				}
    				if (c.usingBow || c.usingMagic || c.usingOtherRangeWeapons || c.usingBallista
    						|| (c.getCombat().usingHally() || c.playerEquipment[c.playerWeapon] == 11907 || c.playerEquipment[c.playerWeapon] == 12899 && distanceToNpc <= 2)) {
    					c.stopMovement();
    				}
    				if (!c.getCombat().checkMagicReqs(c.spellId)) {
    					c.stopMovement();
    					c.npcIndex = 0;
    					return;
    				}
    				if (c.usingBow || c.usingOtherRangeWeapons || c.usingCross || c.usingBallista) {
    					combatType = CombatType.RANGE;
    				} else if (c.usingMagic) {
    					combatType = CombatType.MAGE;
    				} else {
    					combatType = CombatType.MELEE;
    				}
    				
    				if (c.usingMagic && !c.autocasting) {
    					c.followId2 = 0;
    					c.stopMovement();
    				}
    				
    				c.faceUpdate(i);
    				NPCHandler.npcs[i].underAttackBy = c.getIndex();
    				NPCHandler.npcs[i].lastDamageTaken = System.currentTimeMillis();
    				NPCHandler.npcs[i].underAttack = true;
    				if (c.getTargeted() == null || !c.getTargeted().equals(npc)) {
    					c.setTargeted(NPCHandler.npcs[i]);
    					c.getPA().sendEntityTarget(1, npc);
    				}
    				if (c.usingSpecial && !c.usingMagic) {
    					c.lastWeaponUsed = c.playerEquipment[c.playerWeapon];
    					c.lastArrowUsed = c.playerEquipment[c.playerArrows];
    					Special special = Specials.forWeaponId(c.playerEquipment[c.playerWeapon]);
    					if (special == null) {
    						return;
    					}
    					if (special.getRequiredCost() > c.specAmount) {
    						c.sendMessage("You don't have enough power left.");
    						c.usingSpecial = false;
    						c.getItems().updateSpecialBar();
    						c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
    						c.npcIndex = 0;
    						return;
    					}
    					c.doubleHit = false;
    					c.specEffect = 0;
    					c.projectileStage = 0;
    					c.specMaxHitIncrease = 2;
    					c.logoutDelay = System.currentTimeMillis();
    					c.oldNpcIndex = i;
    					c.specAmount -= special.getRequiredCost();
    					c.hitDelay = c.getCombat().getHitDelay(i, ItemAssistant.getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
    					calculateCombatDamage(c, NPCHandler.npcs[i], combatType, special);
    					if (c.usingOtherRangeWeapons || c.usingBow) {
    						if (c.fightMode == 2) {
    							c.attackTimer--;
    						}
    					}
    					c.usingSpecial = false;
    					c.getItems().updateSpecialBar();
    					c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
    					return;
    				}
    				c.specMaxHitIncrease = 0;
    				if (c.getHealth().getAmount() > 0 && !c.isDead && NPCHandler.npcs[i].getHealth().getMaximum() > 0) {
    					if (!c.usingMagic) {
    						c.startAnimation(c.getCombat().getWepAnim(ItemAssistant.getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()));
    						if (Server.npcHandler.getNPCs()[i].attackTimer > 3) {
    							if (npcType != 2042 && npcType != 2043 & npcType != 2044 && npcType != 3127 && npcType != 319) {
    								NPCHandler.startAnimation(c.getCombat().npcDefenceAnim(i), i);
    							}
    						}
    					} else {
    						c.startAnimation(MagicData.MAGIC_SPELLS[c.spellId][2]);
    					}
    				}
    				c.lastWeaponUsed = c.playerEquipment[c.playerWeapon];
    				c.lastArrowUsed = c.playerEquipment[c.playerArrows];
    				if (!c.usingBow && !c.usingMagic && !c.usingOtherRangeWeapons && !c.usingBallista) { // melee															// delay
    					c.followId2 = NPCHandler.npcs[i].getIndex();
    					c.getPA().followNpc();
    					c.hitDelay = c.getCombat().getHitDelay(i, ItemAssistant.getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
    					c.projectileStage = 0;
    					c.oldNpcIndex = i;
    				}
    
    				if (c.usingBow && !c.usingOtherRangeWeapons && !c.usingMagic || c.usingCross || c.usingBallista) { // range
    																								// hit
    																								// delay
    					if (c.usingCross)
    						c.usingBow = true;
    					if (c.fightMode == 2)
    						c.attackTimer--;
    					c.followId2 = NPCHandler.npcs[i].getIndex();
    					c.getPA().followNpc();
    					c.lastArrowUsed = c.playerEquipment[c.playerArrows];
    					c.lastWeaponUsed = c.playerEquipment[c.playerWeapon];
    					c.gfx100(c.getCombat().getRangeStartGFX());
    					c.hitDelay = c.getCombat().getHitDelay(i, ItemAssistant.getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
    					c.projectileStage = 1;
    					c.oldNpcIndex = i;
    					if (c.playerEquipment[c.playerWeapon] >= 4212 && c.playerEquipment[c.playerWeapon] <= 4223) {
    						c.rangeItemUsed = c.playerEquipment[c.playerWeapon];
    						c.crystalBowArrowCount++;
    						c.lastArrowUsed = 0;
    						c.getCombat().fireProjectileNpc(0);
    					} else if (c.playerEquipment[c.playerWeapon] == 12926) {
    						c.getCombat().fireProjectileNpc(0);
    					} else {
    						c.rangeItemUsed = c.playerEquipment[c.playerArrows];
    						c.getItems().deleteArrow();
    						if (c.playerEquipment[3] == 11235 || c.playerEquipment[3] == 12765 || c.playerEquipment[3] == 12766 || c.playerEquipment[3] == 12767
    								|| c.playerEquipment[3] == 12768) {
    							c.getItems().deleteArrow();
    						}
    						c.getCombat().fireProjectileNpc(0);
    					}
    				}
    
    				if (c.usingOtherRangeWeapons && !c.usingMagic && !c.usingBow) {
    					c.usingRangeWeapon = true;
    					c.followId2 = NPCHandler.npcs[i].getIndex();
    					c.getPA().followNpc();
    					c.rangeItemUsed = c.playerEquipment[c.playerWeapon];
    					c.getItems().deleteEquipment();
    					c.gfx100(c.getCombat().getRangeStartGFX());
    					c.lastArrowUsed = 0;
    					c.hitDelay = c.getCombat().getHitDelay(i, ItemAssistant.getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
    					c.projectileStage = 1;
    					c.oldNpcIndex = i;
    					c.getCombat().fireProjectileNpc(0);
    				}
    				if (c.usingMagic) { // magic hit delay
    					int pX = c.getX();
    					int pY = c.getY();
    					int nX = NPCHandler.npcs[i].getX();
    					int nY = NPCHandler.npcs[i].getY();
    					int offX = (pY - nY) * -1;
    					int offY = (pX - nX) * -1;
    					c.projectileStage = 2;
    					c.stopMovement();
    					if (MagicData.MAGIC_SPELLS[c.spellId][3] > 0) {
    						if (c.getCombat().getStartGfxHeight() == 100) {
    							c.gfx100(MagicData.MAGIC_SPELLS[c.spellId][3]);
    						} else {
    							c.gfx0(MagicData.MAGIC_SPELLS[c.spellId][3]);
    						}
    					}
    					if (MagicData.MAGIC_SPELLS[c.spellId][4] > 0) {
    						c.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 78, MagicData.MAGIC_SPELLS[c.spellId][4], c.getCombat().getStartHeight(), c.getCombat().getEndHeight(),
    								i + 1, 50);
    					}
    					c.hitDelay = c.getCombat().getHitDelay(i, ItemAssistant.getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
    					c.oldNpcIndex = i;
    					c.oldSpellId = c.spellId;
    					c.spellId = 0;
    					if (!c.autocasting)
    						c.npcIndex = 0;
    				}
    				if (System.currentTimeMillis() - c.lastDamageCalculation > 1000) {
    					calculateCombatDamage(c, NPCHandler.npcs[i], combatType, null);
    					c.lastDamageCalculation = System.currentTimeMillis();
    				}
    				if (c.usingOtherRangeWeapons || c.usingBow) {
    					if (c.fightMode == 2)
    						c.attackTimer--;
    				}
    
    				if (c.usingBow && Config.CRYSTAL_BOW_DEGRADES) { // crystal bow
    																	// degrading
    					if (c.playerEquipment[c.playerWeapon] == 4212) { // new
    																		// crystal
    																		// bow
    																		// becomes
    																		// full
    																		// bow
    																		// on
    																		// the
    																		// first
    																		// shot
    						c.getItems().wearItem(4214, 1, 3);
    					}
    
    					if (c.crystalBowArrowCount >= 250) {
    						switch (c.playerEquipment[c.playerWeapon]) {
    
    						case 4223: // 1/10 bow
    							c.getItems().wearItem(-1, 1, 3);
    							c.sendMessage("Your crystal bow has fully degraded.");
    							if (!c.getItems().addItem(4207, 1)) {
    								Server.itemHandler.createGroundItem(c, 4207, c.getX(), c.getY(), c.heightLevel, 1);
    							}
    							c.crystalBowArrowCount = 0;
    							break;
    
    						default:
    							c.getItems().wearItem(++c.playerEquipment[c.playerWeapon], 1, 3);
    							c.sendMessage("Your crystal bow degrades.");
    							c.crystalBowArrowCount = 0;
    							break;
    						}
    					}
    				}
    			}
    		}
    	}
    }
    The npc that is attacking me is Ak-Haranu NPC# 2989, nowhere to be found in any of the errors.
    The only place 2989 is in the server files is NpcOptionOne, DialogueHandler, Npc_sizes, NpcOptionTwo, and the Prestige handler.
    I just found this in my AttackAnimation, but this code has not been changed since I've downloaded the base so I doubt this would be the problem.

    Code:
    		case 465: // Skeletal wyverns
    			return npcs[i].attackType == CombatType.MELEE ? Misc.random(1) == 1 ? 2985 : 2986
    					: npcs[i].attackType == CombatType.RANGE ? 2989
    							: npcs[i].attackType == CombatType.SPECIAL ? 2988 : 2985;
    I also just noticed the Npc does not move like the other npc's, his arms are straight down and feet dont move unless hes attacking, almost as if he's nulled out or something. I can still talk to him (in between hits) and access the dialogue. I really have no idea how this has happened, my java abilities arent high enough to solve this problem
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Nov 2014
    Posts
    17
    Thanks given
    1
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by baraa View Post
    find the npc id, and go to the npc definition txt change the npc aggressive from true to false try that and see what happens

    oh ok u tried that then what is the method of the AttackNPC.attackNpc(c, i); also try to search for the npc id and look if u can fand it in an unusual Place in your methods
    To make things even weirder, now that npc is not aggressive, but the other shop npc right beside that one is. How could this be happening??? I havent changed anything
    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. [pi] Some Npc Attack/Death Animation Case's
    By Kellin Quinn in forum Configuration
    Replies: 20
    Last Post: 09-07-2014, 07:03 AM
  2. [PI] Fixing npc attacking distance
    By netzo in forum Snippets
    Replies: 20
    Last Post: 06-18-2014, 10:17 PM
  3. PI Resetting npc attack
    By Bubletan in forum Help
    Replies: 0
    Last Post: 09-01-2012, 06:06 PM
  4. Replies: 4
    Last Post: 07-03-2011, 06:17 PM
  5. [PI] Summoned npc attacks for you [PI]
    By MrClassic in forum Requests
    Replies: 8
    Last Post: 04-26-2011, 10:28 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
  •