• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[JASS] Cheaking if a unit is in region

Status
Not open for further replies.
Level 11
Joined
Sep 12, 2008
Messages
657
Hey, i've done a trigger, thats moves a unit alone every 0.05 seconds, it moves a bit to the left,

i want to cheak if the unit is inside a region or not.. but in jass,
i tried converting a gui trigger of it, but it used a new function..
and i dont know if its the only way.
 
Level 11
Joined
Sep 12, 2008
Messages
657
Thanks alot =] much better then distance between points aswell (tried some other options at gui), thanks =]

Another problem now..

JASS:
if IsUnitInRegion(udg_Flying_LandingRegion, Flying_Unit) then

sayd that it has a problem.. cannot convert rect to region..
 
Level 11
Joined
Apr 6, 2008
Messages
760
JASS:
function IsUnitInRect takes unit u, rect r returns boolean
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    
    return (GetRectMaxX(r) <= x) and (GetRectMinX(r) >= x) and (GetRectMaxY(r) <= y) and (GetRectMinY(r) >= y)
endfunction

or if you wanna do it in a if/then/else

JASS:
if (GetRectMaxX(r) <= x) and (GetRectMinX(r) >= x) and (GetRectMaxY(r) <= y) and (GetRectMinY(r) >= y) then

endif

EDIT:

Note region and rects arnt the same in jass and gui
 
Level 11
Joined
Sep 12, 2008
Messages
657
hmm..

JASS:
if (GetRectMaxX(udg_Flying_LandingRegion) <= x) and (GetRectMinX(udg_Flying_LandingRegion) >= x) and (GetRectMaxY(udg_Flying_LandingRegion) <= y) and (GetRectMinY(udg_Flying_LandingRegion) >= y) then

    if Flying_AutoMoveSpeed[GetConvertedPlayerId(GetOwningPlayer(Flying_Unit))] == 0 then
    
    call landing(Flying_Unit)
    
    endif

endif

dint have any bugs.. but it didnt really call landing... any idea? o.o
 
Status
Not open for further replies.
Top