Jump to content

Recommended Posts

Posted

one more smile code i make l2jroboto eflocrash code the fake players play pvp..

but the problem is for have all time pvp you need make a zone with respawn teleport like primeval isle

i think you like it.

enjoy

com/elfocrash/roboto/ai/FakePlayerAI.java

find this

-	protected void tryTargetRandomCreatureByTypeInRadius(Class<? extends Creature> creatureClass, int radius)
-	{
-		if(_fakePlayer.getTarget() == null) {
-			List<Creature> targets = _fakePlayer.getKnownTypeInRadius(creatureClass, radius).stream().filter(x->!x.isDead()).collect(Collectors.toList());
-			if(!targets.isEmpty()) {
-				Creature target = targets.get(Rnd.get(0, targets.size() -1 ));
-				_fakePlayer.setTarget(target);				
-			}
-		}else {
-			if(((Creature)_fakePlayer.getTarget()).isDead())
-			_fakePlayer.setTarget(null);
-		}	
-	}

change wtih this
+  protected void tryTargetRandomCreatureByTypeInRadius(Class<? extends L2Character> creatureClass, int radius)
+	{
+		if (_fakePlayer.getTarget() == null)
+		{
+			if(_fakePlayer.isInsideZone(ZoneId.PEACE) || _fakePlayer.isInsideZone(ZoneId.TOWN))
+				return;
+			
+			List<L2Character> targets = _fakePlayer.getKnownTypeInRadius(creatureClass, radius).stream().filter(x -> !x.isDead()).collect(Collectors.toList());
+			if (!targets.isEmpty())
+			{
+				L2Character target = targets.get(Rnd.get(0, targets.size() - 1));
+				
+				if (_fakePlayer.getPvpFlag() == 0 && target.getActingPlayer().getPvpFlag() == 0 || _fakePlayer.getPvpFlag() != 0 && target.getActingPlayer().getPvpFlag() == 0 || _fakePlayer.getPvpFlag() == 0 && target.getActingPlayer().getPvpFlag() != 0 || _fakePlayer.getPvpFlag() != 0 && target.getActingPlayer().getPvpFlag() != 0)
+					_fakePlayer.setTarget(target);
+				
+				else if (_fakePlayer.getKarma() > 0 && target.getActingPlayer().getKarma() == 0 || _fakePlayer.getPvpFlag() == 0 && target.getActingPlayer().getKarma() > 0 || _fakePlayer.getPvpFlag() > 0 && target.getActingPlayer().getKarma() > 0)
+					_fakePlayer.setTarget(target);
+				
+			}
+		}
+		else
+		{
+			if (((L2Character) _fakePlayer.getTarget()).isDead())
+				_fakePlayer.setTarget(null);
+		}
+	}

and from all class name AI with name this *** public void thinkAndAct() ***

find all this

-	tryTargetRandomCreatureByTypeInRadius(FakeHelpers.getTestTargetClass(), FakeHelpers.getTestTargetRange());

and change with this

+		if (_fakePlayer.getKnownTypeInRadius(FakePlayer.class, FakeHelpers.getTestTargetRange()) != null)
+		{
+			tryTargetRandomCreatureByTypeInRadius(FakeHelpers.getTargetPvPClass(), FakeHelpers.getTestTargetRange());
+		}
+		
+		else if (_fakePlayer.getKnownTypeInRadius(Monster.class, FakeHelpers.getTestTargetRange()) != null)
+		{
+			tryTargetRandomCreatureByTypeInRadius(FakeHelpers.getTargetMobClass(), FakeHelpers.getTestTargetRange());
+		}

on FakeHelpers.java
after this
	public static Class<? extends L2Character> getTargetMobClass()
	{
		return Monster.class;
	}

put this
	
+	//target fakeplayers instance only...
+	public static Class<? extends L2Character> getTargetPvPClass()
+	{
+		return FakePlayer.class;
+	}

if any have problem post error only... tnx.

 

Posted (edited)

