- Joined
- Jul 22, 2015
- Messages
- 3,485
I'm making what I call a "Region Teleportation System" for someone so that they can easily make regions from the Region Palette, and then connect them via this system without having to create a seperate trigger for every single region. To avoid an infinite loop, I turn the trigger off, move the unit to the appropriate region, and then I turn the trigger back on. However, it seems to not work because the unit still gets teleported back and forth.
Here is how the regions are connected:
EDIT - Okay so I added a debug message that prints the triggering unit's X/Y to ensure that the unit was at the location before turning the trigger back on. The messages confirm that the unit is in fact there before the trigger is turned back on.
EDIT 2 -
Here is how the regions are connected:
-
RegSys List
-
Events
-
Conditions
-
Actions
-
Set RegSys_AddRegion1 = A1 <gen>
-
Set RegSys_AddRegion2 = A2 <gen>
-
Set RegSys_AddFacingAngle1 = 270.00
-
Set RegSys_AddFacingAngle2 = 90.00
-
Trigger - Run RegSys_TRIGGER_CONNECT_REGIONS (ignoring conditions)
-
-------- --------
-
Set RegSys_AddRegion1 = B1 <gen>
-
Set RegSys_AddRegion2 = B2 <gen>
-
Set RegSys_AddFacingAngle1 = 270.00
-
Set RegSys_AddFacingAngle2 = 90.00
-
Trigger - Run RegSys_TRIGGER_CONNECT_REGIONS (ignoring conditions)
-
-------- --------
-
Set RegSys_AddRegion1 = C1 <gen>
-
Set RegSys_AddRegion2 = C2 <gen>
-
Set RegSys_AddFacingAngle1 = 270.00
-
Set RegSys_AddFacingAngle2 = 90.00
-
Trigger - Run RegSys_TRIGGER_CONNECT_REGIONS (ignoring conditions)
-
-------- --------
-
Set RegSys_AddRegion1 = D1 <gen>
-
Set RegSys_AddRegion2 = D2 <gen>
-
Set RegSys_AddFacingAngle1 = 270.00
-
Set RegSys_AddFacingAngle2 = 90.00
-
Trigger - Run RegSys_TRIGGER_CONNECT_REGIONS (ignoring conditions)
-
-
-
RegSys Add
-
Events
-
Conditions
-
Actions
-
-------- child keys for Region Teleportation System --------
-
-------- 0 - center of region to teleport to --------
-
-------- 1 - facing angle --------
-
-------- --------
-
-------- --------
-
Custom script: local region region1 = CreateRegion()
-
Custom script: local region region2 = CreateRegion()
-
Custom script: call RegionAddRect(region1, udg_RegSys_AddRegion1)
-
Custom script: call RegionAddRect(region2, udg_RegSys_AddRegion2)
-
-------- region 1 --------
-
Custom script: set udg_RegSys_RegId = GetHandleId(region1)
-
Hashtable - Save Handle Of(Center of RegSys_AddRegion2) as 0 of RegSys_RegId in RegSys_Hash
-
Hashtable - Save RegSys_AddFacingAngle2 as 1 of RegSys_RegId in RegSys_Hash
-
-------- region 2 --------
-
Custom script: set udg_RegSys_RegId = GetHandleId(region2)
-
Hashtable - Save Handle Of(Center of RegSys_AddRegion1) as 0 of RegSys_RegId in RegSys_Hash
-
Hashtable - Save RegSys_AddFacingAngle1 as 1 of RegSys_RegId in RegSys_Hash
-
-------- --------
-
Custom script: call TriggerRegisterEnterRegion(udg_RegSys_TRIGGER_MOVE_UNIT, region1, null)
-
Custom script: call TriggerRegisterEnterRegion(udg_RegSys_TRIGGER_MOVE_UNIT, region2, null)
-
Custom script: set region1 = null
-
Custom script: set region2 = null
-
-------- --------
-
-------- resetting global variables --------
-
Set RegSys_AddRegion1 = No region
-
Set RegSys_AddRegion2 = No region
-
Set RegSys_AddFacingAngle1 = 0.00
-
Set RegSys_AddFacingAngle2 = 0.00
-
-
-
RegSys Move Unit
-
Events
-
Conditions
-
Actions
-
-------- child keys for Region Teleportation System --------
-
-------- 0 - center of region to teleport to --------
-
-------- 1 - facing angle --------
-
-------- --------
-
-------- --------
-
-------- moving unit to connected region --------
-
Trigger - Turn off RegSys_TRIGGER_MOVE_UNIT
-
Custom script: set udg_RegSys_RegId = GetHandleId(GetTriggeringRegion())
-
Unit - Move (Triggering unit) instantly to (Load 0 of RegSys_RegId in RegSys_Hash), facing (Load 1 of RegSys_RegId from RegSys_Hash) degrees
-
Trigger - Turn on RegSys_TRIGGER_MOVE_UNIT
-
-
SetUnitX()
and SetUnitY()
, but I still get the same issue.EDIT - Okay so I added a debug message that prints the triggering unit's X/Y to ensure that the unit was at the location before turning the trigger back on. The messages confirm that the unit is in fact there before the trigger is turned back on.
EDIT 2 -
GetHandleId(udg_RegSys_TRIGGER_MOVE_UNIT)
& GetHandleId(GetTriggeringTrigger())
both have the same values.
Last edited: