• 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.

[General] Trigger and Animation

Status
Not open for further replies.
Level 16
Joined
May 2, 2011
Messages
1,351
Hello everybody!

First, I wonder how I can play specific animation for a unit: attack 2 for example, or stand 4. when I tried playing (attack 2) and playing (stand 3) animation, just random attack or stand animation played, respectively.

Second, I wonder what the difference there is if we played a units animation with specific rarity
 
Last edited:
Level 13
Joined
Jan 21, 2012
Messages
1,982
Ok so this is wwhat I did to test if it works:
So I puted a footman on the map I pressed trigger editor and I added cinematic mode and selected my camer just to test then I pressed animation I selected the footman and said to him to attack 2 and so he did...
This is what might you done not to work:

Maybe you didint see him
Maybe you typed it wrong or done it

But when you do press animation it will not repeat it will do the stand or attack (nvm) do it one time...I dont know how to fix that... :)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You see, each unit has their own UnitAnimationByIndex ranges from 0 ~ MaxNumberOfAnimationTheUnitHas

All the number of indexes is in Integer.

I have attached a test map for you, these are the instructions;
1. Select a unit (will initially play a 0 index of animation for that unit).
2. Press "ESC" key to add current index and see the unit is playing its animation differently this time.

@OT
You should know which index suits your unit, and keep using it.
For example, you want attack 2 and stand 4 right ?
Perhaps;
attack 2 - Index is 3
stand 4 - Index is 6

You must use the function SetUnitAnimationByIndex to detect which index refer to the animation you want.
 

Attachments

  • SetUnitAnimationByIndex.w3x
    12.6 KB · Views: 97
Level 33
Joined
Mar 27, 2008
Messages
8,035
Yes, here;
  • Custom script: call SetUnitAnimationByIndex(GetTriggerUnit(), 3)
This will play Animation Index of 3 by (Triggering unit).

I just did with variable because it's important for you to know first which Index does your animation is, once you have know it (assume the Index is 3), you can just replace them with "3" just like I did above.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Are you trying to create a cinematic ?

Okay, each pre-set units in the map has their own unique ID which we can refer to.

The first unit has always starts from 0000 such as;
  • Unit - Kill Blood Mage 0000 <gen>
If that is converted to custom script, it would become;
JASS:
call KillUnit(gg_unit_Hblm_0000)
Since the unit is Blood Mage, its Raw ID is "Hblm" (according to Object Editor) if it's Paladin it should be "Hpal" and so on (you can check each unit's ID in Object Editor by pressing "CTRL + D")

The "0000" refers to the number ID/orders they are put in the map such as;
0000 - First unit put in the map
0001 - Second unit put in the map

And so on...



Also;
I do not want to create a variable for each unit since they are too many already.
GetTriggerUnit() is NOT a variable, same goes to (Triggering unit), they are not variable.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I think you have to use Waits for it ?
Since queuing animation needs "string" parameters whereas we should use Integer as Index of an Animation.

Do you have problems with Waits ?

Determines the duration of an animation first before putting a Wait of X second (X refers to duration of an animation)
 
Level 16
Joined
May 2, 2011
Messages
1,351
Man! it is not working with me, can you show an example of using the custom script
This one is not working
  • Custom script: call SetUnitAnimationByIndex(gg_Hpal_0004, udg_Integer)
udg instead of gg is also not working. deleting gg_ also does not work.

Edit: even this one does not work
  • Custom script: call SetUnitAnimationByIndex(unit_Hpal_0004, udg_Integer)
 
Last edited:
Level 16
Joined
May 2, 2011
Messages
1,351
tried that too, it does not work
  • Actions
    • Set Integer = 0
    • Set Unit = (Triggering unit)
    • Custom script: call SetUnitAnimationByIndex(gg_unit_Hpal_0004, udg_Integer)
    • Cinematic - Clear the screen of text messages for (All players)
    • Game - Display to (All players) the text: (Current index is now + (String(Integer)))
it says it expected a name
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I knew it, you need to register the unit first.
How to register;
1. Open Action List (Trigger Editor - Actions) and select Unit - Kill
2. It says Kill (Triggering unit) right ? Well click on the (Triggering unit)
3. You see those buttons Select a Unit and Edit Variables ? Select the Select a Unit
4. Click on your unit (whichever you desire to be put into action)
5. Now, it will become something like this right;
  • Unit - Kill Blood Mage 0000 <gen>
6. That's it, you have registered a gg_unit_Hblm_0000
7. Don't kill the unit, just remove the action. The action just needed for you to reach the "Select a Unit" part where you can register your unit to be used.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Remember, if you're going to use that trigger just for that type of units only, you will save the Integer in a map setup as constant (so you don't have to create what is already there)

Else, if you're doing many units at once but by referring to that trigger, you should do that.
 
Level 5
Joined
Sep 22, 2012
Messages
90
I think, i solved my own way back then. your unit won't play "walk" animation because unit's movespeed is not 0. Try setting it to 0 then run a trigger that would play the walk animation.
 
Status
Not open for further replies.
Top