Killable NPC

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
xrs
Posts: 25
Joined: Thu Sep 24, 2009 11:05 am
Contact:

Killable NPC

Post 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?
xrs
Posts: 25
Joined: Thu Sep 24, 2009 11:05 am
Contact:

Re: Killable NPC

Post 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?
Nik
L2j Veteran
L2j Veteran
Posts: 629
Joined: Fri Apr 18, 2008 9:09 pm

Re: Killable NPC

Post 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;    }
Playing a game where you know how every single mechanism works is quite satisfying.
Its the main perk that a gamer-developer has :D
xrs
Posts: 25
Joined: Thu Sep 24, 2009 11:05 am
Contact:

Re: Killable NPC

Post 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.
Nik
L2j Veteran
L2j Veteran
Posts: 629
Joined: Fri Apr 18, 2008 9:09 pm

Re: Killable NPC

Post by Nik »

add setIsInvul(false); at the initiation of the class
Playing a game where you know how every single mechanism works is quite satisfying.
Its the main perk that a gamer-developer has :D
xrs
Posts: 25
Joined: Thu Sep 24, 2009 11:05 am
Contact:

Re: Killable NPC

Post by xrs »

Problem solved.
Post Reply