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

Event response - Region being etered

Status
Not open for further replies.
Level 4
Joined
Jan 5, 2014
Messages
79
Is there in JASS (coz I dont think it is in GUI) the Eent response - Region being entered? (which would respond to the region in Unit enters a region event)
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Not quite. You can get the entered region (which is not the same as a rect, which is what GUI calls a region), but not the entered rect. In this case the two are functionally the same in terms of area contained, but comparing them in a condition or somesuch in GUI would be difficult.

The function in question is: constant native GetTriggeringRegion takes nothing returns region

To give you an idea of the difference between a region and a rect, this is the "Unit Enters Region" GUI event (aka unit enters rect):

JASS:
function TriggerRegisterEnterRectSimple takes trigger trig, rect r returns event

    local region rectRegion = CreateRegion()

    call RegionAddRect(rectRegion, r)

    return TriggerRegisterEnterRegion(trig, rectRegion, null)

endfunction
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
JASS:
// EVENT_GAME_ENTER_REGION
constant native GetTriggeringRegion takes nothing returns region
constant native GetEnteringUnit takes nothing returns unit

I see no reason to get entered rect, rect as itself does nothing anyways(apart from enumerations)
 
Level 5
Joined
Jan 27, 2014
Messages
164
Definitely not in GUI.
Highly believe not even in JASS.

As a workaround, people usually use 2 regions. One smaller and another slightly bigger. And then run a loop to check if the unit within the said bigger region when the unit enter the smaller region.

A simple example:
Code:
    Events
        Unit - A unit enters Smaller Region 1
        Unit - A unit enters Smaller Region 2
        Unit - A unit enters Smaller Region 3
        Unit - A unit enters Smaller Region 4
        Unit - A unit enters Smaller Region 5
    Conditions
    Actions
        Set Z_Pt_General_1 = (Position of (Triggering unit))
        For each (Integer A) from 1 to 5, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Bigger Region[(Integer A)] contains Z_Pt_General_1) Equal to True
                    Then - Actions
                        - Do something -
                    Else - Actions

Then again, I believe there could be a system somewhere for this...
 
Status
Not open for further replies.
Top