• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Snippet] IsPointVisible

Kazeon

Hosted Project: EC
Level 34
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: 89
Top