Jump to content
  • 0

Summon Pking


Question

Posted

Hello guys, i need some help, if you summon pet in town and you try to use it to attack players its not working, if you first use the pet to attack npc and then a player its working and people are pking in town by using their pets.

My npcs are not attackable but i dont know why pets or summons can attack them.

I have to make npcs not attackable from pets too or fix this with another way. Any help?

9 answers to this question

Recommended Posts

  • 0
Posted

i am using l2jesios

 

	protected void doAttack(L2Character target)
{
	if (Config.DEBUG)
		_log.fine(getName() + " doAttack: target=" + target);

	if (!isAlikeDead() && target != null)
	{
		if (this instanceof L2Npc && target.isAlikeDead() || !getKnownList().knowsObject(target))
		{
			getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
			sendPacket(ActionFailed.STATIC_PACKET);
			return;
		}
		else if (this instanceof L2PcInstance)
		{
			if (target.isDead())
			{
				getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
				sendPacket(ActionFailed.STATIC_PACKET);
				return;
			}

			L2PcInstance actor = (L2PcInstance) this;
			// Players riding wyvern can only do melee attacks
			if (actor.isMounted() && actor.getMountNpcId() == 12621)
			{
				sendPacket(ActionFailed.STATIC_PACKET);
				return;
			}
		}
	}

	if (isAttackingDisabled())
		return;

	if (this instanceof L2PcInstance)
	{
		if (((L2PcInstance) this).inObserverMode())
		{
			sendPacket(SystemMessage.getSystemMessage(SystemMessageId.OBSERVERS_CANNOT_PARTICIPATE));
			sendPacket(ActionFailed.STATIC_PACKET);
			return;
		}

		// Checking if target has moved to peace zone
		if (target.isInsidePeaceZone((L2PcInstance) this))
		{
			getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
			sendPacket(ActionFailed.STATIC_PACKET);
			return;
		}
	}

  • 0
Posted

Soz, post me the onForcedAttack() method too, if u can :P

 

	public void onForcedAttack(L2PcInstance player)
{
	if (isInsidePeaceZone(player))
	{
		// If L2Character or target is in a peace zone, send a system message TARGET_IN_PEACEZONE a Server->Client packet ActionFailed
		player.sendPacket(SystemMessageId.TARGET_IN_PEACEZONE);
		player.sendPacket(ActionFailed.STATIC_PACKET);
		return;
	}

	if (player.isInOlympiadMode() && player.getTarget() != null && player.getTarget() instanceof L2Playable)
	{
		L2PcInstance target = player.getTarget().getActingPlayer();
		if (target == null || (target.isInOlympiadMode() && (!player.isOlympiadStart() || player.getOlympiadGameId() != target.getOlympiadGameId())))
		{
			// if L2PcInstance is in Olympia and the match isn't already start, send a Server->Client packet ActionFailed
			player.sendPacket(ActionFailed.STATIC_PACKET);
			return;
		}
	}

	if (player.getTarget() != null && !player.getTarget().isAttackable() && !player.getAccessLevel().allowPeaceAttack())
	{
		// If target is not attackable, send a Server->Client packet ActionFailed
		player.sendPacket(ActionFailed.STATIC_PACKET);
		return;
	}

	if (player.isConfused())
	{
		// If target is confused, send a Server->Client packet ActionFailed
		player.sendPacket(ActionFailed.STATIC_PACKET);
		return;
	}

	// GeoData Los Check or dz > 1000
	if (!GeoData.getInstance().canSeeTarget(player, this))
	{
		player.sendPacket(SystemMessageId.CANT_SEE_TARGET);
		player.sendPacket(ActionFailed.STATIC_PACKET);
		return;
	}

	// Notify AI with AI_INTENTION_ATTACK
	player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
}

  • 0
Posted

-beep-, I'm just sleepy as hell.

More than probably the 2 methods I told you to post, don't matter at all.

We need to check the canAttack() from L2Summon, if you have that file in that pack.

:rage: :rage: :rage:

  • 0
Posted

-beep-, I'm just sleepy as hell.

More than probably the 2 methods I told you to post, don't matter at all.

We need to check the canAttack() from L2Summon, if you have that file in that pack.

:rage: :rage: :rage:

haha okay, i dont have this method in l2summon

  • 0
Posted

And do you have this one?

 

/**
 * Performs an attack to the owner's target.
 */
public void doAttack()
{
	if (getOwner() != null)
	{
		final L2Object target = getOwner().getTarget();
		if (target != null)
		{
			setTarget(target);
			getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
		}
	}
}

 

If yes, you could try with (not the best option but could work):

 

/**
 * Performs an attack to the owner's target.
 */
public void doAttack()
{
	if (getOwner() != null)
	{
		final L2Object target = getOwner().getTarget();
		if (target != null)
		{
			if(target instanceof L2Npc /* or u can try with target instanceof L2PcInstance too, if u want NPC attackables */ && isInsidePeaceZone(target)
			{
				return;
			}
			setTarget(target);
			getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
		}
	}
}

 

  • 0
Posted

Stupid me i didnt even had a doattack method...

 

I used this one

	protected void doAttack(L2Character target)
{
	if(getOwner() != null && getOwner() == target && !getOwner().isBetrayed())
	{
		sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
		return;
	}
	if(isInsidePeaceZone(this, target))
	{
		getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
		return;
	}
	if(!target.isAttackable())
	{
		if (!(this instanceof L2SiegeSummonInstance))
		{
		getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
		return;
		}
	}

	super.doAttack(target);
}

 

Thx for helping anyway Wyatt ;)

Guest
This topic is now closed to further replies.


  • Posts

    • sell adena l2rebon signature x1 - 1kk = 1 dollars l2reborn x10 - 500kk = 4 dollars E-Global x Lu4 - 1kk = 2 dollars BOHPTS - x20-x500 TOP PRICE DISCORD - GODDARDSHOP TELEGRAM - MMOPROMO Also on sale are Epic jewelry, Clothes at a very good price
    • Hello Sorry, my Discord is: ave7309
    • “Hello, I’d like to present a short description of the server. Everyone starts equally at max level 80. The server includes a custom buffer, custom class master, custom weapons and armors, custom zones, custom teleporter, custom raid bosses, and much more. I’ll leave a link in the description for those who want to see how everything looks inside. The server is only open on weekends, and you can find more news via the Facebook link.”   https://www.facebook.com/profile.php?id=61578869175323
    • 1. You where subscriber 3 years ago. 2. There is no current L2jMobius 2.8 Seven Signs version. Subcriber or not. 3. You have your answer from multiple forums that more items is more delay.  
    • 1. Optimize Packet Serialization Look in ItemList.java or wherever the inventory packet is constructed. Instead of building the packet with inefficient string concatenation or repeated allocations, use a preallocated buffer and avoid creating new objects for each item. Mobius sources are Java-based, so profiling with something like VisualVM or YourKit can help see where most time is spent. 2. Avoid Sending the Full List Each Time Modify the server to send only changed items (diff packets) when the inventory window opens. Some newer forks implement this as “lazy loading” or paged inventory so the client only loads e.g. 100 items at a time. 3. Limit the Inventory Size Per Page Instead of showing all 500 slots at once, split the inventory into pages/tabs (100 slots each). When the user switches a tab, send only that page’s items. This requires some client-side editing, but it’s the most user-friendly long-term fix. 4. Database & Cache Optimizations Ensure your items table is indexed by owner_id to make the query for player items fast. Cache item templates and static data so they are not reloaded every time the inventory is shown. ⚠️ Things to Keep in Mind Increasing slots from 80 → 500 does not just change a number — it multiplies the workload for packet building and UI rendering. You can’t fully avoid some extra cost with 500 items, but you can keep it under a few milliseconds if you optimize how and when the data is sent.    
  • Topics

×
×
  • 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