Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

number of mobs around my target at a given distance?

Featured Replies

Hi, i tried to get the distance between my target and the mobs around it to check if any of them is too close to charge in, the problem is, the bool always returns true and if i try to return the distance between my target and the mob close, it returns 0.

Can anyone help pls? i got this so far:

 

public int TotalMobsCloseToMyTarget;

    private bool IsRangedPullBetter()
    {
        List<WoWUnit> mobsAroundMe = ObjectManager.GetWoWUnitHostile();

        foreach (WoWUnit unit in mobsAroundMe)
        {
            // nombre de mobs proches de ma target
            if (unit != null && (unit.Position.DistanceTo(ObjectManager.Me.TargetObject.Position) <= 7.0F && !unit.IsDead))
            {
                
                DistanceEnemisProches = unit.Position.DistanceTo(ObjectManager.Me.TargetObject.Position);
                TotalMobsCloseToMyTarget++;
                return true;
            }
        }
        return false;
    }

 

  • 2 weeks later...

I am not sure if this works, as I have not tested it, but try and play around with this:

private bool IsRangedPullBetter()
{
    // Create a list
    var mobsAroundMe = new List<WoWUnit>();

    // Check my target's surroundings for mobs that are valid, alive, attackable, and within
    // 7 yards of target and sort them in the list from closest to furthest from player's position
    if (ObjectManager.Me.HasTarget)
    {
        mobsAroundMe.AddRange(ObjectManager.GetObjectWoWUnit().Where(u =>
        u != null && u.IsValid && u.IsAlive && u.IsAttackable &&
        u.Position.DistanceTo(ObjectManager.Target.Position) <= 7.0f).OrderBy(n =>
        ObjectManager.Me.Position.DistanceTo(n.Position)));
    }

    // Number of mobs within 7 yards of my target = mobsAroundMe.Count();

    // I may want to use a pull spell if there are more than 2 mobs near my target
    if (mobsAroundMe.Count() > 2)
    {
        return true;
    }
    return false;
}

 

  • Author

thanks man :)

I found my errors and corrected them in the meantime, here's the working version, i'm using it on my warrior class

1 -, it checks if you have a ranged weapon equiped and if the target is at good distance, if not, returns false.

2 -, If there is only 1 hostile (your target) :

-if there is a neutral lvl1+ (not a critter) around your target, it checks if the neutral is closest to you or your target, if the neutral is closest to you, it returns false (no need for ranged pull), if the neutral is closest to your target, it returns true (you can ranged pulll your target).

- If there are only critters around your target, it returns false, you can charge in, no danger.

3 if there are more than 1 hostile in a 25m radius, it will return true (ranged pull)

I wrote this because my character would do stupid shit like spam cooldowns for 1 or 2 critters or even attack an hostile, then aoe and get aggro from nearby neutral mobs and get killed over and over (fellwood south is horrible for that matter)..

private static bool IsRangedPullBetter()
    {
        if (ObjectManager.Me.GetEquipedItemBySlot(InventorySlot.INVSLOT_RANGED) == 0 && (ObjectManager.Target.GetDistance < 8
                                                                                     || ObjectManager.Target.GetDistance > 25)) return false;
        
        var mobsAroundMyTarget = ObjectManager.GetWoWUnitAttackables().Where(u => u.Position.DistanceTo(ObjectManager.Target.Position) <= 25
                                                                                  && u.IsAttackable);        
        
        var hostilesAroundMyTarget = ObjectManager.GetWoWUnitHostile().Count(u => u.Position.DistanceTo(ObjectManager.Target.Position) <= 25
                                                                                  && u.IsAttackable);
        
        var neutralsAroundMyTarget = ObjectManager.GetWoWUnitAttackables().Count(u => u.Position.DistanceTo(ObjectManager.Target.Position) <= 15
                                                                                      && u.IsAttackable 
                                                                                      && IsNeutral(u) 
                                                                                      && u.Level >= 10);
        
        var crittersAroundMyTarget = ObjectManager.GetWoWUnitAttackables().Count(u => u.Position.DistanceTo(ObjectManager.Target.Position) <= 10
                                                                                      && u.IsAttackable 
                                                                                      && IsNeutral(u) 
                                                                                      && u.Level < 2);
        
        if (hostilesAroundMyTarget > 1)
        {
            return hostilesAroundMyTarget > 1;
        }

        if (crittersAroundMyTarget != 0 && neutralsAroundMyTarget == 0)
        {
            return false;
        }
        
        return neutralsAroundMyTarget >= 1 && mobsAroundMyTarget.All(unit =>
                   !(unit.Position.DistanceTo(ObjectManager.Me.Position) <
                     ObjectManager.Target.Position.DistanceTo(unit.Position)));        
    }

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.