• 🏆 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!

[Spell] instantly move unit without stopping issued order

Status
Not open for further replies.
Level 21
Joined
Mar 29, 2020
Messages
1,237
Hey there,

I want to have a terrain function on my map that slightly moves units (a whirlpool), but without interupting their orders (the default is - after being insta-moved they stop.)
I want the units to continue trying to go wherever they were going while they are getting moved by the whirlpool (or conveyor belt...wtvr)

any ideas how to go about doing that?

thanks!
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
thanks, that did it!

so it seems - SetUnitPosition is hardcoded to order the unit to stop, but if you SetunitY and SetunitX seperately it doesn't do that. also then it lets you get units stuck in buildings and fun things like that...
 
Level 12
Joined
Feb 5, 2018
Messages
521
thanks, that did it!

so it seems - SetUnitPosition is hardcoded to order the unit to stop, but if you SetunitY and SetunitX seperately it doesn't do that. also then it lets you get units stuck in buildings and fun things like that...

You can still check the walkability when using X/Y thought to prevent this from happening.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
If you wanted a Move Unit Instantly function that didn't interrupt orders you could come up with a function for it. Something like this:
vJASS:
function MoveUnitInstantly takes unit u, location l returns nothing
    // move the dummy to the location (takes pathing into consideration)
    ShowUnit(moveDummy, true)
    SetUnitPositionLoc(moveDummy, l)
    ShowUnit(moveDummy, false)
    // move the unit to the position of the dummy (uninterrupted)
    SetUnitX(u, GetUnitX(moveDummy))
    SetUnitY(u, GetUnitY(moveDummy))
endfunction
Haven't tested it but I think the logic is sound.

The moveDummy unit would be a hidden/invulnerable ground unit with an average collision size (32 comes to mind). You would create it at the start of the game, hide it, and store it as moveDummy. It would NOT have the Locust ability.
 
Status
Not open for further replies.
Top