Jump to content
  • Range Calculater for WoW Vanilla is off


    Ordush
    • Version: All Product: Fight Classes Type: Bug Status: Not a Bug
     Share

    It seems that the 'range' calculator for Vanilla is off by a few yards.

    If i tell the bot to walk away from mobs if they are less than 8 yards range from me (to be able to use ranged abilities as hunter), the bot does not walk far enough away (it walks less then 8 yards away).
    If i set it to 12 yards instead of 8, then it will walk far enough away for the mob to be more then 8 yards range from me)

    This works totally fine in TBC, but not in Vanilla.


     Share


    User Feedback

    Recommended Comments

    4 hours ago, Droidz said:

    Hello, try to disable option "auto calcul range..." in advanced general settings

    I don't see that anywhere in my settings, but i tried turning off Calculate interact/combat distance by target size.
    Did not help anything. :(

    Edit: It looks like the target size calculator is what is not working.

    Edited by Ordush
    Link to comment
    Share on other sites

    Please @Droidz read this, and see my screenshot.

    5a539c7848fa9_buggedrange.png.31a4574c148ba3e8acd0e719b0f42cf7.png

    The code to print ObjectManager.Target.GetDistance i use is here:
     

    public static void wrPrint(float message)
    	{
    		{
    			Lua.LuaDoString("DEFAULT_CHAT_FRAME:AddMessage('" + message.ToString() + "')");
    		}
    	}

    Then you can just put wrPrint(ObjectManager.Target.GetDistance);
    Into a while loop or into wManager.Events.FightEvents.OnFightLoop += (unit, cancelable) => { }; if you only wanna spam your chat when actually shooting a mob or dummy.

    I need to be 13.3 yards away from the target, for it to be in range with a 8 yard spell (any ranged hunter attack). So when i am actually 8 yards away from the target, ObjectManager.Target.GetDistance thinks i'm 13.3 yards away. This is both with and without Calculate interact/combat distance by target size in general advanced settings.

    wrPrint("DistanceGood:" + _AutoShot.IsDistanceGood); This prints false under what ObjectManager.Target.GetDistance claims is 5 yards, above 5 yards it prints true.
    But in vanilla Auto Shot distance is not 5 Yards, it's 8 Yards.

    If you want to compare you IsDistanceGood with in-game "Is Distance Good" checker then you can do

    /run DEFAULT_CHAT_FRAME:AddMessage(IsActionInRange(1))

    then put whatever spell you wanna check against on action bar slot 1.
    Like Auto Shot

    Edited by Ordush
    Link to comment
    Share on other sites

    On 1/1/2018 at 10:50 PM, Ordush said:

    I even tried telling it to walk away if !_AutoShoot.IsDistanceGood , same problem (_AutoShot is Spell "Auto Shot")

    Are you walking away by doing the "button press" logic that move during combat plugin does? I had problems with that and the refresh rate of the calculation of target distance before.

    Link to comment
    Share on other sites

    wManager.Events.FightEvents.OnFightLoop += (unit, cancelable) => {
    			var unitsAffectingMyCombat = ObjectManager.GetUnitAttackPlayer();
    			var unitsAttackMe = unitsAffectingMyCombat.Where(u => u != null && u.IsValid && u.IsTargetingMe).ToList();
    			LuaUtils.wrPrint("GetDistance:" +ObjectManager.Target.GetDistance);
    			LuaUtils.wrPrint("DistanceGood:" + _AutoShot.IsDistanceGood);
    			if (ObjectManager.Target.IsAttackable && unit.IsValid && !ObjectManager.Me.IsCast && ObjectManager.Target.GetDistance < 8 && !ObjectManager.Target.IsTargetingMe && !ObjectManager.Target.GetMove && unitsAttackMe.Count <= 0)
    			{
    				Move.Backward(Move.MoveAction.PressKey, 3000);
    			}
    		};

    However, it's not so much the refresh rate of the distance calculation, because as you can see in my screenshot, i am standing completely still at 7yard range from the mob, and WRobot thinks i'm 9 yards away.

    Edit: When a mob is melee hitting me WRobot thinks it's 3 yards away.

    Edited by Ordush
    Link to comment
    Share on other sites

    12 hours ago, Ordush said:
    wManager.Events.FightEvents.OnFightLoop += (unit, cancelable) => {
    			var unitsAffectingMyCombat = ObjectManager.GetUnitAttackPlayer();
    			var unitsAttackMe = unitsAffectingMyCombat.Where(u => u != null && u.IsValid && u.IsTargetingMe).ToList();
    			LuaUtils.wrPrint("GetDistance:" +ObjectManager.Target.GetDistance);
    			LuaUtils.wrPrint("DistanceGood:" + _AutoShot.IsDistanceGood);
    			if (ObjectManager.Target.IsAttackable && unit.IsValid && !ObjectManager.Me.IsCast && ObjectManager.Target.GetDistance < 8 && !ObjectManager.Target.IsTargetingMe && !ObjectManager.Target.GetMove && unitsAttackMe.Count <= 0)
    			{
    				Move.Backward(Move.MoveAction.PressKey, 3000);
    			}
    		};

    However, it's not so much the refresh rate of the distance calculation, because as you can see in my screenshot, i am standing completely still at 7yard range from the mob, and WRobot thinks i'm 9 yards away.

    Edit: When a mob is melee hitting me WRobot thinks it's 3 yards away.

    I tried this code out, while useful, it seems to only "tap" the back button, I did reproduce the range calculation being off though...

    Link to comment
    Share on other sites

    It works fine in the way that i am using it.
    In my TBC profile, this works perfectly, no bugs etc.
    The issue here is the range being off, which is what i started saying. :)
    I think i've produced enough evidence. :)
    Also, the range needed for ranged attacks is set to 5 yards. in vanilla it's not 5 yards it's 8 yards. :)

    Link to comment
    Share on other sites

    On 08/01/2018 at 5:33 PM, Ordush said:

    Please @Droidz read this, and see my screenshot.

    5a539c7848fa9_buggedrange.png.31a4574c148ba3e8acd0e719b0f42cf7.png

    The code to print ObjectManager.Target.GetDistance i use is here:
     

    public static void wrPrint(float message)
    	{
    		{
    			Lua.LuaDoString("DEFAULT_CHAT_FRAME:AddMessage('" + message.ToString() + "')");
    		}
    	}

    Then you can just put wrPrint(ObjectManager.Target.GetDistance);
    Into a while loop or into wManager.Events.FightEvents.OnFightLoop += (unit, cancelable) => { }; if you only wanna spam your chat when actually shooting a mob or dummy.

    I need to be 13.3 yards away from the target, for it to be in range with a 8 yard spell (any ranged hunter attack). So when i am actually 8 yards away from the target, ObjectManager.Target.GetDistance thinks i'm 13.3 yards away. This is both with and without Calculate interact/combat distance by target size in general advanced settings.

    wrPrint("DistanceGood:" + _AutoShot.IsDistanceGood); This prints false under what ObjectManager.Target.GetDistance claims is 5 yards, above 5 yards it prints true.
    But in vanilla Auto Shot distance is not 5 Yards, it's 8 Yards.

    If you want to compare you IsDistanceGood with in-game "Is Distance Good" checker then you can do

    /run DEFAULT_CHAT_FRAME:AddMessage(IsActionInRange(1))

    then put whatever spell you wanna check against on action bar slot 1.
    Like Auto Shot

    Try

     var dist = ObjectManager.Target.GetDistance - ObjectManager.Target.CombatReach;

     

    Link to comment
    Share on other sites

    On 1/18/2018 at 3:43 PM, Droidz said:

    Try

     var dist = ObjectManager.Target.GetDistance - ObjectManager.Target.CombatReach;

     

    @Droidz  Sorry bout the late answer, i was hospitalized.
    This prints 11,3342 as range, when it's 8 yard range. So not better. =/

    Link to comment
    Share on other sites

    On 2/16/2018 at 12:46 PM, Droidz said:

    This does not fix anything?
    The first one just tells if a auto-shot is in range, the other one checks attack.

    It's nice that we can check if a spell is in range. However, this does not give the range.
    We need the number (Range as a number).
    The methods listed above will make a shit ton of noise if you play with sound, and it uses lua which will slow down the fightclass.
    Also try and look at what i wrote above.. I wrote EXACTLY that code.

    Quote
    /run DEFAULT_CHAT_FRAME:AddMessage(IsActionInRange(1))

    To me it's clear that what is not working is the mob size calculator.

    Edited by Ordush
    Link to comment
    Share on other sites

    Hey, as mangos emu is the only vanilla server software around these day i fuge most likely all of the private servers run on it (more or less modified).
    So here is the table containing the npc hitbox-radii and combat-reaches from the default mangos database. of cause they may have been modified on some servers.
    ttps://github.com/mangoszero/database/blob/master/World/Setup/FullDB/creature_model_info.sql

    But as it is now the hitbox data Wrobot reads from the wow client ist absolutely unreliable.
    Is the hitbox size even sent to the wow client? or is it just handled server-wise? 

    I tried to dig into mangos server code a little to find out if it sends the info to the client, so that it could be read with the right opcode.
    But i'm to lazy to trac the networklogic down to that point, this might be the funktion that sets it internally, no idea if that is then send or not:
    https://github.com/mangoszero/server/blob/52454825c7e1435ff53f32f9edf9fe7dca10ec08/src/game/Object/Unit.cpp#L8836

    Link to comment
    Share on other sites

    @Droidz bump. also please read the thread  more carefully:

    On 19.2.2018 at 12:39 AM, Ordush said:

    This does not fix anything?
    The first one just tells if a auto-shot is in range, the other one checks attack.

    It's nice that we can check if a spell is in range. However, this does not give the range.
    We need the number (Range as a number).
    The methods listed above will make a shit ton of noise if you play with sound, and it uses lua which will slow down the fightclass.
    Also try and look at what i wrote above.. I wrote EXACTLY that code.

    To me it's clear that what is not working is the mob size calculator.

     

    Link to comment
    Share on other sites

    Hello,

    spell.IsDistanceGood (and distance check option in fightclasses editor) test only max distance (not min spell distance).

    I tested this code and he seem to works:

    float min = 8, max = 35;
    var cMin = ObjectManager.Target.GetDistance - ObjectManager.Target.CombatReach - ObjectManager.Me.CombatReach;
    var cMax = ObjectManager.Target.GetDistance + ObjectManager.Target.CombatReach + ObjectManager.Me.CombatReach;
    bool inRange = cMin >= min && cMax <= max;
    Logging.Write("cMin = " + cMin + " - cMax" + cMax + " - inRange= " + inRange);

     

    One line (for xml fightclass): 

    ((ObjectManager.Target.GetDistance - ObjectManager.Target.CombatReach - ObjectManager.Me.CombatReach) >= 8 && (ObjectManager.Target.GetDistance + ObjectManager.Target.CombatReach + ObjectManager.Me.CombatReach) <= 35)

     

    Link to comment
    Share on other sites

    1 hour ago, Droidz said:

    Hello,

    spell.IsDistanceGood (and distance check option in fightclasses editor) test only max distance (not min spell distance).

    I tested this code and he seem to works:

    float min = 8, max = 35;
    var cMin = ObjectManager.Target.GetDistance - ObjectManager.Target.CombatReach - ObjectManager.Me.CombatReach;
    var cMax = ObjectManager.Target.GetDistance + ObjectManager.Target.CombatReach + ObjectManager.Me.CombatReach;
    bool inRange = cMin >= min && cMax <= max;
    Logging.Write("cMin = " + cMin + " - cMax" + cMax + " - inRange= " + inRange);

     

    One line (for xml fightclass): 

    ((ObjectManager.Target.GetDistance - ObjectManager.Target.CombatReach - ObjectManager.Me.CombatReach) >= 8 && (ObjectManager.Target.GetDistance + ObjectManager.Target.CombatReach + ObjectManager.Me.CombatReach) <= 35)

     

    Cheers Droidz. I will test it out!
    Just another thing. WRobot thinks that hunter range is 5 yards. in Vanilla it's 8 yards. At least it was like that last i tested. :)

    Link to comment
    Share on other sites

    @Droidz

    Okay so it works in a way. It shows the correct range now, however it does not do it based on the target size.
    My aciton bar is "white" meaning the game even thinks i'm far enough away. But with a mob with a big target size, you have to go further than 8 yards away to use ranged abilities.

    Is there any way i can get target size into my calculation?

    Edited by Ordush
    Link to comment
    Share on other sites

    22 hours ago, Ordush said:

    @Droidz

    Okay so it works in a way. It shows the correct range now, however it does not do it based on the target size.
    My aciton bar is "white" meaning the game even thinks i'm far enough away. But with a mob with a big target size, you have to go further than 8 yards away to use ranged abilities.

    Is there any way i can get target size into my calculation?

    CombatReach is calculed by server and he is in relation to the mob size ( https://github.com/mangoszero/server/blob/52454825c7e1435ff53f32f9edf9fe7dca10ec08/src/game/Object/Unit.cpp#L8842  ). I think than server send bad value (or when you cast spell he don't check distance like Wow).

    Link to comment
    Share on other sites

    2 minutes ago, Droidz said:

    CombatReach is calculed by server and he is in relation to the mob size ( https://github.com/mangoszero/server/blob/52454825c7e1435ff53f32f9edf9fe7dca10ec08/src/game/Object/Unit.cpp#L8842  ). I think than server send bad value (or when you cast spell he don't check distance like Wow).

    Alright, so this is a server thing, too bad. Will just have to make a safe "9 yard distance". :)
    I have also written on the same subject a thread. I qouted you in it. If you get the time, will you look at it?
    Thanks a ton for helping with all this mate! <3

    Link to comment
    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...