I've written the following code to make sure both npc and players stop attacking, but it's not working.
Code: Select all
for (L2Character pc : npc.getAttackByList()) // Make sure players don't auto-attack beleth once he ports { if (pc != null && !(pc.isDead())) { pc.abortCast(); pc.abortAttack(); pc.setTarget(null); pc.stopMove(null); pc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); pc.sendPacket(new StopMove(pc.getObjectId(), pc.getX(), pc.getY(), pc.getZ(), pc.getHeading())); } }
Code: Select all
npc.setTarget(null); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); npc.teleToLocation(spawnPoint.getLocx(),spawnPoint.getLocy(),spawnPoint.getLocz());
what else can be done?
