Jump to content

I'm looking for Distance of target


Recommended Posts


It's me agin, I'm doing some quest profile and i've got an issue At Redridge Mountains.

For the quest where I need to control an Ettin called "Saving Foreman Oslow".

As i've to do 2 task : UseItemOn and FollowPath i can't use the predifined class to do it.

So, I've add Some line of code.


1. RunMacroLua > /tar Canyon Ettin

2. IF > ObjectManager.Target.Entry == 43094 && ObjectManager.Target.IsValid && ObjectManager.Target.IsAlive

3. RunCode > ItemsManager.UseItem(58895);

4. endIf >


That works but I need to get closer to the target and as is write here that doesn't check the distance of target.

if you can help me to find a solution.

I need something like that : ObjectManager.Target.Distance <= 5

if Object.Manager.Target.Distance > 5 : Move to target or Attack Him


Link to comment
Share on other sites

I have finaly found how to check the distance of target with lua.

But i need one more data to be sure to go to the next step.

When I use item on the Ettin, he dissapear and a new one appear and this one is friendly.

So, how can i detect is this unit exist ?

Link to comment
Share on other sites

Distance check:


Unit check:

if (ObjectManager.GetWoWUnitHostile().Where(u => u.Entry == 12345).Any())
     // Do something

You can easy extent the conditions for example "&& u.Distance < 40" ect.

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