• 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.

GetEntered Rect

Status
Not open for further replies.
Level 8
Joined
Feb 15, 2009
Messages
463
I search something like GetEnteredRect()does not exist for the IF blocks (where true is :mwahaha:)hope somebody has a solution


JASS:
scope MovementTop initializer Init

globals
    private rect array TopCheckPoint[7]
    private real array TCPx[7]
    private real array TCPy[7]
    private trigger TopMover
    private player COI
    private player COTN
endglobals

private function SetItUp takes nothing returns nothing
    local integer a = -1
    
    set COI = Player(2)
    set COTN = Player(9)
    
    set TopCheckPoint[0] = gg_rct_Move_Top1
    set TopCheckPoint[1] = gg_rct_Move_Top2
    set TopCheckPoint[2] = gg_rct_Move_Top3
    set TopCheckPoint[3] = gg_rct_Move_Top4
    set TopCheckPoint[4] = gg_rct_Move_Top5
    set TopCheckPoint[5] = gg_rct_Move_Top6
    set TopCheckPoint[6] = gg_rct_SpawnUpCOI
    set TopCheckPoint[7] = gg_rct_SpawnUpCOTN

    loop
        set a = a + 1
        exitwhen a > 7
        set TCPx[a] = GetRectCenterX(TopCheckPoint[a])
        set TCPy[a] = GetRectCenterY(TopCheckPoint[a])
        call TriggerRegisterEnterRectSimple( TopMover , TopCheckPoint[a])
    endloop
    
endfunction

private function Conditions takes nothing returns boolean
    return GetOwningPlayer(GetEnteringUnit()) == COI or GetOwningPlayer(GetEnteringUnit()) == COTN
endfunction

private function Actions takes nothing returns nothing
    local unit u = GetEnteringUnit()
    
    if GetOwningPlayer(u) == COI then
        
        if true then
        
        elseif true then
        
        endif
        
    else 
    
    endif

endfunction

//===========================================================================
private function Init takes nothing returns nothing
    set TopMover = CreateTrigger(  )
    call SetItUp()
    call TriggerAddCondition( TopMover , Condition(function Conditions))
    call TriggerAddAction( TopMover , function Actions )
endfunction
endscope
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
That is because, it's basically not the rect which is registred to the event, but a region.

See, if you look at the "triggerregisterrect" function you'll see that:
JASS:
unction TriggerRegisterEnterRectSimple takes trigger trig, rect r returns event
    local region rectRegion = CreateRegion()
    call RegionAddRect(rectRegion, r)
    return TriggerRegisterEnterRegion(trig, rectRegion, null)
endfunction

So it basically registers the region.
And to get the region use GetTriggeringRegion()
 
Status
Not open for further replies.
Top