• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Animation/Movment Help

Status
Not open for further replies.
Level 11
Joined
Oct 9, 2015
Messages
721
-Issues- Animation and Conditions

Hi everyone, so I started a new map and was in need of help, so I found this forum...

My problem:
I'm trying to use this trigger, however when playing animations I would like to check conditions (unit has specifc buff, for example), if such conditions are false unit does normal animation, as it is in the orignal trigger, but if true he does animation [2]

(I'm trying to make unit (a footman) plays the "walk defend" animation when isrunning = true and Defend (for example) is active. and to do "stand defend" animation when standing still and defend is active.

  • changinganimation
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Custom script: local integer i = 1
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (DownTrue[(Integer A)] Equal to True) and (UpTrue[(Integer A)] Equal to False)
                  • (DownTrue[(Integer A)] Equal to False) and (UpTrue[(Integer A)] Equal to True)
            • Then - Actions
              • Set IsRunning[(Integer A)] = True
              • Custom script: call SetUnitAnimationByIndex(udg_Unit[GetForLoopIndexA()], 6)
              • Custom script: call SetUnitTimeScale(udg_Unit[GetForLoopIndexA()], udg_AnimationSpeed[GetForLoopIndexA()])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • IsRunning[(Integer A)] Equal to True
                • Then - Actions
                  • Set IsRunning[(Integer A)] = False
                  • Set AnimationSpeed[(Integer A)] = 1.00
                  • Custom script: call SetUnitTimeScale(udg_Unit[GetForLoopIndexA()], udg_AnimationSpeed[GetForLoopIndexA()])
                  • Animation - Play Unit[(Integer A)]'s stand animation
                • Else - Actions
 
Last edited:
Level 15
Joined
Oct 29, 2012
Messages
1,474
where does this line goes, and what does it do ?

Replace the "SetUnitAnimationByIndex" by that line, and also the "Animation - Play Specific Unit Animation - stand" by that lane too.

As far as I know, the "SetUnitAnimationByIndex" works best in periodic events. So if DEE-BOO's trigger doesn't work, replace all "Animation -Play unit's animation" by the correct Index jass trigger.
Because simply " Animation - Play Unit[(Integer A)]'s stand animation" DOES NOT WORK with periodic events as it gets interrupted repeatedly.

What "Add animation tag" does, is give priority to that tag in playing animations, so it'll have the highest priority to be played, yet, no one ensures that it works with periodic events.

Let me guess, this is some arrow-key system you're trying to build there? And the "For each integer A from 1 to 10" is just to pick players? Then why did you put this ? Remove the Or-Any conditions and put the condition under the "If/Then/Else" trigger which is under the "Else -Actions" directly.

Why is there /Or-Any/ thing?
  • Or - Any (Conditions) are true
    • Conditions
      • IsRunning[(Integer A)] Equal to True
 
Level 11
Joined
Oct 9, 2015
Messages
721
the "or (any conditions)" is actually my last concern, I changed it and the trigger worked just fine.. however my problem is that I can't seem to find a way for the unit to play determined animation if it has specific buff hahaha

I can post the map with the trigger if you guys want to take a deeper look.
 
Level 25
Joined
Sep 26, 2009
Messages
2,379
If you want your unit to play a set of same-named animations, use the action:
  • Animation - Add the abc animation tag to unit
If you want to play only one specific animation, use either
  • Custom script: call SetUnitAnimationByIndex(unit, index)
  • Animation - Play unit's abc animation
From what you wrote, you want a set of same-named animations, hence use the "Add animatin tag" action. First, determine when your unit should start playing this animations (does it get buff? or casts a spell?) and add the tag at that time. Then determine when the unit should stop playing this animation (if done via buff, just keep track of all units with it in unit group and periodically check each unit in the group if it still has the buff, etc.) and remove that animation tag.
 
Status
Not open for further replies.
Top