Jump to content
  • 0

[Help]monster attack the monster. how?


Question

2 answers to this question

Recommended Posts

  • 0
Posted

well here is, im using it on my serv and works perfectlly, try to rework for your core,

 

add this onSPawn
npc.broadcastPacket(new AutoAttackStart(npc.getObjectId()));
ThreadPoolManager.getInstance().scheduleAi(new AttackTask(npc, TARGET_ON_WHICH_YOUR_NPC ATTACKS), Rnd.get(10, 1000));



private static final class AttackTask implements Runnable
{
	private final L2Npc _attacker;
	private final L2Npc _target;
	public AttackTask(L2Npc attacker, L2Npc target)
	{
		_attacker = attacker;
		_target = target;
	}
	@Override
	public void run()
	{
		Broadcast.toPlayer(new Attack(_attacker, _target, false, 0, true), _attacker.getInstanceId());
		ThreadPoolManager.getInstance().scheduleAi(new AttackTask(_attacker, _target), 1500);
	}
}	

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock