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

Ability Cooldown and Triggered Orders

Status
Not open for further replies.
I am using the following trigger to cause a unit to warp to a new location upon casting a spell based on channel. The problem is that it doesn't fire the ability cool down because of the instant nature of move orders.

  • Dematerialize
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Undead Frigate
    • Actions
      • Set Dematerialize_Unit = (Target unit of issued order)
      • Set Dematerialize_Point = (Position of Dematerialize_Unit)
      • Unit - Create 1 Ghoul for Neutral Passive at Dematerialize_Point facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Create 1 Ghoul for Neutral Passive at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Move (Triggering unit) instantly to Dematerialize_Point
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Don't use MoveUnit function, try the SetUnitX/Y function since it does not interrupt orders;
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to ChannelAbility
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: local unit t = GetSpellTargetUnit()
      • Custom script: set udg_Dematerialize_Point = GetUnitLoc(t)
      • Custom script: set udg_TempLoc = GetUnitLoc(u)
      • Custom script: call SetUnitX(u, GetUnitX(t))
      • Custom script: call SetUnitY(u, GetUnitY(t))
      • Unit - Create 1 Ghoul for Neutral Passive at Dematerialize_Point facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Create 1 Ghoul for Neutral Passive at TempLoc facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_Dematerialize_Point)
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: set u = null
      • Custom script: set t = null
Just follow all those Custom script's word and you'll be fine.

You need to create a new Point variable named "TempLoc" because currently your (Position of (Triggering unit)) leaks.
 
Status
Not open for further replies.
Top