Jump to content

Change Targets


Drwolftech

Recommended Posts

2 hours ago, Drwolftech said:

How do i make the fight class change targets? 

Like, get the nearest target or get the target with lowest health.

XML: no clue

C#:

            // Get unit in range and lowest health
            float distance = 10;
            WoWUnit unit = ObjectManager.GetWoWUnitHostile().OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= distance);

            // Any unit?
            if (unit != null && unit.IsValid)
            {
                // Interact
                Interact.InteractGameObject(unit.GetBaseAddress);
            }

This will target and interact with a target that is in range of 10 and has the lowest health. (untestet)

Link to comment
Share on other sites

On 09/09/2016 at 6:39 PM, iMod said:

XML: no clue

C#:


            // Get unit in range and lowest health
            float distance = 10;
            WoWUnit unit = ObjectManager.GetWoWUnitHostile().OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= distance);

            // Any unit?
            if (unit != null && unit.IsValid)
            {
                // Interact
                Interact.InteractGameObject(unit.GetBaseAddress);
            }

This will target and interact with a target that is in range of 10 and has the lowest health. (untestet)

Would be Nice if @Droidz incorporate this into the fight class editor ^^

Link to comment
Share on other sites

You can launch it is xml fightclass,

Add conditon "C Sharp code" like:

ObjectManager.GetWoWUnitHostile().OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= 10) != null

And in instead of spell name, put 

 // Get unit in range and lowest health
            float distance = 10;
            WoWUnit unit = ObjectManager.GetWoWUnitHostile().OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= distance);

            // Any unit?
            if (unit != null && unit.IsValid)
            {
                // Interact
                Interact.InteractGameObject(unit.GetBaseAddress);
            }

and activate spell setting 'No spell, is C# code'.

Edited by Droidz
replace "ObjectManager.GetWoWUnitHostile().OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= distance) != null" by "ObjectManager.GetWoWUnitHostile().OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= 10) != null"
Link to comment
Share on other sites

I have edited my last post: http://wrobot.eu/forums/topic/3811-change-targets/?do=findComment&comment=17863 (replace "ObjectManager.GetWoWUnitHostile().OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= distance) != null" by "ObjectManager.GetWoWUnitHostile().OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= 10) != null")

Link to comment
Share on other sites

  • 9 months later...
On 13.09.2016 at 8:27 PM, Droidz said:

I have edited my last post: http://wrobot.eu/forums/topic/3811-change-targets/?do=findComment&comment=17863 (replace "ObjectManager.GetWoWUnitHostile().OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= distance) != null" by "ObjectManager.GetWoWUnitHostile().OrderBy(u => u.HealthPercent).FirstOrDefault(u => u.GetDistance <= 10) != null")

It's can work for classic version wow ?

Link to comment
Share on other sites

do we have conformation this code in fact works yet? I would like to add this to my fight class accept edited to attack the target with the most health. in order to pull Top DPS and or HPS. The more health a Target has the more Damage can be done to it.

Link to comment
Share on other sites

  • 5 months later...

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