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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...