• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[General] Making a short animation loop with blp files and timers

Level 1
Joined
May 18, 2026
Messages
3
Hi! I'm a little bit at a loss here. I'm looking for a way to make a short "animation" loop via importing a bunch of images and playing them quickly in sequence from a timer, without using Waits in GUI, e.g., when a timer ticks .05 seconds, it plays movie1.blp; when it hits .1 seconds, it plays movie2.blp, and so on and so forth. I've seen it done before in a few maps and tried copying their triggers, but unfortunately, I'm still new to JASS and am not really sure what I'm looking at.

Here's a piece of it that I took from one of their triggers:

JASS:
function AX takes nothing returns nothing
       local timer t=GetExpiredTimer()
    local integer id=GetHandleId(t)
    local integer i=LoadInteger(udg_hashtable01,id,0)
    local integer j=1
    local integer NX=LoadInteger(udg_hashtable01,id,1)
    local integer KE=0
    local integer PE=0
    local boolean bX=LoadBoolean(udg_hashtable01,id,0)
    call SaveInteger(udg_hashtable01,id,0,i+1)
    if i==-1 then
        call SaveInteger(udg_hashtable01,id,0,4)
        call TimerStart(t,1.,false,function AX)
    elseif i>=0 and i<=201 then
        if NX==0 then
            call CinematicFilterGenericBJ(.0,BLEND_MODE_BLEND,"war3mapImported\\Movie1.blp",100,100,100,.0,100.,100.,100.,0)
            call SaveInteger(udg_hashtable01,id,1,1)
        elseif NX==1 then
            call CinematicFilterGenericBJ(.0,BLEND_MODE_BLEND,"war3mapImported\\Movie2.blp",100,100,100,.0,100.,100.,100.,0)
            call SaveInteger(udg_hashtable01,id,1,2)
        elseif NX==2 then
            call CinematicFilterGenericBJ(.0,BLEND_MODE_BLEND,"war3mapImported\\Movie3.blp",100,100,100,.0,100.,100.,100.,0)
            call SaveInteger(udg_hashtable01,id,1,0)
        endif
    elseif i==202 then
        call CinematicFilterGenericBJ(.5,BLEND_MODE_BLEND,"war3mapImported\\Movie3.blp",100,100,100,.0,.0,.0,.0,0)
    endif
    set t=null
endfunction

I'm not that experienced with setting up timers and integers in this way and I'm still a long way away from making my own JASS from scratch. Any help at all would be greatly appreciated!
 
Sorry for the bump, but does anyone have any ideas? If I'm reading the JASS right, it looks like the code is playing on a loop through integers 0-202, with the integers going up through a global timer, but I'm not experienced enough to know for sure.

Maybe what I'm asking for is really hard/impossible, but I have a general idea in my head of how to do it—I'm just too peanut-brained to implement it at my level.
 
The function AX is a callback that a timer starts upon expiration. The AX function may restart the timer, so that you get repeated executions of AX function (this is the line call TimerStart(t,1.,false,function AX), where the arguments are in this order: whichTimer, timeout, periodic and callback function).

The function uses a hashtable to keep track of its own data, where parent key is handleId of the expired timer and child keys are just integers 0 and 1.
  • child key 0: The value stored in hashtable under this child key is assigned to variable i. Seems to be a way to to affect behaviour externally from some other function. It is hard to say what it is for exactly, apart from the part where if i == -1, then a new value is stored for this key in hashtable (value 4) and the function starts itself again after 1 second. For cases where i > 0 value of this child key is not in any way modified in this function.
  • child key 1: The value stored in hasthable under this child key is assigned to variable NX and seems to determine which blp to display. Whenever new blp image is displayed, the function stores a new state in hashtable under this child key. From the code it seems this will loop through 3 blps (NX==0 stores NX as 1 in hashtable, NX==1 stores it as 2 and NX==2 stores it back as 0).

The function CinematicFilterGenericBJ is nothing more than the following GUI trigger action:
  • Cinematic - Apply a filter over 0.00 seconds using Normal blending on texture White Mask, starting with color (100.00%, 100.00%, 100.00%) and 0.00% transparency and ending with color (100.00%, 100.00%, 100.00%) and 0.00% transparency
The only difference is that in GUI you have a limited list of images to display (like White Mask, Black Mask, etc.) while the jass function allows you to display any image - in this case the imported Movie1-3.blp images

However in the script you provided there is nothing which starts timer with "AX" function as callback for the first time, nor anything else that would modify hashtable values for the child key "0" if its current value is >= 0 (actually, scratch that, I just noticed the first line after local variable declaration, which stores under child key 0 the value i+1). You will most likely find some other part of code that calls the TimerStart function and passes to it function AX as an argument. Those places should be where you should start looking and trying to understand what is going on.

Edit: this would be a similar representation of the function done in GUI. It is not exactly the same, as triggers are event based, but your AX is just a normal function, not a trigger. But it should illustrate a bit what is going on:
  • AX
    • Events
    • Conditions
    • Actions
      • Set VariableSet t = (Expiring timer)
      • Set VariableSet id = (Key (Expiring timer).)
      • Set VariableSet i = (Load 0 of id from hashtable01.)
      • Set VariableSet NX = (Load 1 of id from hashtable01.)
      • Hashtable - Save (i + 1) as 0 of id in hashtable01.
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Equal to -1
        • Then - Actions
          • Hashtable - Save 4 as 0 of id in hashtable01.
          • Countdown Timer - Start t as a One-shot timer that will expire in 1.00 seconds
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • i Greater than or equal to 0
              • i Less than or equal to 201
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • NX Equal to 0
                • Then - Actions
                  • -------- Imagine "White Mask" is the Movie1.blp --------
                  • Cinematic - Apply a filter over 0.00 seconds using Normal blending on texture White Mask, starting with color (100.00%, 100.00%, 100.00%) and 0.00% transparency and ending with color (100.00%, 100.00%, 100.00%) and 0.00% transparency
                  • Hashtable - Save 1 as 1 of id in hashtable01.
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • NX Equal to 1
                    • Then - Actions
                      • -------- Imagine "Black Mask" is the Movie2.blp --------
                      • Cinematic - Apply a filter over 0.00 seconds using Normal blending on texture Black Mask, starting with color (100.00%, 100.00%, 100.00%) and 0.00% transparency and ending with color (100.00%, 100.00%, 100.00%) and 0.00% transparency
                      • Hashtable - Save 2 as 1 of id in hashtable01.
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • NX Equal to 2
                        • Then - Actions
                          • -------- Imagine "Haze Filter" is the Movie3.blp --------
                          • Cinematic - Apply a filter over 0.00 seconds using Normal blending on texture Haze Filter, starting with color (100.00%, 100.00%, 100.00%) and 0.00% transparency and ending with color (100.00%, 100.00%, 100.00%) and 0.00% transparency
                          • Hashtable - Save 0 as 1 of id in hashtable01.
                        • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • i Equal to 202
                • Then - Actions
                  • -------- Imagine "Haze Filter" is the Movie3.blp --------
                  • Cinematic - Apply a filter over 0.00 seconds using Normal blending on texture Haze Filter, starting with color (100.00%, 100.00%, 100.00%) and 0.00% transparency and ending with color (100.00%, 100.00%, 100.00%) and 0.00% transparency
                • Else - Actions
 
Last edited:
Back
Top