Page 1 of 1

New Guard and it`s AI.

Posted: Sat Jun 15, 2013 1:43 pm
by kattoha
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision 6055:
L2JDP Revision 9794:
Hello All. I try to create new leveled Guard, which will be kill all players upper > 40 lvl.
I created 2 new classes like a L2GuardInstance and GuardKnownList and created new "type" in DB (GuardLvl). I tried to create my own classes and I tried copy existing L2GuardInstance and GuardKnownList, just renamed some fields.
When My self-created Guard was in AI_INTENTION_ACTIVE, he never attacked target, but copied Guard from L2GuardInstance allways was in AI_INTENTION_IDLE.

Code: Select all

if (object instanceof L2PcInstance) {            // Check if the object added is a L2PcInstance that owns Karma            L2PcInstance player = (L2PcInstance) object;             if ((player.getKarma() > 0)|| (player.getLevel()>40))                        {                if (Config.DEBUG)                    _log.fine(getActiveChar().getObjectId() + ": PK "                            + player.getObjectId() + " entered scan range");                 // Set the L2GuardInstance Intention to AI_INTENTION_ACTIVE                if (getActiveChar().getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)                    getActiveChar().getAI().setIntention(                            CtrlIntention.AI_INTENTION_ACTIVE, null);
I tried to edit default guard "L2GuardInstance and GuardKnownList" to insert into GuardKnownList (player.getLevel()>40) instead (player.getKarma() > 0), but Guards continued kill PK and don`t want kill level 40+.
Where I can edit it`s real knownlist

Help me to find my mistakes.

P.S. Sorry for my English ;)

L2jserver Gracia Final

Re: New Guard and it`s AI.

Posted: Sat Jun 15, 2013 2:08 pm
by xban1x
script that extends AbstractNpcAI and has onSeeCreatureEvent ? Much simplier i believe...

Re: New Guard and it`s AI.

Posted: Sat Jun 15, 2013 2:13 pm
by jurchiks
L2jserver Gracia Final

Re: New Guard and it`s AI.

Posted: Fri Jul 05, 2013 1:12 pm
by Szponiasty
I don't know how it's in Gracia Final core. In newer chronicles, you need to add new rule to "public boolean autoAttackCondition(L2Character target)" in L2AttackableAI.java. There you have rules, to determine if Ai should auto attack scanned target. What you did (in knownlist) is activating AI if player of lvl>40 is around (thats good, but you need also to modify mentioned autoAttackCondition()).