New Guard and it`s AI.

Find the proper support area, Saga-Version.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
kattoha
Posts: 1
Joined: Sat Jun 15, 2013 12:00 pm

New Guard and it`s AI.

Post 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
xban1x
L2j Veteran
L2j Veteran
Posts: 1228
Joined: Thu Jan 17, 2013 9:46 am

Re: New Guard and it`s AI.

Post by xban1x »

script that extends AbstractNpcAI and has onSeeCreatureEvent ? Much simplier i believe...
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: New Guard and it`s AI.

Post by jurchiks »

L2jserver Gracia Final
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
User avatar
Szponiasty
Advanced User
Advanced User
Posts: 557
Joined: Mon Apr 21, 2008 1:31 pm
Location: Eastern Poland

Re: New Guard and it`s AI.

Post 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()).
And in the next chronicle they went into space, fighting the evil empire... In a galaxy far, far away xD
Post Reply