Making characters not follow a teleported npc

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Probe
Posts: 915
Joined: Thu Sep 03, 2009 6:36 pm
Location: Israel
Contact:

Making characters not follow a teleported npc

Post by Probe »

I'm building a script that relocates a certain npc, to a place still in range for the players attacking it.
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());	
I looked into the javas and saw that teleToLocation already clears target and aborts casting\attacking, so didn't add it again

what else can be done? :|
Post Reply