-
WG Setup
-
Events
-
Conditions
-
Actions
-
Set VariableSet WayGate_Group = (Units of type Way Gate)
Remember to adjust the Unit-Types to fit your needs. The Paladin is the example unit that i'm "banning" from using Way Gates.
-
WG Target Object
-
Events
-
Unit - A unit Is issued an order targeting an object
-
Conditions
-
(Issued order) Equal to (Order(smart))
-
(Unit-type of (Target unit of issued order)) Equal to Way Gate
-
(Unit-type of (Triggering unit)) Equal to Paladin
-
Actions
-
Unit Group - Pick every unit in WayGate_Group and do (Actions)
-
Loop - Actions
-
Neutral Building - Disable (Picked unit)
-
Custom script: call PreventWayGate()
I'm using Bribe's
Unit Indexer as well. This is to make sure that a unit is actually on a Way Gate when you issue a Point order (that way the trigger isn't running all of the time). You might have to add additional Point orders as well for Point abilities since they will fire the trigger.
-
WG Target Point
-
Events
-
Unit - A unit Is issued an order targeting a point
-
Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(Issued order) Equal to (Order(smart))
-
(Issued order) Equal to (Order(move))
-
(Issued order) Equal to (Order(patrol))
-
(Issued order) Equal to (Order(attack))
-
IsOnWayGate[(Custom value of (Triggering unit))] Equal to True
-
(Unit-type of (Triggering unit)) Equal to Paladin
-
Actions
-
Unit Group - Pick every unit in WayGate_Group and do (Actions)
-
Loop - Actions
-
Neutral Building - Disable (Picked unit)
-
Custom script: call PreventWayGate()
These 2 Triggers need to use all of your Way Gate regions.
-
Enter WG
-
Events
-
Unit - A unit enters WayGate A <gen>
-
Unit - A unit enters WayGate B <gen>
-
Conditions
-
Actions
-
Set VariableSet IsOnWayGate[(Custom value of (Triggering unit))] = True
-
Leave WG
-
Events
-
Unit - A unit leaves WayGate A <gen>
-
Unit - A unit leaves WayGate B <gen>
-
Conditions
-
Actions
-
Set VariableSet IsOnWayGate[(Custom value of (Triggering unit))] = False
This trigger corrects an error that Regions have. Their rects are off causing certain Region-related things to not work properly. If you've ever had issues with Regions it's probably because of this issue.
Make sure to add all of your Way Gate regions in here:
-
Fix Regions
-
Events
-
Conditions
-
Actions
-
Custom script: local rect r
-
-------- --------
-
-------- Set this to the number of Regions you want to fix --------
-
Set VariableSet FixRegionCount = 2
-
-------- --------
-
-------- Assign each Region you want to fix --------
-
Set VariableSet FixRegions[1] = WayGate A <gen>
-
Set VariableSet FixRegions[2] = WayGate B <gen>
-
-------- --------
-
-------- Once our variables are setup, loop through all of the FixRegions and adjust them so that they have the correct size --------
-
For each (Integer A) from 1 to FixRegionCount, do (Actions)
-
Loop - Actions
-
Custom script: set r = udg_FixRegions[bj_forLoopAIndex]
-
Custom script: call SetRect(r, GetRectMinX(r) - 32., GetRectMinY(r) - 32., GetRectMaxX(r) + 32., GetRectMaxY(r) + 32.)
-
Custom script: set r = null
Here's the code for the Jass functions:
vJASS:
function EnableWayGates takes nothing returns nothing
call WaygateActivate(GetEnumUnit(), true)
endfunction
function PreventWayGateFunc takes nothing returns nothing
local timer t = GetExpiredTimer()
call ForGroup(udg_WayGate_Group, function EnableWayGates)
call PauseTimer(t)
call DestroyTimer(t)
set t = null
endfunction
function PreventWayGate takes nothing returns nothing
local timer t = CreateTimer()
call TimerStart(t, 0.05, false, function PreventWayGateFunc)
set t = null
endfunction