- Joined
- Mar 16, 2014
- Messages
- 169
I have a unit with a metamorphosis ability that turns them into a flying hero. When they come out of it and become a land unit again, I want to force them onto the nearest walkable land.
I have a system that checks if land is walkable or not I am using, which works fine. This existing trigger will put the unit onto walkable land when asked, but definitely not the closest land. It just finds arbitrary land that is somewhat closeby. Here's my two triggers.
I have a system that checks if land is walkable or not I am using, which works fine. This existing trigger will put the unit onto walkable land when asked, but definitely not the closest land. It just finds arbitrary land that is somewhat closeby. Here's my two triggers.
-
Metamorph Cast
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Metamorphosis
-
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempInt Equal to 1
-
-
Then - Actions
-
Set VariableSet TempInt = 0
-
Set VariableSet HeroWithFlyingTransformation = (Triggering unit)
-
Set VariableSet LandingPoint = (Position of HeroWithFlyingTransformation)
-
Set VariableSet LandingDistance = 50.00
-
Set VariableSet LandingDegrees = 0.00
-
Trigger - Run Find land <gen> (ignoring conditions)
-
-
Else - Actions
-
Set VariableSet TempInt = 1
-
-
-
-
-
Find land
-
Events
-
Conditions
-
Actions
-
Set VariableSet CP_Point = LandingPoint
-
Trigger - Run Check Walkability <gen> (ignoring conditions)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
CP_PointIsWalkable Equal to True
-
-
Then - Actions
-
Unit - Move HeroWithFlyingTransformation instantly to LandingPoint
-
Custom script: call RemoveLocation( udg_LandingPoint )
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
LandingDegrees Less than or equal to 360.00
-
-
Then - Actions
-
Set VariableSet LandingPoint = (LandingPoint offset by LandingDistance towards LandingDegrees degrees.)
-
Set VariableSet LandingDegrees = (LandingDegrees + 25.00)
-
-
Else - Actions
-
Set VariableSet LandingDegrees = 0.00
-
Set VariableSet LandingDistance = (LandingDistance + 50.00)
-
-
-
Trigger - Run (This trigger) (ignoring conditions)
-
-
-
-