Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core/SQL] Adds Support for Multiple Mob Pets #6489

Open
wants to merge 1 commit into
base: base
Choose a base branch
from

Conversation

0x05010705
Copy link
Contributor

I affirm:

  • I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
  • I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
  • I have read and understood the Contributing Guide and the Code of Conduct.
  • 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?

Adds Support for Mobs with Multiple Pets through mob_pets and core

  • This allows for multi-pet AI to be handled within core instead of within each lua file where multiple pet behavior was not always properly handled and removes redundant loops from lua files.
  • Updates mob_pets.sql to use a composite key of the Master Mob ID with the Pet Offset and uses an index on the Master Mob ID instead of just a Primary Key on the Master Mob ID.
  • Created linked lists within the pets entities. The pets have links with each other (PPetNext), but always contain a link back to the parent (PMaster).
    • The new pointer is always initialized to a nullptr.
    • Loops are used within the mob_controller that iterates over these linked pets until it reaches this nullptr to control all the associated pets at the same time.

Some of the mobs that summon multiple pets:

  • Jailer of Love
  • Ix'aern DRG
  • Absolute Virtue
  • Pandemonium Warden
  • Odin V2
  • Xzomits
  • Some Escha NMs
  • Some VW NMs
  • etc...

For sake of simplicity, and to show a basic implementation of using multiple pets - I have updated Ix'Aern DRG with some basic logic to summon all 3 of its wynavs with 'Call Wyvern' and, since it uses the ability multiple times, how tracking can be done to re-trigger the ability and show that they are all resummoned and follow the proper pet logic.

NOTE: This is only a slight modification to replace the looping structure that was in place for Ix'aern DRG from before. This is not an accurate re-implementation of the encounter. Someone else is currently working on that with retail capture data and will PR that soon. This is strictly to provide an example usage of this multi-pet support PR.

Steps to test these changes

1 - !zone The Garden of Ru'Hmet
2 - !spawnmob 16921022
3 - !gotoid 16921022
4 - Enage Ix'Aern DRG
Note that all 3 pets are summoned through the Call Wyvern JA

5 - Kite the mob away from its spawn point and then !goto <me> to drop aggro
Note that the pets now follow their master back

6 - Attempt to use the SMN Pull Technique to only aggro Ix'Aern DRG

  • !changejob smn 75
  • Summon Carbuncle and then Assault on Ix'Aern DRG
  • After the mobs are engaged to the pet, Retreat Carbuncle
  • After carbuncle is near you, Release carbuncle
    Note that the pets now detect that the master is still engaged and continue to fight the player.
    Previously, this would allow players to engage Ix'Aern DRG while the pets remained in an idle/roaming state.

7 - Use !hp 0 on 1~2 of the pets
8 - Wait till Ix'Aern DRG attempts to re-use Call Wyvern
Note that the missing pets are re-summoned and engage with whatever the masters current target is.

@0x05010705 0x05010705 force-pushed the Multiple-Pet-Support branch from cf85fa9 to 6cc8336 Compare December 5, 2024 07:03
@zach2good
Copy link
Contributor

Skimmed for 5 seconds, saw a manually managed linked list. If we want to support multiple pets, look at how we manage trusts: a vector. We don't want to introduce more raw pointers to disappearing entities. That's how you get crashes.

@0x05010705
Copy link
Contributor Author

Noted - Will look into refactoring this using a vector.
Am I correct in assuming you are referencing the std::vector<Trust_t*> g_PTrustList ?

@zach2good
Copy link
Contributor

zach2good commented Dec 5, 2024 via email

@0x05010705
Copy link
Contributor Author

0x05010705 commented Dec 6, 2024

Just a follow up on this: Swapped to a vector, but in doing so, ran across some other issues with pets now despawning as soon as they go inactive. This did not happen while using linked lists, so I am guessing I need to play "chase the pointer" for a bit. Working through this and figuring out how best to resolve the issue, but outside of that, everything else seems to be working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants