AI (without quest?)

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
Phantom2005
Posts: 72
Joined: Wed Jul 06, 2005 4:27 pm
Location: Netherlands

AI (without quest?)

Post 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?
"If 64 bits isn't enough, the next logical step is 128 bits. That's enough to survive Moore's Law until I'm dead, and after that, it's not my problem."
©Jeff Bonwick
User avatar
denser
Posts: 1392
Joined: Wed May 30, 2007 9:13 pm
Location: Russia
Contact:

Re: AI (without quest?)

Post by denser »

flee works as i know...when you hit elpy he runs away..
Tiger, once tasted human flesh, will want to taste it again
L2J - the place where glad to see you any time!
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: AI (without quest?)

Post by jurchiks »

AI has no connection to quests. Check your scripts.cfg
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
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: AI (without quest?)

Post by JIV »

what you mean? AI is quest based.
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: AI (without quest?)

Post by jurchiks »

Not in that meaning, AI is not controlled by quests, only based on them.
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.
Phantom2005
Posts: 72
Joined: Wed Jul 06, 2005 4:27 pm
Location: Netherlands

Re: AI (without quest?)

Post 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?
"If 64 bits isn't enough, the next logical step is 128 bits. That's enough to survive Moore's Law until I'm dead, and after that, it's not my problem."
©Jeff Bonwick
User avatar
Raikkon35
Posts: 178
Joined: Sat Mar 08, 2008 2:54 pm

Re: AI (without quest?)

Post 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...
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: AI (without quest?)

Post 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.
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
Raikkon35
Posts: 178
Joined: Sat Mar 08, 2008 2:54 pm

Re: AI (without quest?)

Post by Raikkon35 »

Apparently Elpy okay, it appears in AI script (20432 ID).

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

Greetings!
Phantom2005
Posts: 72
Joined: Wed Jul 06, 2005 4:27 pm
Location: Netherlands

Re: AI (without quest?)

Post 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.
"If 64 bits isn't enough, the next logical step is 128 bits. That's enough to survive Moore's Law until I'm dead, and after that, it's not my problem."
©Jeff Bonwick
User avatar
Raikkon35
Posts: 178
Joined: Sat Mar 08, 2008 2:54 pm

Re: AI (without quest?)

Post by Raikkon35 »

Bump.

Elpy still not go away.
User avatar
Stake
Posts: 383
Joined: Sun Mar 23, 2008 9:33 pm
Location: Hungary
Contact:

Re: AI (without quest?)

Post 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
Image
Image
User avatar
LasTravel
Posts: 888
Joined: Tue Jan 05, 2010 12:08 am
Location: Spain

Re: AI (without quest?)

Post by LasTravel »

Not work for me, elpy don't run!
User avatar
Gnacik
L2j Veteran
L2j Veteran
Posts: 925
Joined: Tue Dec 16, 2008 3:49 pm
Location: Wąchock ٩(̾●̮̮̃̾•̃̾)۶ Polska
Contact:

Re: AI (without quest?)

Post by Gnacik »

Problem is different. Intention is changed from _MOVE to _ATTACK :wink:
User avatar
Stake
Posts: 383
Joined: Sun Mar 23, 2008 9:33 pm
Location: Hungary
Contact:

Re: AI (without quest?)

Post 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 
Last edited by Stake on Sat Aug 07, 2010 2:14 pm, edited 4 times in total.
Image
Image
Post Reply