You just need to make a check function so that the fake player may know who is the enemy, this is my code based on L2J Server

 

	protected boolean checkTargetThreat(L2Character target)
	{
		if (target == null)
		{
			return false;
		}
		if (target.isDead() || target.isInvisible() || (_fakePlayer.getLeader() == target))
		{
			return false;
		}
		if (target.isPlayable() && (target.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_SUMMON_FRIEND)))
		{
			return false;
		}
		if (target.isPlayer())
		{
			L2PcInstance player = (L2PcInstance) target;
			if (player.isFake() && _fakePlayer.isSameSide((FakePlayer) player))
			{
				return false;
			}
			if ((player.getKarma() > 0) || (player.getPvpFlag() > 0))
			{
				return true;
			}
			if ((player.isInsideZone(ZoneId.PVP) && (player.getActiveWeaponInstance() != null)) || player.isInsideZone(ZoneId.SIEGE))
			{
				return true;
			}
		}
		else if (target.isSummon())
		{
			L2Summon summon = (L2Summon) target;
			if ((summon.getKarma() > 0) || (summon.getPvpFlag() > 0))
			{
				return true;
			}
			if (summon.isInsideZone(ZoneId.PVP) || summon.isInsideZone(ZoneId.SIEGE))
			{
				return true;
			}
		}
		else if (target.isAttackable())
		{
			if (!target.isTargetable())
			{
				return false;
			}
			if (target.isRaid() && ((target.getLevel() + 8) < _fakePlayer.getLevel()))
			{
				return false;
			}
			if (target.isNpc() && ((((L2Npc) target).getId() == 2502) || (((L2Npc) target).getId() == 2503)))
			{
				return false;
			}
			if (target.isMonster())
			{
				return true;
			}
			if (target.getTarget() == _fakePlayer)
			{
				return true;
			}
			if ((target.getTarget() != null) && target.getTarget().isPlayer())
			{
				if (((L2PcInstance) target.getTarget()).isInPartyWith(_fakePlayer))
				{
					return true;
				}
			}
		}
		return false;
	}

 

 

 

 

Edited by ShinichiYao
Posted
On 9/12/2018 at 6:43 PM, tazerman2 said:

one more smile code i make l2jroboto eflocrash code the fake players play pvp..

but the problem is for have all time pvp you need make a zone with respawn teleport like primeval isle

i think you like it.

enjoy 


com/elfocrash/roboto/ai/FakePlayerAI.java

find this

-	protected void tryTargetRandomCreatureByTypeInRadius(Class<? extends Creature> creatureClass, int radius)
-	{
-		if(_fakePlayer.getTarget() == null) {
-			List<Creature> targets = _fakePlayer.getKnownTypeInRadius(creatureClass, radius).stream().filter(x->!x.isDead()).collect(Collectors.toList());
-			if(!targets.isEmpty()) {
-				Creature target = targets.get(Rnd.get(0, targets.size() -1 ));
-				_fakePlayer.setTarget(target);				
-			}
-		}else {
-			if(((Creature)_fakePlayer.getTarget()).isDead())
-			_fakePlayer.setTarget(null);
-		}	
-	}

change wtih this
+  protected void tryTargetRandomCreatureByTypeInRadius(Class<? extends L2Character> creatureClass, int radius)
+	{
+		if (_fakePlayer.getTarget() == null)
+		{
+			if(_fakePlayer.isInsideZone(ZoneId.PEACE) || _fakePlayer.isInsideZone(ZoneId.TOWN))
+				return;
+			
+			List<L2Character> targets = _fakePlayer.getKnownTypeInRadius(creatureClass, radius).stream().filter(x -> !x.isDead()).collect(Collectors.toList());
+			if (!targets.isEmpty())
+			{
+				L2Character target = targets.get(Rnd.get(0, targets.size() - 1));
+				
+				if (_fakePlayer.getPvpFlag() == 0 && target.getActingPlayer().getPvpFlag() == 0 || _fakePlayer.getPvpFlag() != 0 && target.getActingPlayer().getPvpFlag() == 0 || _fakePlayer.getPvpFlag() == 0 && target.getActingPlayer().getPvpFlag() != 0 || _fakePlayer.getPvpFlag() != 0 && target.getActingPlayer().getPvpFlag() != 0)
+					_fakePlayer.setTarget(target);
+				
+				else if (_fakePlayer.getKarma() > 0 && target.getActingPlayer().getKarma() == 0 || _fakePlayer.getPvpFlag() == 0 && target.getActingPlayer().getKarma() > 0 || _fakePlayer.getPvpFlag() > 0 && target.getActingPlayer().getKarma() > 0)
+					_fakePlayer.setTarget(target);
+				
+			}
+		}
+		else
+		{
+			if (((L2Character) _fakePlayer.getTarget()).isDead())
+				_fakePlayer.setTarget(null);
+		}
+	}

