Jump to content

How Can I Find Game Object Distance?


Marleyjones

Recommended Posts

I know how to find distance in the sense of 

if (ObjectManager.Me.Position.DistanceTo2D(new Vector3(1006.06f, -6288.57f, 98.98875f)) > 30)

How can I check for the distance of a game object using an ID? I found the ID's by dumping it with the quest tools like I would for a gather quest. I even noticed that it shows the distance when it dumps all of them.

Doodad_VR_Elevator_Lift02: 190118 (1680.11 ; -5824.42 ; -72.76543 ; "None", 87.21676y)
Doodad_VR_Elevator_Gate01: 186452 (1680.11 ; -5824.42 ; 161.518 ; "None", 150.929y)
Doodad_VR_Elevator_Pulley01: 190119 (1680.11 ; -5824.42 ; 396.1238 ; "None", 384.6783y)
Zeppelin, Horde (Cloudkisser): 181689 (1997.203 ; -6089.13 ; 85.60023 ; "None", 399.3795y)
Doodad_VR_Elevator_Lift02: 190118 (951.884 ; -6071.91 ; -50.43643 ; "None", 781.5993y)
Doodad_VR_Elevator_Gate01: 186452 (951.884 ; -6071.91 ; 183.847 ; "None", 797.8301y)
Doodad_VR_Elevator_Pulley01: 190119 (951.884 ; -6071.91 ; 418.4529 ; "None", 878.7535y)

 

 

This is about all I was able to come across after searching rigorously and I can't seem to figure out how to make it work correctly.

wManager.Wow.ObjectManager.WoWObject.GetDistance(186452) < 75;

 

If anyone has any input I would be beyond grateful. This forum has been amazing to me so far thanks guys.

Link to comment
Share on other sites

3 hours ago, ad3t0 said:

I know how to find distance in the sense of 


if (ObjectManager.Me.Position.DistanceTo2D(new Vector3(1006.06f, -6288.57f, 98.98875f)) > 30)

How can I check for the distance of a game object using an ID? I found the ID's by dumping it with the quest tools like I would for a gather quest. I even noticed that it shows the distance when it dumps all of them.


Doodad_VR_Elevator_Lift02: 190118 (1680.11 ; -5824.42 ; -72.76543 ; "None", 87.21676y)
Doodad_VR_Elevator_Gate01: 186452 (1680.11 ; -5824.42 ; 161.518 ; "None", 150.929y)
Doodad_VR_Elevator_Pulley01: 190119 (1680.11 ; -5824.42 ; 396.1238 ; "None", 384.6783y)
Zeppelin, Horde (Cloudkisser): 181689 (1997.203 ; -6089.13 ; 85.60023 ; "None", 399.3795y)
Doodad_VR_Elevator_Lift02: 190118 (951.884 ; -6071.91 ; -50.43643 ; "None", 781.5993y)
Doodad_VR_Elevator_Gate01: 186452 (951.884 ; -6071.91 ; 183.847 ; "None", 797.8301y)
Doodad_VR_Elevator_Pulley01: 190119 (951.884 ; -6071.91 ; 418.4529 ; "None", 878.7535y)

 

 

This is about all I was able to come across after searching rigorously and I can't seem to figure out how to make it work correctly.


wManager.Wow.ObjectManager.WoWObject.GetDistance(186452) < 75;

 

If anyone has any input I would be beyond grateful. This forum has been amazing to me so far thanks guys.

It depend at what kind ID you want to use. If you want to use the mob id this could be something for you.
 

ObjectManager.GetWoWGameObjectByyId(1234).FirstOrDefault()?.GetDistance < 75

 

Link to comment
Share on other sites

Cool thank you! I haven't tried it yet but I will when I get home. 

 

Edit: Dang I couldn't get it to work I tried

if (ObjectManager.GetWoWGameObjectByyId(190118).FirstOrDefault()?.GetDistance < 75)
{
	wManager.Wow.Bot.Tasks.GoToTask.ToPosition(new Vector3(1006.06f, -6288.57f, 98.98875f));
}

and I get errors. Thanks so much for any help.

Link to comment
Share on other sites

23 hours ago, ad3t0 said:

Cool thank you! I haven't tried it yet but I will when I get home. 

 

Edit: Dang I couldn't get it to work I tried


if (ObjectManager.GetWoWGameObjectByyId(190118).FirstOrDefault()?.GetDistance < 75)
{
	wManager.Wow.Bot.Tasks.GoToTask.ToPosition(new Vector3(1006.06f, -6288.57f, 98.98875f));
}

and I get errors. Thanks so much for any help.

I bet you get a null exception

 

// Do we need to move?
if (ObjectManager.GetWoWGameObjectByyId(190118).FirstOrDefault()?.GetDistance < 75 ?? false)
{
    // Move
    wManager.Wow.Bot.Tasks.GoToTask.ToPosition(new Vector3(1006.06f, -6288.57f, 98.98875f));
}

This should remove the error if i'm not wrong.

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...