Jump to content

Target pet when moving towards him


Recommended Posts

I'm trying to write custom plugin that will target a battle pet way before bot reaches it (due to Rematch addon pet swap).

TIMESTAMP - [FightPetBattle] Player XXX (lvl 1)
[N] TIMESTAMP - [Path-Finding] GetZPosition: YYY
[N] TIMESTAMP - [Path-Finding] GetZPosition result: Z
[N] TIMESTAMP - [Path-Finding] FindPath from YYY to ZZZ
[N] TIMESTAMP - [Path-Finding] Path Count: 2 (49,30226y)

Sadly there is no event that I'm aware of that I can use to get target to which path is being generated, nor retrieve a target to whom I'm trying to generate path when using event "wManager.Events.OthersEvents.OnPathFinderFindPath/OnPathFinderFindPathResult".

Link to comment
Share on other sites

I have managed to workaround this:


wManager.Events.OthersEvents.OnPathFinderFindPathResult += RematcherEventHandler;

private void RematcherEventHandler(Vector3 @from, Vector3 to, List<Vector3> path, string continentnamempq, bool resultsuccess)
    // Put some checks as you want them to avoid too many checks.
    var nearbyPet = ObjectManager.GetNearestWoWUnit(ObjectManager.GetWoWUnitWildPets(), to);

    if (nearbyPet != null && ObjectManager.Target.Guid != nearbyPet.Guid)
        Logging.Write("[Rematcher] Changing target: " + nearbyPet.Name);
        Lua.LuaDoString("local rematch = Rematch; rematch: LoadTeam(\"" + nearbyPet.Name + "\")");

Not ideal when 2 different as in same spot and are moving, but does the trick.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...