Jump to content
  • 0

Guards attackable


Question

Posted

Hi:)

I have less than 10 posts so I have to post my question here.

 

I would like to make Guards attackable as a small kind of "bot protection". Bot choses targets randomly but cant target a PK Guard (ctrl needed). I would like to set a guard to be targeted without a ctrl.

 

I found this:

L2GuardInstance.java

if (containsTarget(player))

{

if (_log.isDebugEnabled())

_log.debug(player.getObjectId() + ": Attacked guard " + getObjectId());

 

// Set the L2PcInstance Intention to AI_INTENTION_ATTACK

player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);    <-----this should be modified

 

Please help me and give any info how do do this.

 

Thank you.

Regards.

8 answers to this question

Recommended Posts

  • 0
Posted

Well dude.. im not a pro but i dont think that this should be changed, cuz i think this sends packet that guard is auto-attackable... and as i understanded u wanna have a guard auto-attackable.

>> if (containsTarget(player))  this is checking if player is in aggroList (if he got karma or he had attacked guard), so...

 

Delete everything else and keep just the ATTACK_INTENTION or put something else instead  "if (containsTarget(player))" this.

  • 0
Posted

well the control intention just the attack state the basic thing is applied to all kind of npc instance at the same place so i guess you need to lookup the l2npc.java maybe(idk what chronicle you use maybe its not there) or the attackableai.java

  • 0
Posted

Dunno.. i just tried to delete aggroList check and Interact check, and put just an AI_INTENTION_ATTACK and it kinda worked...

 

well thats really depends on the ai engine so you cant say its work generally :)

  • 0
Posted

what chronicle you use maybe its not there)

 

Gracia Final

 

Dunno.. i just tried to delete aggroList check and Interact check, and put just an AI_INTENTION_ATTACK and it kinda worked...

 

So code should be like this?

 

public void onAction(L2PcInstance player)
{
	if (!canTarget(player))
		return;

	// Check if the L2PcInstance already target the L2GuardInstance
	if (getObjectId() != player.getTargetId())
	{
		if (_log.isDebugEnabled())
			_log.debug(player.getObjectId() + ": Targetted guard " + getObjectId());

		// Set the target of the L2PcInstance player
		player.setTarget(this);
	}
	else
	{
                player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
	}
       }

 

Once again thank you guys for your time to help me ;)

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...