Jump to content

Recommended Posts

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?

Link to comment
https://wrobot.eu/forums/topic/7393-making-range-a-variable/#findComment-33735
Share on other sites

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;
	} 
}

 

Link to comment
https://wrobot.eu/forums/topic/7393-making-range-a-variable/#findComment-33738
Share on other sites

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.

Link to comment
https://wrobot.eu/forums/topic/7393-making-range-a-variable/#findComment-33739
Share on other sites

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.");
    }

 

Link to comment
https://wrobot.eu/forums/topic/7393-making-range-a-variable/#findComment-33740
Share on other sites

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;
}

 

Link to comment
https://wrobot.eu/forums/topic/7393-making-range-a-variable/#findComment-33741
Share on other sites

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.

Link to comment
https://wrobot.eu/forums/topic/7393-making-range-a-variable/#findComment-33742
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...