Check whether the unit is in visual range? menu

User Tag List

Results 1 to 9 of 9
  1. #1
    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)

    Check whether the unit is in visual range?

    We all know LUA doesn't provide any functions that can check whether a unit is in visual range. The only way to achieve this AFAIK is to try to cast a spell and grab the check result from the combat log.
    Is this sort of check clientside or serverside? if it's clientside, which C function does such stuffs?
    Grateful for any help...

    Check whether the unit is in visual range?
  2. #2
    Xarg0's Avatar Member
    Reputation
    61
    Join Date
    Jan 2008
    Posts
    389
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Traceline, take a look at the info dump thread
    edit: inb4 srs flaming
    I hacked 127.0.0.1

  3. #3
    DrakeFish's Avatar Lazy Leecher

    Reputation
    634
    Join Date
    Nov 2008
    Posts
    569
    Thanks G/R
    0/14
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by zys924 View Post
    We all know LUA doesn't provide any functions that can check whether a unit is in visual range. The only way to achieve this AFAIK is to try to cast a spell and grab the check result from the combat log.
    Is this sort of check clientside or serverside? if it's clientside, which C function does such stuffs?
    Grateful for any help...
    I won't tell you what is the offset, because I don't have it myself.
    Traceline is a solution, but I don't think it's the easiest one. You may want to look at the unit structure (no I'm not talking about the structure you can find in the sticky post), you will probly find something that says if unit is in line of sight or not. If I'm not wrong, both client and server calculate line of sight.

  4. #4
    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)
    Iv tried the TraceLine, and received some wierd results, here is some debug info:

    [13:53:46]0x68000000128AF63, Start:-8766.732, 416.3979, 105.4191; End:-8753.438, 400.2535, 102.5564; ResultPos: -8755.156, 402.341, 102.9265; Result: 1
    [13:53:46]0x68000000128AF63, Start:-8766.732, 416.3979, 105.4191; End:-8753.438, 400.2535, 102.5564; ResultPos: 0, 0, 0; Result: 0

    As you can see, the same startPos and endPos can produce different result.
    Code:
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    private delegate byte TraceLineDelegate(ref WoWPosition pEnd, ref WoWPosition pStart, ref WoWPosition pResult, ref float pDistance, uint dwFlag, uint pOptional);
    pDistance = &1.0f
    dwFlag = 0x00100171

    Can anybody show me some way out. thx

    ---------- Post added at 02:21 AM ---------- Previous post was at 01:04 AM ----------

    Resolved. Iv forgotten to reset *pDistance to 1
    Last edited by zys924; 10-03-2010 at 01:07 AM.

  5. #5
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's done server side. There is nothing in the unit structure that represents in/out of LOS.
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  6. #6
    DrakeFish's Avatar Lazy Leecher

    Reputation
    634
    Join Date
    Nov 2008
    Posts
    569
    Thanks G/R
    0/14
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by MaiN View Post
    It's done server side. There is nothing in the unit structure that represents in/out of LOS.
    Ah I always thought there were both a server-side and client-side check (like GCD and such things).

  7. #7
    streppel's Avatar Active Member
    Reputation
    78
    Join Date
    Mar 2007
    Posts
    196
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i remember on emu servers when there was no collision mesh yet, you could cast everything throught everything,no matter of LOS,so it has to be serverside ^^

  8. #8
    unbekannt1's Avatar Member
    Reputation
    -6
    Join Date
    Apr 2009
    Posts
    54
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    struct WowPos
    {
    	float x;
    	float y;
    	float z;
    };
    
    //Traceline
    typedef byte (__cdecl * tTraceline)(WowPos* End, WowPos* Start, WowPos* Result, float* Distance, UINT dwFlag, UINT Optional);
    tTraceline Traceline = reinterpret_cast<tTraceline>(0x007A3B70);
    
    bool isInLineOfSight(WowPos* End, WowPos* Start, WowPos* HitPos)
    {
    	float distance = 1.0f;
    	return !Traceline(End,Start,HitPos,&distance,0x100011,0x0);
    }
    isInLineOfSight will return true if nothing is in the way and otherwise it will return false

  9. #9
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.mmowned.com/forums/world-of-warcraft/bots-programs/memory-editing/257771-wow-constant-data-enums-structs-etc.html#post1687087
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

Similar Threads

  1. [Guide] The Eyes of Grillok [Visual]
    By madden92 in forum World of Warcraft Guides
    Replies: 0
    Last Post: 08-26-2011, 07:47 AM
  2. [Trinity] "ERROR: Failed to open acceptor ,check if the port is free"
    By barkerm in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 03-30-2011, 10:19 AM
  3. Check out the new hot selling items in 3.2!
    By amunro in forum World of Warcraft Guides
    Replies: 3
    Last Post: 08-05-2009, 10:38 AM
  4. [LUA] Check a Spawned unit's HP? Is it possible?
    By controlsx2 in forum WoW EMU Questions & Requests
    Replies: 7
    Last Post: 05-20-2009, 09:57 AM
All times are GMT -5. The time now is 09:21 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