• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[General] Move instantly and play animation

Status
Not open for further replies.
Level 11
Joined
Jun 26, 2014
Messages
530
When I move a unit instantly every 0.03 seconds it doesn't play any animations even doe I've se it to play the walk or attack animation every 0.03 seconds. Why doesn't it work?

I was looking also for a set unit X and Y method but I could not get it to work. Please post triggers of how to do it the right way.


My current trigger:
  • Phantom Charge Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set SpellPChargeReal[1] = (SpellPChargeReal[1] + 1.00)
      • Set SpellPChargePoint[1] = (Position of SpellPChargeUnit[1])
      • Set SpellPChargePoint[2] = (SpellPChargePoint[1] offset by SpellPChargeReal[1] towards (Facing of SpellPChargeUnit[1]) degrees)
      • Set SpellPChargePoint[3] = (Position of SpellPChargeUnit[2])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer(SpellPChargeReal[2])) Less than or equal to (50 + (50 x (Level of Phantom Charge for SpellPChargeUnit[1])))
        • Then - Actions
          • Set SpellPChargeReal[2] = (SpellPChargeReal[2] + 0.50)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Distance between SpellPChargePoint[1] and SpellPChargePoint[3]))) Less than or equal to 130
        • Then - Actions
          • Unit - Turn collision for SpellPChargeUnit[1] On
          • Unit - Cause SpellPChargeUnit[1] to damage SpellPChargeUnit[2], dealing (SpellPChargeReal[2] + (1.00 x (Real((Strength of SpellPChargeUnit[1] (Include bonuses)))))) damage of attack type Spells and damage type Normal
          • Special Effect - Create a special effect attached to the origin of SpellPChargeUnit[2] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Animation - Play SpellPChargeUnit[1]'s walk animation
          • Unit - Make SpellPChargeUnit[1] face SpellPChargeUnit[2] over 0.02 seconds
          • Unit - Move SpellPChargeUnit[1] instantly to SpellPChargePoint[2]
 
My guess is that re-issuing the animation every time the loop runs is causing it to only play the first frame or two of the animation so it looks like nothing.

Try playing the animation once (in whatever trigger creates SpellPChargeUnit[1]). As for SetUnitXY you'll want to use the following lines as custom script:
JASS:
call SetUnitX(udg_SpellPChargeUnit[1], GetLocationX(udg_SpellPChargePoint[2]))
call SetUnitY(udg_SpellPChargeUnit[1], GetLocationY(udg_SpellPChargePoint[2]))
Usually it's better to just input the coordinates yourself but since you're already working with locations it's simpler just to leave them.
 
My guess is that re-issuing the animation every time the loop runs is causing it to only play the first frame or two of the animation so it looks like nothing.

Try playing the animation once (in whatever trigger creates SpellPChargeUnit[1]). As for SetUnitXY you'll want to use the following lines as custom script:
JASS:
call SetUnitX(udg_SpellPChargeUnit[1], GetLocationX(udg_SpellPChargePoint[2]))
call SetUnitY(udg_SpellPChargeUnit[1], GetLocationY(udg_SpellPChargePoint[2]))
Usually it's better to just input the coordinates yourself but since you're already working with locations it's simpler just to leave them.

MANY THANKS! +rep edit: can't give rep :/
 
When I move a unit instantly every 0.03 seconds it doesn't play any animations even doe I've se it to play the walk or attack animation every 0.03 seconds. Why doesn't it work?

I was looking also for a set unit X and Y method but I could not get it to work. Please post triggers of how to do it the right way.
Your trigger is too large. Here is my template for you. Order the priest to use mana shield and it would move in the facing direction.
To cancel moving order Hold Poisition.
Don't shy to ask me questions.
 

Attachments

I just want to point out that the "Move Unit Instantly" action issues a "stop" order each time you use it. The "stop" order causes the unit to cancel its animation, so you have to use the custom scripts that Pyrogasm showed you. However, you have to watch out since the SetUnitX and SetUnitY functions do not check for any collision with units or walls - even up and down cliffs and even into deep water. You could get the unit stuck in walls and it will travel through other units. If those things are not problems, then it is no worries, but otherwise you will have to apply some other code to prevent it from doing crazy things.
 
