LandSandBoat / server

:sailboat: LandSandBoat - a server emulator for Final Fantasy XI
https://landsandboat.github.io/server/
GNU General Public License v3.0
294 stars 589 forks source link

Monster Follow Pathing #5967

Closed jmcmorris closed 2 months ago

jmcmorris commented 3 months ago

I affirm:

What does this pull request do?

This is old code I wrote for Eden about 5 years ago. It adds a simple method for monsters to follow some target.

mob:follow(target, xi.follow.ROAM)

This is useful for many monsters such as:

Steps to test these changes

Additional steps taken from #3629

  1. Go to Al'taieu.
  2. Kill a baby Ul'xzomit and respawn it. Observe it automatically re-attaches.
  3. Kill a mother Ul'xzomit. Observe the baby Ul'xzomits start roaming by themselves.
  4. Kill a baby Ul'xzomit and respawn it. Observe it starts roaming by itself.
  5. Respawn the mother Ul'xzomit. Observe the babies start following it again.
  6. Fight a mother Ul'xzomit. Kill a baby Ul'xzomit and respawn it. Observe the baby only links when it gets close.
  7. Kill an Ul'xzomit and let it respawn normally. Observe its respawn time is now 5.5 minutes.
jmcmorris commented 3 months ago

Turns out there is already some logic for following inside https://github.com/LandSandBoat/server/blob/base/scripts/globals/follow.lua

I think it might make the most sense to combine these two since there is some nice logic for handling multiple followers (like we need to with Mother Globe) but it is also missing some functionality such as the runaway. I'm not positive the existing logic works with mobs following players/npcs either but this new follow logic does.

jmcmorris commented 3 months ago

I have made an additional commit to the initial two that reworks the original follow logic: https://github.com/LandSandBoat/server/pull/5967/commits/95886fbd6ddad0c8081d0d3690ba5847c1fda0b2