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

[Spell] fly hight change by trigger - does it need a new way?

Status
Not open for further replies.
Level 9
Joined
May 31, 2010
Messages
366
So i have this code and doesnt work, the unit is flying by default on a hight of 1000, it gets summoned high up, then comes down (and should go up later when its done traveling and be removed) but it just doesnt work .. idk why...

Code:
BFDCast
    Ereignisse
        Einheit - A unit Startet den Effekt einer Fähigkeit
    Bedingungen
        (Ability being cast) Gleich Blackfire Dragon [T]
    Aktionen
        Set BFO = (Casting unit)
        Set loc35 = (Position of BFO)
        Set loc36 = (Target point of ability being cast)
        Set Facing_BFO = ((Facing of BFO) + 180.00)
        Einheit - Create 1 Blackfire Dragon for (Owner of BFO) at (loc36 offset by -750.00 towards Facing_BFO degrees) facing (Facing_BFO) degrees
        Set BFD = (Last created unit)
        Einheit - Add Crow to BFD
        Einheit - Remove Crow from BFD
        Animation - Change BFD flying height to 1.00 at 2.00
        Einheit - Order BFD to Bewegen nach (loc35 offset by 750.00 towards Facing_BFO degrees)
 
Last edited:
Level 13
Joined
May 10, 2009
Messages
868
Well, you have to add another animation action telling the unit to go back to its initial flying height. However, you'll need to estimate a wait time before you try to move it back, because Blizzard's animation interpolation function is weird. Why? when you tell a unit to move downwards from 1000 to 1 at a rate of 2, in fact the unit's current flying height will be set to 1 right away, regardless of the rate amount that you've added there, but you'll see the model moving slowly though.

Also:
  • From 1000 to 1 at rate of 2 is too slow, don't you think? It will take around 500 seconds to complete that maneuver.
  • Add/remove crow form is required for ground units only; flying units don't need that.
 
Last edited:
Level 9
Joined
May 31, 2010
Messages
366
Well, you have to add another animation action telling the unit to go back to its initial flying height.

yes i didnt add it yet because its not even going down.

okay so ill go to remove the crow form thing first


From 1000 to 1 at rate of 2 is too slow, don't you think? It will take around 500 seconds to complete that maneuver.

i thought it means the time, okay ill try to up that value and see if that works, thank you :D

edit: just to be clear about it "to X at rate of Y" the value i put in "Y" will reduce the flying fight by that value each second until it reaches X right? so if i put it at 200 it will take 5 seconds for sure?


However, you'll need to estimate a wait time before you try to move it back, because Blizzard's animation interpolation function is weird.

ah yes, i think ill figure out a decent "wait" by just "try and error" xD


Edit2:


Code:
BFDCast
    Ereignisse
        Einheit - A unit Startet den Effekt einer Fähigkeit
    Bedingungen
        (Ability being cast) Gleich Blackfire Dragon [T]
    Aktionen
        Set BFO = (Casting unit)
        Set loc35 = (Position of BFO)
        Set Facing_BFO = ((Facing of BFO) + 180.00)
        Einheit - Create 1 Blackfire Dragon for (Owner of BFO) at (loc35 offset by -900.00 towards Facing_BFO degrees) facing (Facing_BFO) degrees
        Set BFD = (Last created unit)
        Animation - Change BFD flying height to 1.00 at 200.00
        Einheit - Order BFD to Bewegen nach (loc35 offset by 200.00 towards Facing_BFO degrees)
        Auslöser - Turn on (This trigger)

it still doesnt go down it just stays up and moves the way - would you (or someone) mind having a look at it?
 
Last edited:
Level 13
Joined
May 10, 2009
Messages
868
Assuming the unit has a flying movement type, its default height is 1000, and you set it to 1 at 200. Then yes - It takes around 5 seconds to completely move that unit.

I've added a simple trigger that spawns a flying footman. It sets its fly height to 1, and after 5 seconds its fly height is set back to 1000. Do note that Wait actions are not precise, and might cause problems related to variables being overridden when multiple units cast that spell. That why I'm using a local variable below. Still, it's not the best choice, but the simplest by far.

  • Something
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spell
    • Actions
      • Custom script: local unit u
      • -------- In object editor, footman has flying movement type, and its default height is set to 1000 --------
      • Unit - Create 1 Footman for Player 1 (Red) at (Target point of ability being cast) facing Default building facing degrees
      • Set tmp_unit = (Last created unit)
      • Custom script: set u = udg_tmp_unit
      • Animation - Change tmp_unit flying height to 1.00 at 200.00
      • Wait 5.00 seconds
      • Custom script: set udg_tmp_unit = u
      • Animation - Change tmp_unit flying height to 1000.00 at 200.00
      • Custom script: set u = null
 

Attachments

  • test.w3x
    17.1 KB · Views: 27
Last edited:
Status
Not open for further replies.
Top