Calculating distance to melee menu

User Tag List

Results 1 to 13 of 13
  1. #1
    bad6oy30's Avatar Member Authenticator enabled
    Reputation
    1
    Join Date
    Dec 2010
    Posts
    41
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Calculating distance to melee

    I'm trying to determine minimum distance to melee, which appears to vary depending on the unit... most of the time it's 5.00yds, but a raid target dummy is 5.33yds (and bosses much more). UNIT_FIELD_BOUNDINGRADIUS and UNIT_FIELD_COMBATREACH don't seem to factor into it at all.

    Normal Target Dummy:
    UNIT_FIELD_BOUNDINGRADIUS: 0.525
    UNIT_FIELD_COMBATREACH: 1.75
    Melee distance: 5.00

    Raid Target Dummy:
    UNIT_FIELD_BOUNDINGRADIUS: 0.75
    UNIT_FIELD_COMBATREACH: 2.5
    Melee distance: 5.33

    Critter:
    UNIT_FIELD_BOUNDINGRADIUS: 0.2
    UNIT_FIELD_COMBATREACH: 1
    Melee distance: 5.00

    OBJECT_FIELD_SCALE_X was 1 in all cases. I realize I could check IsSpellInRange for a melee spell, but I'd like to know the distance at any given point.

    Calculating distance to melee
  2. #2
    evil2's Avatar Active Member
    Reputation
    27
    Join Date
    Feb 2009
    Posts
    172
    Thanks G/R
    31/9
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for bringin this up.
    i have the same problem, especially with raid bosses with a big hit box radius.

    anyone found a useful unit value for this?

  3. #3
    zys924's Avatar Active Member
    Reputation
    20
    Join Date
    Nov 2009
    Posts
    113
    Thanks G/R
    0/7
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any god can give a hand on this? Im also having the same trouble....

  4. #4
    ostapus's Avatar Active Member
    Reputation
    60
    Join Date
    Nov 2008
    Posts
    180
    Thanks G/R
    3/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    second that, anyone ?

  5. #5
    ostapus's Avatar Active Member
    Reputation
    60
    Join Date
    Nov 2008
    Posts
    180
    Thanks G/R
    3/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, visually training dummy is smaller than raiding training dummy but model is the same. wonder how to get that scale factor (getScale VT returns 1 for both)
    and check if distance scaled/depends for the same number.

  6. #6
    evil2's Avatar Active Member
    Reputation
    27
    Join Date
    Feb 2009
    Posts
    172
    Thanks G/R
    31/9
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bump.

    anyone found a solution?

  7. #7
    bad6oy30's Avatar Member Authenticator enabled
    Reputation
    1
    Join Date
    Dec 2010
    Posts
    41
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I were still playing, and had any degree of debugging skill, I would reverse Lua's IsSpellInRange with a melee-range spell, and see how it gets figured out. Neither of those prerequisites apply to me unfortunately

  8. #8
    amadmonk's Avatar Active Member
    Reputation
    124
    Join Date
    Apr 2008
    Posts
    772
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, I've confirmed; 0x8163C0 seems to correctly get the min/max ranges for any spell against any target. This is important because, for instance, Corruption says that it has a 40yd range, but in reality its 40+/- about 5yds. I don't know where this +/- comes from, but it's definitely there, and can definitely f*ck up your bot's distance routines. 0x8163C0 seems to always return the *real* results that match up with a pos1->pos2 vector length calculation when compared w/IsSpellInRange.

    AND it takes into account the different sized melee hit-boxes. So 0x8163C0 is basically your one-stop shop for spell ranges.

    IsSpellInRange is mostly just a shim around 0x819900.

    int __cdecl sub_819900(void *pCaster, struct SpellEntry *pSpellRow, WGUID guid, bool *bInRange, int, int)

    The problem is that 0x819900 is a HUGE function with >100 switch cases. This is probably why nobody has reversed it; there's not (AFAIK) a simple "get the range of this spell" function; instead, the range is calculated in giant switch block, meaning that reversing it is a major pain in the ass.

    I feel your pain because right now I don't have a good, deterministic way to find out the spell range for a given spell (the DBC's just give you base ranges, unadjusted for buffs/talents/etc., and of course IsSpellInRange just gives you a yes/no answer, not the ACTUAL range). So I end up hard-coding spell ranges in my bot, which sucks.

    ---------- Post added at 11:36 AM ---------- Previous post was at 10:16 AM ----------

    Okay, I *think* this is it:

    void *__cdecl sub_8163C0(void *pCaster, SpellEntry *pSpellEntry, float *pfMinRange, float *pfMaxRange, bool bIsHelpful, void *pTarget)

    Not sure what (if anything) the return value is, yet, but it pokes a min range and max range into those float pointers.
    Last edited by amadmonk; 03-20-2011 at 02:26 PM.
    Don't believe everything you think.

  9. #9
    Ssateneth's Avatar Contributor
    Reputation
    142
    Join Date
    May 2008
    Posts
    866
    Thanks G/R
    1/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by amadmonk View Post
    Okay, I've confirmed; 0x8163C0 seems to correctly get the min/max ranges for any spell against any target. This is important because, for instance, Corruption says that it has a 40yd range, but in reality its 40+/- about 5yds. I don't know where this +/- comes from, but it's definitely there, and can definitely f*ck up your bot's distance routines. 0x8163C0 seems to always return the *real* results that match up with a pos1->pos2 vector length calculation when compared w/IsSpellInRange.

    AND it takes into account the different sized melee hit-boxes. So 0x8163C0 is basically your one-stop shop for spell ranges.

    IsSpellInRange is mostly just a shim around 0x819900.

    int __cdecl sub_819900(void *pCaster, struct SpellEntry *pSpellRow, WGUID guid, bool *bInRange, int, int)

    The problem is that 0x819900 is a HUGE function with >100 switch cases. This is probably why nobody has reversed it; there's not (AFAIK) a simple "get the range of this spell" function; instead, the range is calculated in giant switch block, meaning that reversing it is a major pain in the ass.

    I feel your pain because right now I don't have a good, deterministic way to find out the spell range for a given spell (the DBC's just give you base ranges, unadjusted for buffs/talents/etc., and of course IsSpellInRange just gives you a yes/no answer, not the ACTUAL range). So I end up hard-coding spell ranges in my bot, which sucks.

    ---------- Post added at 11:36 AM ---------- Previous post was at 10:16 AM ----------

    Okay, I *think* this is it:

    void *__cdecl sub_8163C0(void *pCaster, SpellEntry *pSpellEntry, float *pfMinRange, float *pfMaxRange, bool bIsHelpful, void *pTarget)

    Not sure what (if anything) the return value is, yet, but it pokes a min range and max range into those float pointers.
    Sorry to necro this thread, but I've been looking through all the dump threads and simply cannot figure out what version wow you got 0x8163C0 from so I can look up to see where it is for the current version of wow. Would someone enlighten me? I too am looking for the size of the hitbox and I'm banging my head reading all these dump threads trying to find what version this magic address was for.
    Last edited by Ssateneth; 06-10-2011 at 12:19 AM.
    KuRIoS is awesome!

  10. #10
    Jadd's Avatar 🐸 Premium Seller
    Reputation
    1515
    Join Date
    May 2008
    Posts
    2,433
    Thanks G/R
    81/336
    Trade Feedback
    1 (100%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Ssateneth View Post
    Sorry to necro this thread, but I've been looking through all the dump threads and simply cannot figure out what version wow you got 0x8163C0 from so I can look up to see where it is for the current version of wow. Would someone enlighten me? I too am looking for the size of the hitbox and I'm banging my head reading all these dump threads trying to find what version this magic address was for.
    It was for 4.0.6.13623 (have a look at the date of the post, then look on Patches - WoWWiki - Your guide to the World of Warcraft to see what version was out at that time).

    In 4.1.0.14007 it's 0x00821DE0

  11. #11
    bad6oy30's Avatar Member Authenticator enabled
    Reputation
    1
    Join Date
    Dec 2010
    Posts
    41
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's sub_8B1CB0 for build 15050

  12. #12
    zys924's Avatar Active Member
    Reputation
    20
    Join Date
    Nov 2009
    Posts
    113
    Thanks G/R
    0/7
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mind me asking How "SpellEntry" comes from?

  13. #13
    miceiken's Avatar Contributor Authenticator enabled
    Reputation
    209
    Join Date
    Dec 2007
    Posts
    401
    Thanks G/R
    7/9
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SpellEntry is found in the internal WoW database (DBCs)

Similar Threads

  1. Attack with melee while Casting a spell.
    By Itazuki in forum World of Warcraft Exploits
    Replies: 7
    Last Post: 12-16-2006, 12:17 PM
  2. Lvling for talent Calculator-thingy
    By Egads in forum World of Warcraft General
    Replies: 1
    Last Post: 09-16-2006, 03:40 AM
  3. WSG- alli flag room anti-melee spot
    By Cloud in forum World of Warcraft Exploits
    Replies: 18
    Last Post: 08-12-2006, 04:24 AM
  4. How +Spell Damage Is Calculated For Mages
    By impulse102 in forum World of Warcraft Guides
    Replies: 7
    Last Post: 08-06-2006, 06:08 AM
  5. Distance to ML?
    By isacneuton in forum World of Warcraft General
    Replies: 0
    Last Post: 07-27-2006, 01:15 PM
All times are GMT -5. The time now is 06:36 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search