• 🏆 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!

Getting Region

Status
Not open for further replies.
Level 20
Joined
Jul 6, 2009
Messages
1,885
I made a trigger which runs when a unit enters any of 10 regions (10 events,for each region). Is there a way to get the region triggering unit entered in? I tried using GetTriggeringRegion() but didn't seem to work.

EDIT: Well,it seems my event is malfunctioning (which belongs to Triggers & Scripts,sorry for wrong section)
The Debug message doesn't run,anyone knows why?
JASS:
function Turn_Filter takes nothing returns boolean
    call BJDebugMsg("Filter Debug")
    return IsUnitInGroup(GetFilterUnit(),udg_Travellers)
endfunction

function InitTrig_Travelling takes nothing returns nothing
    local trigger t = CreateTrigger()
    local integer index = 0
    loop
        set index = index + 1
        exitwhen index > 10
        set TurnRegions[index] = CreateRegion()
        call RegionAddRect(TurnRegions[index],TurnRects[index])
        call TriggerRegisterEnterRegion(t,TurnRegions[index],Filter(function Turn_Filter))
    endloop
    set t = null
endfunction

The TurnRegions and TurnRects are globals declared in map custom script:
JASS:
globals
    region array TurnRegions
    rect array TurnRects
endglobals

Rect initialization in init trigger: (They are initialized,i tested it by creating a unit in a region center)
JASS:
    set TurnRects[1] = gg_rct_Turn_1
    set TurnRects[2] = gg_rct_Turn_2
    set TurnRects[3] = gg_rct_Turn_3
    set TurnRects[4] = gg_rct_Turn_4
    set TurnRects[5] = gg_rct_Turn_5
    set TurnRects[6] = gg_rct_Turn_6
    set TurnRects[7] = gg_rct_Turn_7
    set TurnRects[8] = gg_rct_Turn_8
    set TurnRects[9] = gg_rct_Turn_9
    set TurnRects[10] = gg_rct_Turn_10
 
Last edited:
Status
Not open for further replies.
Top