• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[JASS] Height problem

Status
Not open for further replies.
Level 11
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.
hm1ovmuzefj.jpg

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
 
Level 11
Joined
Apr 29, 2007
Messages
826
Hm, although it seems fine, there is something you might need to check. Go to your 'h001' dummy in the Units tab and scroll to Art - Maximum Roll Angle (degrees) and Art - Maximum Pitch Angle (degrees) and set them both to 0.
By the way, nice map! :infl_thumbs_up:

Well that didn't fix my problem, but whatever, thanks for the flowers. RtC is just awesome :)
 
Status
Not open for further replies.
Top