• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Snippet] IsPointVisible

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
JASS:
library IsPointVisible initializer ini/* v1.0     by Dalvengyr
    
    *************************************************************************************
    * Library to check whether a point is visible to a player or not                    *
    *                                                                                   *
    * Implementation:                                                                   *
    *   - Import dummy.mdx and dummy unit at OE into your map                           *
    *   - Set DUMMY rawcode below to that dummy units rawcode                           *
    *                                                                                   *
    * API:                                                                              *
    *                                                                                   *
    *   function IsPointVisible takes real x, real y, player p returns boolean          *
    *                                                                                   *
    * Link:                                                                             *
    *   hiveworkshop.com/forums/submissions-414/snippet-ispointvisible-249573/          *
    *************************************************************************************/
    
    globals
        private integer    DUMMY = 'h000'
        private unit CHECKER
    endglobals
    
    function IsPointVisible takes real x, real y, player p returns boolean
        call SetUnitX(CHECKER, x)
        call SetUnitY(CHECKER, y)
        return IsUnitVisible(CHECKER, p)
    endfunction
    
    private function ini takes nothing returns nothing
        set CHECKER = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DUMMY, 0, 0, 0)
    endfunction
    
endlibrary
 

Attachments

  • IsPointVisible.w3x
    19.7 KB · Views: 88
Top