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.

Making Range a variable

Featured Replies

Is there a way to change range while the bot is running?

I was thinking about sth like, if there are other mobs near the target, set range to X and pull, if not set range to melee and don't waste time pulling.

  • Author
4 hours ago, Matenia said:

If you convert your fightclass to C#, Range() is a getter, so you can set it dynamically.

I'm a C# noobie so bear with me.

The default declaration is done within the Main class, like so:

public float Range { get { return 29f; } }

When I tried having a void with IF statements and using the above, it wouldn't work. Could you please ellaborate more?

  • Author

Hmmm... Alright, where do you put this, i mean if this is going to be defined right at the start of the class I still don't understand how this gets updated. First thing that comes to mind is a bool. Let say in the fightclass loop I put in bool too check whether the conditions are met or not. If I update your code as below will the range be changed? If so, it's very much counterintuitive for me.

public float Range 
{ 
	get 
    {
      	if(bool = 1)
        {
          return 29f;
        }
      	return 5f;
	} 
}

 

You have it correct.

Now if you have a bool for your fightclass like this

private bool _IsLaunched = false;
private bool ChangeRange = false;
private static WoWLocalPlayer Me = ObjectManager.Me;

public float Range 
{ 
	get 
    {
      	if(ChangeRange)
        {
          return 29f;
        }
      	return 5f;
	} 
}

private void Pulse()
{
	while(_IsLaunched)
    {
      //check if player not in combat yet, but bot wants to fight its current target
      //then set ChangeRange to true if target is further away than 12 yards, otherwise false
      ChangeRange = !Me.InCombat && Fight.InFight && ObjectManager.Target.GetDistance >= 12;
      
      
      Thread.Sleep(100);
    }
}

Then you need to call Pulse once in your Initialize method (in your fightclass).
Pulse should basically be executing your rotation. You can take a look at existing fightclasses like Eeny's to get a better idea at how they work. 
 

Anyway, that should change your range accordingly. It's possible, that the bot won't react to this right away. If that's the case, you basically have to intercept events and change the range before they fire.

  • Author

I used this. Will test and report back.

public float Range 
	{ 
		get 
		{
			if(RangeCheck = true)
			{
			  return 29f;
			}
			return 5f;
		} 
	}

private void RangeManager()
	{	
		if (ObjectManager.GetWoWUnitHostile().Count(u => u.Position.DistanceTo(ObjectManager.Target.Position) <= 40  && u.IsAttackable) > 1)
		{
			RangeCheck = true;
		}
		else
		{
			RangeCheck = false;
		}
		return;
	}

    public void Start()
    {
        
        Logging.Write("Seminko's Rogue Loaded");
        while (iMageLaunched)
        {
            if (!Products.InPause)
                {
                    if (!ObjectManager.Me.IsDeadMe)
                    {
						SprintManager();
						EquipThrown();
                        if (Fight.InFight && ObjectManager.Me.Target > 0)
                        {
                            RangeManager();
                            GetFightingState();
                        }
                    }
                }
            Thread.Sleep(10);
        }
        Logging.Write("Seminko's Rogue is now stopped.");
    }

 

Hello, your method RangeManager() looks like it will only return true if there are more than 1 unit in range.

if (ObjectManager.GetWoWUnitHostile().Count(u => u.Position.DistanceTo(ObjectManager.Target.Position) <= 40  && u.IsAttackable) > 1)

You may want to change > 1 to >= 1 as seen below, but I could be wrong.

private void RangeManager()
{
	if (ObjectManager.GetWoWUnitHostile().Count(u => u.Position.DistanceTo(ObjectManager.Target.Position) <= 40  && u.IsAttackable) >= 1)
	{
		RangeCheck = true;
	}
	else
	{
		RangeCheck = false;
	}
	return;
}

 

  • Author

It will return true if there is more than one attackable monster within 40 yards range of the target. That's what I'm after, if it returns true I will use range pull, if it returns false and there is only one mob in range of my target I will pull melee as I can manage two at once.

At least that's how I understand it.

  • Author

Hmmm, something's wrong... even though I set the distance to 5yr and there is clearly no other monsters it always pulls with ranged...

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.