server icon indicating copy to clipboard operation
server copied to clipboard

Monster Follow Pathing

Open jmcmorris opened this issue 1 year ago • 2 comments

I affirm:

  • [x] I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
  • [x] I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
  • [x] I have read and understood the Contributing Guide and the Code of Conduct.
  • [x] I have tested my code and the things my code has changed since the last commit in the PR and will test after any later commits.

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:

  • Slave Globes for Mother Globe
  • Hpemde monster family
  • Lamia No.19 pets (almost any pet really)
  • Apkallu (they runaway from the player)

Steps to test these changes

  • Travel to Mother Globe with !gotoid 17506396 and observe pathing
  • You can kill the slaves out of order with !hp 0 and they will properly adjust which mob they are following
  • You can engage with Mother Globe and the slaves properly path the the character and after the character dies they resume their follow pathing

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 avatar Jun 26 '24 19:06 jmcmorris

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 avatar Jun 26 '24 21:06 jmcmorris

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

jmcmorris avatar Jun 29 '24 16:06 jmcmorris