Page 1 of 1

Killable NPC

Posted: Tue Jan 25, 2011 5:15 pm
by xrs
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:4487
L2JDP Revision Number:7760
I'm trying to make NPC Flag wich you can capture by killing it. Capturing works fine. If you kill the flag it becomes your factions flag. But... problem is that the flag is imortal. Only way to kill it is by //kill.
I added this code to L2TpFlaginstance.java:

Code: Select all

@Override    public void reduceCurrentHp(double damage, L2Character attacker, L2Skill skill)    {        L2PcInstance plajor = null;        boolean cord = false;        if (attacker instanceof L2PcInstance)            plajor = (L2PcInstance) attacker;        else if (attacker instanceof L2SummonInstance)            plajor = ((L2SummonInstance) attacker).getOwner();                    if (/*plajor.inWorld() == 1 && */plajor.getFactionId() != getFlagFactionId())            cord = true;                    if (cord)            super.reduceCurrentHp(damage, attacker, skill);    }
But that doesnt seem to do anything. HP of the flag is not decreasing when I hit it.
How can I make it mortal?

Re: Killable NPC

Posted: Wed Jan 26, 2011 10:18 am
by xrs
Come on, give me atleast some ideas what might be wrong. I was going through the code for hours and I cant figure out whats wrong. What actually defines if it is killable or not?

Re: Killable NPC

Posted: Wed Jan 26, 2011 12:21 pm
by Nik
npc.setIsInvul(false);

or just create new instance of L2Npc that overrides this method

Code: Select all

    @Override    public boolean isAttackable()    {        return true;    }

Re: Killable NPC

Posted: Wed Jan 26, 2011 12:57 pm
by xrs

Code: Select all

    @Override    public boolean isAttackable()    {        return true;    }
Is allready in L2TpFlafInstance.java

Also changed it in L2NPC.java and in L2Atackable.java to return true. And nothing. NPC is still imortal.

Re: Killable NPC

Posted: Wed Jan 26, 2011 1:21 pm
by Nik
add setIsInvul(false); at the initiation of the class

Re: Killable NPC

Posted: Wed Jan 26, 2011 6:11 pm
by xrs
Problem solved.