Jump to content
  • 0

[HELP]Anti Pk Guard for avoiding hitting players from aoe.


Question

Posted

Hello MxC i have this code and i tried to test it ingame.While compiling had no problem at all but my npc doesnt seems to work.Any ideas?

 

L2AttackableAI.java

 

// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event

 

if (target instanceof L2PcInstance && ((L2PcInstance) target).getKarma() > 0) super.onIntentionAttack(target);

else if(!(getActiveChar() instanceof L2GuardInstance)||getActiveChar() instanceof L2GuardInstance && getActiveChar().getNpcId()!= Config.ANTI_PK_NPC)

{

super.onIntentionAttack(target);

}

else if(target instanceof L2PcInstance && ((L2PcInstance) target).getKarma() == 0)

{

getActiveChar().clearAggroList();

}

}

 

 

config.java

    public static int ANTI_PK_NPC;

 

 

    ANTI_PK_NPC = Integer.parseInt(L2JModSettings.getProperty("AntiPkNpc", "36606"));

 

 

l2jmods.properties

 

# ---------------------------------------------------------------------------

# Anti PK NPC

# ---------------------------------------------------------------------------

# Put the ID of Anti-PK NPC, he will attack only PKs

# Default: 36606

AntiPkNpc = 36606

 

Do you see any error on this code?I tried to modify it and such but no chance by the moment.

3 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..