xRelic

L2JFrozen 1132 movement stuck mobs

Jul 9th, 2021
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. L2AttackableAi.java
  2. ----------------------------------------
  3. if (hated.isMoving())
  4. {
  5. - range -= 100;
  6. - }
  7.  
  8. - if (range < 5)
  9. - range = 5;
  10. range -= 30;
  11. }
  12. + if (!GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), attackTarget.getX(), attackTarget.getY(), attackTarget.getZ()))
  13. + moveTo(attackTarget.getX(), attackTarget.getY(), attackTarget.getZ());
  14. + else
  15. + moveToPawn(attackTarget, Math.max(range, 5));
  16.  
  17. - moveToPawn(attackTarget, range);
  18. return;
  19. }
  20.  
  21. ---------------------------------
  22. L2Character.java
  23. ---------------------------------
  24.  
  25. newMd.geoPath = GeoEngine.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, this instanceof L2Playable);
  26. if (newMd.geoPath == null || newMd.geoPath.size() < 2)
  27. {
  28. - // No path found
  29. - // Even though there's no path found (remember geonodes aren't perfect), the mob is attacking and right now we set it so that the mob will go after target anyway, is dz is small enough.
  30. - // With cellpathfinding this approach could be changed but would require taking off the geonodes and some more checks.
  31. - // Summons will follow their masters no matter what.
  32. - // Currently minions also must move freely since L2AttackableAI commands them to move along with their leader
  33. - if (this instanceof L2PcInstance || (!(this instanceof L2Playable) && !isMinion() && Math.abs(z - curZ) > 140) || (this instanceof L2Summon && !((L2Summon) this).getFollowStatus()))
  34. - return;
  35. -
  36. - newMd.disregardingGeodata = true;
  37. - x = originalX;
  38. - y = originalY;
  39. - z = originalZ;
  40. - distance = originalDistance;
  41. + if (!GeoEngine.getInstance().canMoveToTarget(curX, curY, curZ, x, y, z))
  42. + {
  43. + Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z);
  44. + x = destiny.getX();
  45. + y = destiny.getY();
  46. + z = destiny.getZ();
  47. + }
  48. }
  49. else
  50. {
  51. @@ -3499,6 +3493,13 @@
  52. }
  53. }
  54. }
  55. + else if (!GeoEngine.getInstance().canMoveToTarget(curX, curY, curZ, x, y, z))
  56. + {
  57. + Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z);
  58. + x = destiny.getX();
  59. + y = destiny.getY();
  60. + z = destiny.getZ();
  61. + }
  62.  
  63. ------------------------------------------------------
  64. AbstractAI.java
  65. ------------------------------------------------------
  66.  
  67. - if (!_actor.isInsideRadius(follow, _range, true, false))
  68. - {
  69. - moveToPawn(follow, _range);
  70. - }
  71.  
  72. + if (!_actor.isInsideRadius(follow, _range, true, false))
  73. + {
  74. + if(GeoEngine.getInstance().canMoveFromToTarget(_actor.getX(), _actor.getY(), _actor.getZ(),follow.getX(), follow.getY(), follow.getZ()))
  75. + moveToPawn(follow, _range);
  76. + else
  77. + moveTo(follow.getX(), follow.getY(), follow.getZ());
  78. + }
  79.  
Advertisement
Add Comment
Please, Sign In to add comment