Page 1 of 2

AI (without quest?)

Posted: Wed Jun 30, 2010 11:37 pm
by Phantom2005
L2J Revision Latest:
L2JDP Revision Latest:

Currently the AI inside data/scripts/ai/individual is only for quests if I'm correct.
This is probably the reason why FleeNpc.java doesn't work at the moment.

Is there some way to create AI for not-quest-mobs?

Re: AI (without quest?)

Posted: Thu Jul 01, 2010 3:02 am
by denser
flee works as i know...when you hit elpy he runs away..

Re: AI (without quest?)

Posted: Thu Jul 01, 2010 9:08 am
by jurchiks
AI has no connection to quests. Check your scripts.cfg

Re: AI (without quest?)

Posted: Thu Jul 01, 2010 9:11 am
by JIV
what you mean? AI is quest based.

Re: AI (without quest?)

Posted: Thu Jul 01, 2010 9:13 am
by jurchiks
Not in that meaning, AI is not controlled by quests, only based on them.

Re: AI (without quest?)

Posted: Thu Jul 01, 2010 2:29 pm
by Phantom2005
Mkay. Well I tried it on several servers and the elpies attack me instead of fleeing away.
Or do I is there some config that has to be changed?

Re: AI (without quest?)

Posted: Thu Jul 01, 2010 4:31 pm
by Raikkon35
I was going to open a new thread, but I take this.

A few days ago, I went around some places of L2. Ol Mahum should speak... but they say nothing.
Elpys don't run out of you...

In ai folder, there is no scripts for these mobs, I remember seeing them somewhere...

Re: AI (without quest?)

Posted: Thu Jul 01, 2010 7:46 pm
by jurchiks
Ol Mahum ai is not implemented, same as many others.
Dunno about the Elpy stuff though, check if the IDs in ai/individual/FleeNpc.java are correct.

Re: AI (without quest?)

Posted: Fri Jul 02, 2010 12:54 am
by Raikkon35
Apparently Elpy okay, it appears in AI script (20432 ID).

It must be that I saw the Ol Mahum in L2jfree...

Greetings!

Re: AI (without quest?)

Posted: Fri Jul 02, 2010 2:51 pm
by Phantom2005
The id's are definitely correct.
I'm spawning the IDs found in FleeNpc.java

They seem to fly when you first attack but after a second they start attacking me.

Re: AI (without quest?)

Posted: Thu Aug 05, 2010 2:06 am
by Raikkon35
Bump.

Elpy still not go away.

Re: AI (without quest?)

Posted: Sat Aug 07, 2010 12:31 am
by Stake
Raikkon35 wrote:Bump.

Elpy still not go away.
This is what's wrong in FleeNpc.java

Code: Select all

		if (npc.getNpcId() >= 18150 && npc.getNpcId() <= 18157)		{			npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition((npc.getX() + Rnd.get(-40, 40)), (npc.getY()+ Rnd.get(-40, 40)), npc.getZ(), npc.getHeading()));			// npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null, null);			return null;		}		else if (npc.getNpcId() == 20432 || npc.getNpcId() == 22228)		{			if (Rnd.get(3) == 2)				npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition((npc.getX() + Rnd.get(-200, 200)), (npc.getY()+ Rnd.get(-200, 200)), npc.getZ(), npc.getHeading()));			// npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null, null);			return null;		}
Lines marked with slash should be deleted (or be marked with slash :P), because npc's in idle state don't move anymore.

P.S.: Gz to the AI maker! :D

Re: AI (without quest?)

Posted: Sat Aug 07, 2010 7:46 am
by LasTravel
Not work for me, elpy don't run!

Re: AI (without quest?)

Posted: Sat Aug 07, 2010 8:53 am
by Gnacik
Problem is different. Intention is changed from _MOVE to _ATTACK :wink:

Re: AI (without quest?)

Posted: Sat Aug 07, 2010 11:46 am
by Stake
Gnacik wrote:Problem is different. Intention is changed from _MOVE to _ATTACK :wink:
Then there shouldn't be this:

Code: Select all

return super.onAttack(npc, attacker, damage, isPet);
only this:

Code: Select all

return null;
However, this will not give any aggro to the npc, so it will not attack back, while thinkActive() is running. :D

If it didn't work, the elpy should be put in the fear state. :)

Tested, and it worked perfectly for me.
L2Character.java:

Code: Select all

Index: java/com/l2jserver/gameserver/model/actor/L2Character.java===================================================================--- java/com/l2jserver/gameserver/model/actor/L2Character.java	(revision 4407)+++ java/com/l2jserver/gameserver/model/actor/L2Character.java	(working copy)@@ -5244,9 +5244,6 @@  				} -                // Notify AI with EVT_ATTACKED-				if (target.hasAI())-					target.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, this);                 getAI().clientStartAutoAttack();                 if (this instanceof L2Summon)                 { 
FleeNpc.java:

Code: Select all

Index: data/scripts/ai/individual/FleeNpc.java===================================================================--- data/scripts/ai/individual/FleeNpc.java	(revision 7664)+++ data/scripts/ai/individual/FleeNpc.java	(working copy)@@ -16,6 +16,7 @@  import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.model.L2CharPosition;+import com.l2jserver.gameserver.model.actor.L2Attackable; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.quest.Quest;@@ -40,20 +41,27 @@ 	@Override 	public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)  	{-		if (npc.getNpcId() >= 18150 && npc.getNpcId() <= 18157)+		if(npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_MOVE_TO) 		{-			npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition((npc.getX() + Rnd.get(-40, 40)), (npc.getY()+ Rnd.get(-40, 40)), npc.getZ(), npc.getHeading()));-			npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null, null);-			return null;+			if(npc.getNpcId() == 20432 || npc.getNpcId() == 22228)+			{+				if(Rnd.get(3) == 2)+				{+					((L2Attackable)npc).reduceHate(null, ((L2Attackable)npc).getHating(((L2Attackable)npc).getMostHated()));+					npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition((npc.getX() + Rnd.get(-200, 200)), (npc.getY()+ Rnd.get(-200, 200)), npc.getZ(), npc.getHeading()));+					return null;+				}+			}+			else if(npc.getNpcId() >= 18150 && npc.getNpcId() <= 18157)+			{+				((L2Attackable)npc).reduceHate(null, ((L2Attackable)npc).getHating(((L2Attackable)npc).getMostHated()));+				npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition((npc.getX() + Rnd.get(-40, 40)), (npc.getY()+ Rnd.get(-40, 40)), npc.getZ(), npc.getHeading()));+				return null;+			}+			return super.onAttack(npc, attacker, damage, isPet); 		}-		else if (npc.getNpcId() == 20432 || npc.getNpcId() == 22228)-		{-			if (Rnd.get(3) == 2)-				npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition((npc.getX() + Rnd.get(-200, 200)), (npc.getY()+ Rnd.get(-200, 200)), npc.getZ(), npc.getHeading()));-			npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null, null);+		else 			return null;-		}-		return super.onAttack(npc, attacker, damage, isPet); 	}  	// Register the new Script at the Script System