Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Update Compass
- Options: Action
- Return Type: (None)
- Parameters
- Player = 0 <Integer>
- Grammar Text: Update Compass for player (Player)
- Hint Text: Makes the compass point the right way, and disables it if necessary
- Custom Script Code
- Local Variables
- Target = Player Target Unit[Player] <Unit>
- Player = Hero[Player] <Unit>
- Angle = (Angle from (Position of Player) to (Position of Target)) <Real>
- Yaw = (Current camera yaw of player Player) <Real>
- Difference = 0.0 <Real>
- correct point = Off <Compass Points>
- ------- (yaw) - (difference) = angle
- Actions
- ------- Convert yaw to a value from 0 to 360
- General - If (Conditions) then do (Actions) else do (Actions)
- If
- Yaw < 0.0
- Then
- Variable - Set Yaw = (360.0 + Yaw)
- Else
- ------- Convert angle to a value from 0 to 360
- General - If (Conditions) then do (Actions) else do (Actions)
- If
- Angle < 0.0
- Then
- Variable - Set Angle = (360.0 + Angle)
- Else
- ------- Find the new angle (between the 3 points)
- Variable - Set Difference = (Yaw - Angle)
- Variable - Set Difference = (Abs(Difference))
- ------- Output for debug
- UI - Clear Chat Messages for (All players)
- UI - Display (Combine ("Yaw: ", (Text(Yaw) with Any Precision decimal places), " Angle: ", (Text(Angle) with Any Precision decimal places), " New Angle: ", (Text(Difference) with Any Precision decimal places))) for (All players) to Subtitle area
- General - If (Conditions) then do (Actions) else do (Actions)
- If
- Or
- Conditions
- And
- Conditions
- Yaw > Angle
- 1 <= Difference <= 90
- And
- Conditions
- Yaw < Angle
- 270 <= Difference <= 360
- Then
- Variable - Set correct point = TopRight
- Else
- General - If (Conditions) then do (Actions) else do (Actions)
- If
- Or
- Conditions
- And
- Conditions
- Yaw < Angle
- 1 <= Difference <= 90
- And
- Conditions
- Yaw > Angle
- 270 <= Difference <= 360
- Then
- Variable - Set correct point = TopLeft
- Else
- General - If (Conditions) then do (Actions) else do (Actions)
- If
- Or
- Conditions
- And
- Conditions
- Yaw < Angle
- 90 <= Difference <= 180
- And
- Conditions
- Yaw > Angle
- 180 <= Difference <= 270
- Then
- Variable - Set correct point = BotLeft
- Else
- General - If (Conditions) then do (Actions) else do (Actions)
- If
- Or
- Conditions
- And
- Conditions
- Yaw > Angle
- 90 <= Difference <= 180
- And
- Conditions
- Yaw < Angle
- 180 <= Difference <= 270
- Then
- Variable - Set correct point = BotRight
- Else
- General - Switch (Actions) depending on correct point
- Cases
- General - If (TopLeft)
- Actions
- Dialog - Set Compass.Compass Icon image to Images.TopLeft for (Player group(Player))
- General - If (TopRight)
- Actions
- Dialog - Set Compass.Compass Icon image to Images.TopRight for (Player group(Player))
- General - If (BotRight)
- Actions
- Dialog - Set Compass.Compass Icon image to Images.BottomRight for (Player group(Player))
- General - If (BotLeft)
- Actions
- Dialog - Set Compass.Compass Icon image to Images.BottomLeft for (Player group(Player))
- General - If (Locked)
- Actions
- Dialog - Set Compass.Compass Icon image to Images.Locked for (Player group(Player))
- Default
- Dialog - Set Compass.Compass Icon image to Images.Empty for (Player group(Player))
- ------- Override direction if special situation arises
- General - If (Conditions) then do (Actions) else do (Actions)
- If
- Or
- Conditions
- locked[Player] == true
- Player Target Player[Player] == 0
- (Distance between (Position of Hero[Player]) and (Position of Player Target Unit[Player])) <= compass_cutoff_distance[Player Target Player[Player]]
- Then
- Dialog - Set Compass.Compass Icon image to Images.Locked for (Player group(Player))
- Else
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement