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!
Use Unit-type of Triggering Unit to exclude specific types of units. An OR is necessary for multiple unit-types. In this example i'm preventing the Paladin from using a Way Gate.
Waygate Prevention
Events
Unit - A unit Is issued an order targeting an object
Conditions
(Issued order) Equal to (Order(smart))
(Unit-type of (Triggering unit)) Equal to Paladin
(Unit-type of (Target unit of issued order)) Equal to Way Gate
Actions
Set VariableSet TempPoint = (Position of (Target unit of issued order))
Unit - Order (Triggering unit) to Move To TempPoint
The trigger replaces the order when you right click a Way Gate with a Move order to the position of the Way Gate. This prevents the unit from teleporting.
Use Unit-type of Triggering Unit to exclude specific types of units. An OR is necessary for multiple unit-types. In this example i'm preventing the Paladin from using a Way Gate.
Waygate Prevention
Events
Unit - A unit Is issued an order targeting an object
Conditions
(Issued order) Equal to (Order(smart))
(Unit-type of (Triggering unit)) Equal to Paladin
(Unit-type of (Target unit of issued order)) Equal to Way Gate
Actions
Set VariableSet TempPoint = (Position of (Target unit of issued order))
Unit - Order (Triggering unit) to Move To TempPoint
The trigger replaces the order when you right click a Way Gate with a Move order to the position of the Way Gate. This prevents the unit from teleporting.
Can't a unit just bypass it by clicking their destination on the other side of the gate? I don't think 'smart' Waygate is necessary for units to path through it.
Can't a unit just bypass it by clicking their destination on the other side of the gate? I don't think 'smart' Waygate is necessary for units to path through it.
Edit: Hold on, I somehow managed to unset their Regions when I first tested it. Testing it now.
I managed to get it to work for targeting the Way Gates but I couldn't figure out a fix for when players teleport by right clicking the ground near a Way Gate. It probably needs to be triggered from scratch.
Alright, I THINK I got it working. Hopefully you use the latest version and can open my map.
When a "banned" unit attempts to use a Way Gate I pick every single Way Gate in the map and disable them for 0.05 seconds. It seems to work from my testing but you can never be certain with these things.
WG Setup
Events
Map initialization
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
Map initialization
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]
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
Requires Bribe's Unit Indexer, link in my signature. (Or any Unit Indexer really)
Edit #1: Added version 2. I forgot to destroy the Timers causing a leak. Also removed the BJ stuff from the code.
Edit #2: Added version 3. This one seems to fix everything but has some extra steps/variables required.
I wonder if there's some classification of unit or some type of targeting that prevents a unit from using a Way Gate. That would probably solve everything.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.