Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # TeleportTest.crpl
- # Created on: 4/30/2018 1:22:12 PM
- # ------------------------------------------
- once
- ShowTraceLog
- ClearTraceLog
- Self CONST_COUNTSFORVICTORY 0 SetUnitAttribute
- Self CONST_CREATEPZ 0 SetUnitAttribute
- Self CONST_NULLIFIERDAMAGES 0 SetUnitAttribute
- Self CONST_TAKEMAPSPACE 0 SetUnitAttribute
- #CurrentCoords 1 sub GetUnitAt ->unit
- 1084 ->unit
- <-unit Trace
- <-unit CONST_PIXELCOORDX GetUnitAttribute ->lastPostionX
- <-unit CONST_PIXELCOORDY GetUnitAttribute ->lastPostionY
- 0 ->done
- endonce
- <-done if
- return
- endif
- <-unit CONST_PIXELCOORDX GetUnitAttribute ->currentPostionX
- <-unit CONST_PIXELCOORDY GetUnitAttribute ->currentPostionY
- <-currentPostionX <-lastPostionX neq or ( <-currentPostionY <-lastPostionY neq ) if
- "MOVING" Trace
- <-currentPostionX ->x1
- <-currentPostionY ->y1
- <-currentPostionY <-lastPostionY sub <-currentPostionX <-lastPostionX sub atan2 ->a1
- <-a1 PI 2 div add ->angleOffset
- <-x1 <-angleOffset cos 8 mul add ->xNew
- <-y1 <-angleOffset sin 8 mul add ->yNew
- <-unit CONST_PIXELCOORDX <-xNew SetUnitAttribute
- <-unit CONST_PIXELCOORDY <-yNew SetUnitAttribute
- 1 Delay
- <-xNew ->lastPostionX
- <-yNew ->lastPostionY
- <-unit CONST_PIXELCOORDX GetUnitAttribute ->currentPostionX
- <-unit CONST_PIXELCOORDY GetUnitAttribute ->currentPostionY
- <-currentPostionX ->x2
- <-currentPostionY ->y2
- <-currentPostionY <-lastPostionY sub <-currentPostionX <-lastPostionX sub atan2 ->a2
- #use matrix magic
- <-a1 cos ->m1
- <-a2 cos neg ->m2
- <-x2 <-x1 sub ->m3
- <-a1 sin ->m4
- <-a2 sin neg ->m5
- <-y2 <-y1 sub ->m6
- <-m3 <-m2 <-m6 <-m5 @Determinant div ( <-m1 <-m2 <-m4 <-m5 @Determinant ) ->t
- <-x1 <-a1 cos <-t mul add ->targetX
- <-y1 <-a1 sin <-t mul add ->targetY
- "Target:" <-targetX <-targetY PixelToCell Trace3
- "MORTAR" <-targetX <-targetY PixelToCell CreateUnit pop
- <-unit CONST_PIXELCOORDX <-x1 SetUnitAttribute
- <-unit CONST_PIXELCOORDY <-y1 SetUnitAttribute
- 1 ->done
- endif
- <-unit CONST_PIXELCOORDX GetUnitAttribute ->lastPostionX
- <-unit CONST_PIXELCOORDY GetUnitAttribute ->lastPostionY
- :Determinant # f f f f - f
- ->v4 ->v3 ->v2 ->v1
- <-v1 <-v4 mul sub ( <-v2 <-v3 mul )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement