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

    • Dear friends, right now we are holding a grand competition with a prize fund of more than $ 1000 in our stores https://socnet.store , telegram store: https://socnet.shop and SMM panel: https://socnet.pro There are more than 50 prize places in our competition, each lucky person can take one of the places. Important condition: you must make a purchase at any time before June 1, 2025. The more purchases you make - the more chances you have to win the main prize in the community of $ 300! ➡ Our Online Shop: socnet.store  ➡ Our SMM-Boosting Panel: socnet.pro  ➡ Telegram Shop Bot: socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: 79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
    • Dear friends, right now we are holding a grand competition with a prize fund of more than $ 1000 in our stores https://socnet.store , telegram store: https://socnet.shop and SMM panel: https://socnet.pro There are more than 50 prize places in our competition, each lucky person can take one of the places. Important condition: you must make a purchase at any time before June 1, 2025. The more purchases you make - the more chances you have to win the main prize in the community of $ 300! ➡ Our Online Shop: socnet.store  ➡ Our SMM-Boosting Panel: socnet.pro  ➡ Telegram Shop Bot: socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: 79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
    • REBORN ETERNAL IL x10 WTS  1gb 8e (a lot in stock) DR set +6 180e Frintezza+6 200e Zaken+6 200e AQ+6 200e You must go first or Pufa middleman service
    • There's many reasons why it would be more NO than YES : Using NCSoft assets is a death wish, they can lawyer any LU3/Unity if they wanted, since it's a plain steal of intellectual property. It's an hobby, as you said it, and it's not specially about money. Money is a way to filter idiots/resellers, nothing more. It's really about trying to replicate old content and optimize it which I find it fun. I just align with the basic idea than an emulator emulates. When you launch Project64 and SuperMario 64, you don't expect to get something more than 120 stars and Bowser boss in the end - which should have been L2J project to begin with Even if I played a lot with TESCS from Morrowind, back in time, it's not enough to handle current engines, and I'm too lazy to learn Unity/Unreal Engine. Moreover, it would mean buying assets. While doing it alone would be a fail, coupling to L2J / L2 community would still be shitty (since the majority is RU/BR) ; people is only about fame/glory/reselling shit on back of others. Opening to others, the project would be leaked day 1, rebranded and resold. MMO genre is basically dead, and that's not a reboot of any game (l2/wow classic :D) which will turn the tide. Regarding L2 or an remastered version of it, you can obviously blatantly copy-cat it (as Propnight did for Dead by daylight).   All frenchies aren't supposed to do Expedition 33 :).
    • 190euro until last month, don't miss it.
  • 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