• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Move unit without disrupting its orders

Status
Not open for further replies.

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
Hi guys. I'm trying to create a custom blink. But when I use Event Unit start the effect and then use the action Move unit instantly to Point, the spell itself doesnt go on cooldown. Here is the trigger if u ask for:
  • Preemptive Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Preemptive Strike
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
        • Then - Actions
          • Set TempReal = ((0.25 + (0.25 x (Real((Level of (Ability being cast) for (Triggering unit)))))) x ((Real((Agility of (Triggering unit) (Include bonuses)))) + (Real((Intelligence of (Triggering unit) (Include bonuses))))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempUnit has buff Ruinga ) Equal to True
            • Then - Actions
              • Set TempReal = (1.50 x TempReal)
            • Else - Actions
          • Set DamageType = 1
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing TempReal damage of attack type Spells and damage type Magic
          • Set DamageType = 0
        • Else - Actions
      • Set tempPoint = (Position of (Target unit of ability being cast))
      • Set TempInt = (Random integer number between 1 and 4)
      • Set TempUnit = (Target unit of ability being cast)
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
      • Unit - Add Stun PS to (Last created unit)
      • Unit - Set level of Stun PS for (Last created unit) to TempInt
      • Unit - Order (Last created unit) to Neutral - Hurl Boulder (Target unit of ability being cast)
      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
      • Wait 0.01 seconds
      • Set tempPoint2 = (tempPoint offset by 50.00 towards (Random angle) degrees)
      • Special Effect - Create a special effect at tempPoint2 using Abilities\Spells\Undead\ReplenishMana\ReplenishManaCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit - Move (Triggering unit) instantly to tempPoint2, facing tempPoint
      • Custom script: call RemoveLocation(udg_tempPoint)
      • Custom script: call RemoveLocation(udg_tempPoint2)
So basically, I want to know is there any possible way to move a unit from point to point but doesnt affect its issued order.
 
Level 13
Joined
Oct 10, 2009
Messages
439
There is a way to move it without interrupting order. Give me a sec and I'll edit this post


  • Set Point = (Position of (Triggering Unit))
  • Set Unit = (Triggering Unit)
  • Custom script: call SetUnitY(udg_Unit, GetLocationY(udg_Point))
  • Custom script: call SetUnitX(udg_Unit, GetLocationX(udg_Point))
  • Custom script: call RemoveLocation(udg_Point)
That's the trigger right there, set Unit X and Y.

Custom script: call SetUnitX( TAKES UNIT, TAKES REAL)

And they are the input paramaters, first being a unit and the second being the x / y coordinate desired. GetLocation grabs the X or Y coordinate of the point.

So replace
  • Unit - Move (Triggering unit) instantly to tempPoint2, facing tempPoint
With
  • Custom script: call SetUnitY(GetTriggerUnit(), GetLocationY(udg_tempPoint2))
  • Custom script: call SetUnitX(GetTriggerUnit(), GetLocationX(udg_tempPoint2))
If you want to detect for pathing, move an item to the point, check if it's in a (tiny 1x1) region area. And if the item isn't in that region, it's impassible:
  • Set Point[0] = (Position of (Picked unit))
  • Set Point[1] = (Point[0] offset by MovementNow towards MovementAngle degrees)
  • Item - Show G_ITEM
  • Item - Move G_ITEM to Point[1]
  • Region - Center G_RECT on Point[1]
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (G_ITEM is in G_RECT) Equal to True
    • Then - Actions
      • Custom script: call SetUnitY(GetEnumUnit(), GetLocationY(udg_Point[1]))
      • Custom script: call SetUnitX(GetEnumUnit(), GetLocationX(udg_Point[1]))
    • Else - Actions
      • Custom script: call SetUnitY(GetEnumUnit(), GetLocationY(udg_Point[0]))
      • Custom script: call SetUnitX(GetEnumUnit(), GetLocationX(udg_Point[0]))
  • Item - Hide G_ITEM
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
@slash
Since you are using JASS, why not fully utilize its efficiency by removing the call of location, and replace it with coordinates ?

  • Custom script: call SetUnitX(GetEnumUnit(), GetUnitX(GetEnumUnit()) + udg_MovementNow * Cos(bj_DEGTORAD * udg_MovementAngle))
  • Custom script: call SetUnitY(GetEnumUnit(), GetUnitY(GetEnumUnit()) + udg_MovementNow * Sin(bj_DEGTORAD * udg_MovementAngle))
 
Status
Not open for further replies.
Top