Jump to content
  • 0

Hittings doors with skills


Question

Posted

Hello i am trying to disable attacking doors when siege is OFF

But i can still use SKILLS in doors not simple hits only skills (with access lvl 0 ofc)

 

My code at L2Character.java

 

		if ((skill.getAttackAfterCast()
			|| (this instanceof L2Summon && skill.isSkillTypeOffensive()))
			&& (getTarget() instanceof L2Character)
		    && (getTarget() != this) && (getTarget() == target) 
		    && (target.isAttackable()))

 

I tried to add but nothing happen

&&  skill.isNeutral()		

 

Tnx.   

4 answers to this question

Recommended Posts

  • 0
Posted

target.isAttackable() while this is inside you don't need anything else in l2character go to l2doorinstance and add in isattackable these methos that will make the door not to be attackable during not siege hours and only by siege registered members

L2PcInstance player = null;
    			if(attacker instanceof L2PcInstance){
    				player = (L2PcInstance) attacker;
    			}else if(attacker instanceof L2SummonInstance){
    				player = ((L2SummonInstance) attacker).getOwner();
    			}else if(attacker instanceof L2PetInstance){
    				player = ((L2PetInstance) attacker).getOwner();
    			}
    			
    			if (player == null)
    			{
    				return false;
    			}
    			
    			final L2Clan clan = player.getClan();
    			final boolean isCastle = getCastle() != null && getCastle().getCastleId() > 0 && getCastle().getSiege().getIsInProgress() && getCastle().getSiege().checkIsAttacker(clan);
    			if(isCastle)
    			{
    				if(clan != null && clan.getClanId() == getCastle().getOwnerId())
    				{
    					return false;
    				}
    			}
    			return isCastle;

  • 0
Posted

from what i see my doorinstance has this:

		boolean isCastle = (getCastle() != null && getCastle().getCastleId() > 0 && getCastle().getZone().isActive());
	boolean isFort = (getFort() != null && getFort().getFortId() > 0 && getFort().getZone().isActive() && !getIsCommanderDoor());
	int activeSiegeId = (getFort() != null ? getFort().getFortId() : (getCastle() != null ? getCastle().getCastleId() : 0));
	L2PcInstance actingPlayer = attacker.getActingPlayer();

	boolean isSiegeableClanHall = (getClanHall() != null && getClanHall().isSiegeable() && getClanHall().isInSiege());
	if (isSiegeableClanHall && getClanHall().getContestableHall().isInSiege())
	{
		if (attacker instanceof L2SummonInstance)
		{
			L2PcInstance owner = ((L2SummonInstance) attacker).getOwner();
			if (getClanHall().getContestableHall().playerCanParticipate(owner))
				return true;
		}
		if (attacker instanceof L2PetInstance)
		{
			L2PcInstance owner = ((L2PetInstance) attacker).getOwner();
			if (getClanHall().getContestableHall().playerCanParticipate(owner))
				return true;
		}
		if (attacker instanceof L2PcInstance)
		{
			if (getClanHall().getContestableHall().playerCanParticipate((L2PcInstance) attacker))
				return true;
		}
		return false;
	}

  • 0
Posted

from what i see my doorinstance has this:

		boolean isCastle = (getCastle() != null && getCastle().getCastleId() > 0 && getCastle().getZone().isActive());
	boolean isFort = (getFort() != null && getFort().getFortId() > 0 && getFort().getZone().isActive() && !getIsCommanderDoor());
	int activeSiegeId = (getFort() != null ? getFort().getFortId() : (getCastle() != null ? getCastle().getCastleId() : 0));
	L2PcInstance actingPlayer = attacker.getActingPlayer();

	boolean isSiegeableClanHall = (getClanHall() != null && getClanHall().isSiegeable() && getClanHall().isInSiege());
	if (isSiegeableClanHall && getClanHall().getContestableHall().isInSiege())
	{
		if (attacker instanceof L2SummonInstance)
		{
			L2PcInstance owner = ((L2SummonInstance) attacker).getOwner();
			if (getClanHall().getContestableHall().playerCanParticipate(owner))
				return true;
		}
		if (attacker instanceof L2PetInstance)
		{
			L2PcInstance owner = ((L2PetInstance) attacker).getOwner();
			if (getClanHall().getContestableHall().playerCanParticipate(owner))
				return true;
		}
		if (attacker instanceof L2PcInstance)
		{
			if (getClanHall().getContestableHall().playerCanParticipate((L2PcInstance) attacker))
				return true;
		}
		return false;
	}

 

What? :D

Guest
This topic is now closed to further replies.


×
×
  • Create New...