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

[Trigger] Specific Animation Custom Trigger

Status
Not open for further replies.
Level 4
Joined
Oct 15, 2008
Messages
83
I want a specific animation to play and
after looking around the forums quite a bit this line is thrown around alot
Custom script: call SetUnitAnimationByIndex(udg_unit, udg_integer)
And every variation I have tried from it it just gives error and disables the trigger whenever I start/save the map.

So let's say I create one unit in a fresh testmap and call him "Unit" this will be the first unit in the map so what I replace "udg_unit" with is "Unit 0000", right? and the integer I can figure out myself since I am using the villager with 255 animations.

So could anyone give me an example of what they can put in this custom script that doesn't cause any errors? Like I just need one example of someone using a unit and I could probably figure out what is wrong. Thx for reading.


Custom script: call SetUnitAnimationByIndex(udg_unit, udg_integer)
 
Level 7
Joined
Apr 17, 2017
Messages
316
so what I replace "udg_unit" with is "Unit 0000", right? and the integer I can figure out myself since I am using the villager with 255 animations.
It wont generate those numbers unless you set that unit in a variable, if you want to use them fine, but that's a lot of work. If you created the unit without triggers, just create a unit variable, then go to set variable, then select unit.
  • anim
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set unit = Mortar Team 0001 <gen>
      • Custom script: call SetUnitAnimationByIndex(udg_unit, 2)
 
Level 4
Joined
Oct 15, 2008
Messages
83
It wont generate those numbers unless you set that unit in a variable, if you want to use them fine, but that's a lot of work. If you created the unit without triggers, just create a unit variable, then go to set variable, then select unit.
  • anim
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set unit = Mortar Team 0001 <gen>
      • Custom script: call SetUnitAnimationByIndex(udg_unit, 2)
Right so from your example if I were to replace the "udg_unit" with "Mortar Team 0001" it would work? This is after making a trigger and setting the variable.
 
Level 7
Joined
Apr 17, 2017
Messages
316
Right so from your example if I were to replace the "udg_unit" with "Mortar Team 0001" it would work? This is after making a trigger and setting the variable.
The example I gave you was based on creating the units without triggers. So to set your unit variable just do this after you create your unit with triggers:
  • Set unit = (Last created unit)
You can name your variable whatever you want. But if your variable name is x, then call SetUnitAnimationByIndex(udg_unit, 2) should be call SetUnitAnimationByIndex(udg_x, 2). Gui variables have udg prefix that is why.
 
Level 4
Joined
Oct 15, 2008
Messages
83
The example I gave you was based on creating the units without triggers. So to set your unit variable just do this after you create your unit with triggers:
  • Set unit = (Last created unit)
You can name your variable whatever you want. But if your variable name is x, then call SetUnitAnimationByIndex(udg_unit, 2) should be call SetUnitAnimationByIndex(udg_x, 2). Gui variables have udg prefix that is why.
,
I was missing the udg_ part before putting in the variable name, thank you for your help and time +rep!
 
Status
Not open for further replies.
Top