I just want to point out that the "Move Unit Instantly" action issues a "stop" order each time you use it. The "stop" order causes the unit to cancel its animation, so you have to use the custom scripts that Pyrogasm showed you. However, you have to watch out since the SetUnitX and SetUnitY functions do not check for any collision with units or walls - even up and down cliffs and even into deep water. You could get the unit stuck in walls and it will travel through other units. If those things are not problems, then it is no worries, but otherwise you will have to apply some other code to prevent it from doing crazy things.
Download my variant. The "Stop" order can't be avoided, but animation is going on.
 
Your trigger is too large. Here is my template for you. Order the priest to use mana shield and it would move in the facing direction.
To cancel moving order Hold Poisition.
Don't shy to ask me questions.

You said that mine's large but you have 5-6 different triggers man! :D

I just want to point out that the "Move Unit Instantly" action issues a "stop" order each time you use it. The "stop" order causes the unit to cancel its animation, so you have to use the custom scripts that Pyrogasm showed you. However, you have to watch out since the SetUnitX and SetUnitY functions do not check for any collision with units or walls - even up and down cliffs and even into deep water. You could get the unit stuck in walls and it will travel through other units. If those things are not problems, then it is no worries, but otherwise you will have to apply some other code to prevent it from doing crazy things.

Yeah I know that it stops my unit everytime but I've seen some tutorials where people put in the animation and it works, idk how and why.
 
Yeah I know that it stops my unit everytime but I've seen some tutorials where people put in the animation and it works, idk how and why.
I know the SetUnitX(myUnit, 0) and SetUnitY(myUnit, 0) will work as it doesn't issue the stop order. It just misses a lot of other small things that are quite nice, such as collision checking and moving the unit to the nearest open spot when units or terrain are in the way.
 
Was it help you? I mean animation while moving.

Wasn't able to make it work...

I know the SetUnitX(myUnit, 0) and SetUnitY(myUnit, 0) will work as it doesn't issue the stop order. It just misses a lot of other small things that are quite nice, such as collision checking and moving the unit to the nearest open spot when units or terrain are in the way.

That's not a problem since I've set the collision to ''off'' when the unit is charging.
 
Where's the trigger that starts the spell? Take this line:
  • Animation - Play SpellPChargeUnit[1]'s walk animation
And move it to that trigger (you only need to tell it to play the animation once).

Do you know how to use custom scripts? Replace this line:
  • Unit - Move SpellPChargeUnit[1] instantly to SpellPChargePoint[2]
with these two lines:
  • Custom script: call SetUnitX(udg_SpellPChargeUnit[1], GetLocationX(udg_SpellPChargePoint[2]))
  • Custom script: call SetUnitY(udg_SpellPChargeUnit[1], GetLocationY(udg_SpellPChargePoint[2]))
 
Where's the trigger that starts the spell? Take this line:
  • Animation - Play SpellPChargeUnit[1]'s walk animation
And move it to that trigger (you only need to tell it to play the animation once).

Doesn't work

Do you know how to use custom scripts? Replace this line:
  • Unit - Move SpellPChargeUnit[1] instantly to SpellPChargePoint[2]
with these two lines:
  • Custom script: call SetUnitX(udg_SpellPChargeUnit[1], GetLocationX(udg_SpellPChargePoint[2]))
  • Custom script: call SetUnitY(udg_SpellPChargeUnit[1], GetLocationY(udg_SpellPChargePoint[2]))

I know, I already did that when Pyrogasm told me to, that's why I said ''MANY THANKS!'' :D
 
What animation is the unit playing?

Are you stunning or pausing the unit somehow? If not, it can still attack while casting this ability which could cause some strange bugs (maybe cancel the animation, too, but I don't actually know).
 
The charging unit is supposed to charge, so he should walk(run) towards his target.
This is what it should look like. You aren't actually using the normal running, though. You are forcing the unit's movement towards the location and causing it to play an animation. I am not sure if you are stopping the unit from doing other things or not and that could be the problem. A unit that is locked in some special movement should be able to do anything else.
 
This is what it should look like. You aren't actually using the normal running, though. You are forcing the unit's movement towards the location and causing it to play an animation. I am not sure if you are stopping the unit from doing other things or not and that could be the problem. A unit that is locked in some special movement should be able to do anything else.

The unit is paused and the the loop trigger is activated. So while charging the caster cannot make any actions whatsoever but that doesn't stop the animation trigger from working, something else is but idk what. Like when the animation trigger is put in the loop it works but it refreshes every 0.03 seconds and it looks like he's stationary. If I put the animation trigger in another tigger it doesn't work at all...
 
Status
Not open for further replies.
Back
Top