Seminko 41 Posted October 15, 2017 Share Posted October 15, 2017 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. Link to comment https://wrobot.eu/forums/topic/7393-making-range-a-variable/ Share on other sites More sharing options...
Matenia 630 Posted October 16, 2017 Share Posted October 16, 2017 If you convert your fightclass to C#, Range() is a getter, so you can set it dynamically. Link to comment https://wrobot.eu/forums/topic/7393-making-range-a-variable/#findComment-33724 Share on other sites More sharing options...
Seminko 41 Posted October 16, 2017 Author Share Posted October 16, 2017 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 More sharing options...
Matenia 630 Posted October 16, 2017 Share Posted October 16, 2017 (edited) public float Range { get { if(somethingInMyClass) { return 29f; } return 5f; } } Edited October 16, 2017 by Matenia Razzue 1 Link to comment https://wrobot.eu/forums/topic/7393-making-range-a-variable/#findComment-33737 Share on other sites More sharing options...
Seminko 41 Posted October 16, 2017 Author Share Posted October 16, 2017 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 More sharing options...
Matenia 630 Posted October 16, 2017 Share Posted October 16, 2017 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. Seminko 1 Link to comment https://wrobot.eu/forums/topic/7393-making-range-a-variable/#findComment-33739 Share on other sites More sharing options...
Seminko 41 Posted October 16, 2017 Author Share Posted October 16, 2017 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 More sharing options...
Apexx 60 Posted October 16, 2017 Share Posted October 16, 2017 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 More sharing options...
Seminko 41 Posted October 16, 2017 Author Share Posted October 16, 2017 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 More sharing options...
Seminko 41 Posted October 16, 2017 Author Share Posted October 16, 2017 Hmmm, something's wrong... even though I set the distance to 5yr and there is clearly no other monsters it always pulls with ranged... Link to comment https://wrobot.eu/forums/topic/7393-making-range-a-variable/#findComment-33743 Share on other sites More sharing options...
Seminko 41 Posted October 16, 2017 Author Share Posted October 16, 2017 It works now! Thank you both! Link to comment https://wrobot.eu/forums/topic/7393-making-range-a-variable/#findComment-33744 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now