• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Moeveing unit instantly to point

Status
Not open for further replies.
Level 13
Joined
Mar 4, 2009
Messages
1,156
  • move unit for 500 range
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Unit - Move (Ordered unit) instantly to (+500 range to target point of issued order)


i just want this work like blink ability with cast range 500
 
Level 13
Joined
Nov 4, 2006
Messages
1,239
  • Events
    • Unit - A unit Is issued an order targeting a point
  • Conditions
  • Actions
    • Set temppoint = ((Position of (Triggering unit)) offset by 500.00 towards (Angle from (Position of (Triggering unit)) to (Target point of issued order)) degrees)
    • Unit - Move (Ordered unit) instantly to (temppoint)
    • Custom script: call RemoveLocation(udg_temppoint)
like this?
 
Level 13
Joined
Nov 4, 2006
Messages
1,239
i'm not sure about that either, but if so you better clean the leaks as i guess the trigger fires pretty often in your map, solution:

  • Events
    • Unit - A unit Is issued an order targeting a point
  • Conditions
  • Actions
    • Set temppoint1 = ((Position of (Triggering unit))
    • Set temppoint2 = ((Target point of issued order))
    • Set temppoint = ((temppoint1) offset by 500.00 towards (Angle from (temppoint1) to (temppoint2)) degrees)
    • Unit - Move (Ordered unit) instantly to (temppoint)
    • Custom script: call RemoveLocation(udg_temppoint)
    • Custom script: call RemoveLocation(udg_temppoint1)
    • Custom script: call RemoveLocation(udg_temppoint2)
i hate leaks :/
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
  • Events
    • Unit - A unit Is issued an order targeting a point
  • Conditions
  • Actions
    • Set temppoint = ((Position of (Triggering unit)) offset by 500.00 towards (Angle from (Position of (Triggering unit)) to (Target point of issued order)) degrees)
    • Unit - Move (Ordered unit) instantly to (temppoint)
    • Custom script: call RemoveLocation(udg_temppoint)
like this?

y..i think this trigger has no leaks

i don´t know do leak exist at all :D

i mean,do you really think when you have blink ability and that (blizzard) trigger will set 3 points,move unit,and remove them? -.-
 
Level 4
Joined
Jun 10, 2009
Messages
67
i'm not sure about that either, but if so you better clean the leaks as i guess the trigger fires pretty often in your map, solution:

  • Events
    • Unit - A unit Is issued an order targeting a point
  • Conditions
  • Actions
    • Set temppoint1 = ((Position of (Triggering unit))
    • Set temppoint2 = ((Target point of issued order))
    • Set temppoint = ((temppoint1) offset by 500.00 towards (Angle from (temppoint1) to (temppoint2)) degrees)
    • Unit - Move (Ordered unit) instantly to (temppoint)
    • Custom script: call RemoveLocation(udg_temppoint)
    • Custom script: call RemoveLocation(udg_temppoint1)
    • Custom script: call RemoveLocation(udg_temppoint2)
i hate leaks :/

Dude you hate leaks, but this also leaks...
Check this out:
  • Events
    • Unit - A unit Is issued an order targeting a point
  • Conditions
  • Actions
    • Set temppoint1 = ((Position of (Triggering unit))
    • Set temppoint2 = ((Target point of issued order))
    • Set temppoint = ((temppoint1) offset by 500.00 towards (Angle from (temppoint1) to (temppoint2)) degrees)
    • Unit - Pause (Ordered Unit)
    • Unit - Move (Ordered unit) instantly to (temppoint)
    • Unit - Unpause (Ordered Unit)
    • Custom script: call RemoveLocation(udg_temppoint)
    • Custom script: call RemoveLocation(udg_temppoint1)
    • Custom script: call RemoveLocation(udg_temppoint2)
You must first Pause the unit before you move it, else ability cooldowns will malfunction and be instantly refreshed. Once you moved the unit, unpause it.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Every time you refer to a location, if you dont remove it, it leaks... always. And yes, i do else it will leak

well i once tested do locations leak,i had about 500 locations not removing it or setting to a variable and nothing happens.

i only saw special effect can leak if you have 500+ not destroyed special effects in SAME place,in that place you will have "big sky" of that effect and you will not see because of that "sky",but it makes no lags
 
Level 8
Joined
Nov 9, 2008
Messages
502
BTW if you want to replicate the original blink you will want to add a pathing check which cancels actions and returns a message if not pathable ;)

I just spent 1 hour trying to do this in Jass and replacing locations with x and y. Now I have a headache and a malfunctioning trigger. LOL fun:

JASS:
function Blink takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local location lt = GetSpellTargetLoc()
    local real xt = GetLocationX(lt)
    local real yt = GetLocationY(lt)
    local real xu = GetUnitX(u)
    local real yu = GetUnitY(u)
    local real xd = xt - xu
    local real yd = yt - yu
    local real d = SquareRoot(xd * xd + yd * yd)
    local real a = (180 / 3.14159) * Atan2(yt - yu, xt - xu)
    local real xa = Cos(a) * 500 + xu //Probably the problem
    local real ya = Sin(a) * 500 + yu //Probably the problem
        if (GetSpellAbilityId() == 'A000' ) then
            if (IsTerrainPathable( xt, yt, PATHING_TYPE_WALKABILITY) == false) then
                call DisplayTextToPlayer( GetOwningPlayer(u), 0, 0, "Cannot target there")
            elseif ( d > 500 ) then
                if (IsTerrainPathable( xa, ya, PATHING_TYPE_WALKABILITY) == false) then
                    call DisplayTextToPlayer( GetOwningPlayer(u), 0, 0, "Cannot target there")
                else
                    call SetUnitX( u, xa)
                    call SetUnitY( u, ya)
                endif
            else
                call SetUnitX( u, xt)
                call SetUnitY( u, yt)
            endif
        endif
    call RemoveLocation(lt)
    set lt = null
    set u = null
endfunction
 
Status
Not open for further replies.
Top