Thread Tools Display Modes
09-15-19, 12:43 AM   #1
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Any way to get pet position?

Is there any way to get the pet position x/y/z?
I noticed UnitPosition does not work for pets.

I'd like to retrieve this to calculate distance from myself to get an idea of when it will despawn since pets despawn at ~100 yds.
  Reply With Quote
09-15-19, 09:13 AM   #2
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 223
UnitPosition now only works for yourself and party members outside of instances.

Pets aren't dismissed when they despwn so setting a flag when hooking Dismiss Pet, or action from its button(s), and hooking the OnHide of PetActionBar works when checking for despawn.
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote
09-15-19, 10:11 AM   #3
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
There is this function.

https://wow.gamepedia.com/API_UnitDistanceSquared

It might work for you outside of certain areas.
__________________
  Reply With Quote
09-15-19, 02:42 PM   #4
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Originally Posted by Xrystal View Post
There is this function.

https://wow.gamepedia.com/API_UnitDistanceSquared

It might work for you outside of certain areas.
Looks like that doesn't work on the pet unit either. Oh well.

Thanks for the help guys I guess what i'm trying to do is just not possible.
  Reply With Quote
09-17-19, 02:30 AM   #5
Urtgard
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 25
If you just want to know approximately how far away your pet is, you can use IsItemInRange and IsSpellInRange.

That's how LibRangeCheck-2.0 works.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Any way to get pet position?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off