and from all class name AI with name this *** public void thinkAndAct() ***

find all this

-	tryTargetRandomCreatureByTypeInRadius(FakeHelpers.getTestTargetClass(), FakeHelpers.getTestTargetRange());

and change with this

+		if (_fakePlayer.getKnownTypeInRadius(FakePlayer.class, FakeHelpers.getTestTargetRange()) != null)
+		{
+			tryTargetRandomCreatureByTypeInRadius(FakeHelpers.getTargetPvPClass(), FakeHelpers.getTestTargetRange());
+		}
+		
+		else if (_fakePlayer.getKnownTypeInRadius(Monster.class, FakeHelpers.getTestTargetRange()) != null)
+		{
+			tryTargetRandomCreatureByTypeInRadius(FakeHelpers.getTargetMobClass(), FakeHelpers.getTestTargetRange());
+		}

on FakeHelpers.java
after this
	public static Class<? extends L2Character> getTargetMobClass()
	{
		return Monster.class;
	}

put this
	
+	//target fakeplayers instance only...
+	public static Class<? extends L2Character> getTargetPvPClass()
+	{
+		return FakePlayer.class;
+	}

if any have problem post error only... tnx.

 

 

 

organization the topic is missing the import

floods prevent
Posted
On 13/09/2018 at 01:26, ShinichiYao said:

Você só precisa fazer uma função de verificação para que o jogador falso saiba quem é o inimigo, este é o meu código baseado no servidor L2J.

 


 

 

 

 

Is this code you quoted going on FakePlayerAI.java?
Can you cite some reference line?

 

On 12/09/2018 at 18:43, tazerman2 said:

mais um código de sorriso eu faço código de eflocrash l2jroboto os jogadores falsos jogar pvp ..

mas o problema é ter todo o tempo pvp você precisa fazer uma zona com respawn teleport como a ilha primeva

eu acho que você gosta.

apreciar




   
	
		   
			
			 
				  
				
			
		 
			

			
	

     
	
		   
		
			 
				
			
			 
			 
			
  
				
				                        

				
				                   

				
			
		
		
		
			 

		
	

     


 

 

		    
		
 
		
		
		     
		
 
		

	   
	
		 
	

	
	
	   
	
		 
	

 

I'm having trouble implementing your code, I did not understand this, if you can help me I'll be grateful.

and from all class name AI with name this *** public void thinkAndAct() ***

find all this

-	tryTargetRandomCreatureByTypeInRadius(FakeHelpers.getTestTargetClass(), FakeHelpers.getTestTargetRange());

and change with this

+		if (_fakePlayer.getKnownTypeInRadius(FakePlayer.class, FakeHelpers.getTestTargetRange()) != null)
+		{
+			tryTargetRandomCreatureByTypeInRadius(FakeHelpers.getTargetPvPClass(), FakeHelpers.getTestTargetRange());
+		}
+		
+		else if (_fakePlayer.getKnownTypeInRadius(Monster.class, FakeHelpers.getTestTargetRange()) != null)
+		{
+			tryTargetRandomCreatureByTypeInRadius(FakeHelpers.getTargetMobClass(), FakeHelpers.getTestTargetRange());
+		}
  • 2 weeks later...
Posted

Yes it in FakePlayerAI.java

 

And you can get enemies like this

List<L2Character> targets = _fakePlayer.getKnownList().getKnownCharactersInRadius(radius).stream().filter(x -> (checkTargetThreat(x) && GeoData.getInstance().canSeeTarget(_fakePlayer, x))).collect(Collectors.toList());

 

  • Like 1
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...