- Joined
- Apr 29, 2007
- Messages
- 826
So I know, the basic question of this has been answered like 100000 times.
I think I'm using the right method to calculate a unit's real height, but still, it looks somehow screwed.
While it should have a straight path.
My (somewhat irrelevant) code:
I think I'm using the right method to calculate a unit's real height, but still, it looks somehow screwed.

While it should have a straight path.
My (somewhat irrelevant) code:
JASS:
library Shoot initializer init requires Variables
private function Action takes nothing returns nothing
local real cx = PlayerX
local real cy = PlayerY
local real cz = PlayerHeight
local real tx = GetMouseTerrainX()
local real ty = GetMouseTerrainY()
local real tz = GetMouseTerrainZ()
local real distance = SquareRoot((tx-cx)*(tx-cx)+(ty-cy)*(ty-cy))/32
local real xvel = (tx-cx)/distance
local real yvel = (ty-cy)/distance
local real zvel = (tz-cz)/distance
local unit u
loop
set cx = cx + xvel
set cy = cy + yvel
set cz = cz + zvel
call MoveLocation(Loc, cx, cy)
set u = CreateUnit(Player(0), 'h001', cx, cy, CameraRotation)
call AddSpecialEffectTarget("Abilities\\Weapons\\DruidoftheTalonMissile\\DruidoftheTalonMissile.mdx", u, "origin")
call SetUnitFlyHeight(u, cz-GetLocationZ(Loc), 0)
call UnitApplyTimedLife(u, 'BHwe', 2)
exitwhen SquareRoot((tx-cx)*(tx-cx)+(ty-cy)*(ty-cy)) <= 32
endloop
call AddSpecialEffect("Abilities\\Spells\\Other\\AcidBomb\\BottleImpact.mdx", tx, ty)
set u = null
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterMouseEvent(t, 1)
call TriggerAddAction(t, function Action)
endfunction
endlibrary