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

How to wait w/o using "Wait" Action?

Status
Not open for further replies.
Level 4
Joined
Apr 18, 2009
Messages
127
So, as many of you know there are a tabu-thing about using wait actions in triggers.

but, i need to make something hold for X seconds.

  • Unit - Create 1 Ice Flurry Dummy for (Owner of (Triggering unit)) at IF_Spawn_Randoms[Ice_Flurry] facing (Position of (Triggering unit))
  • Special Effect - Create a special effect at (Position of (Last created unit)) using Abilities\Spells\Human\Blizzard\BlizzardTarget.mdl
  • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
  • Unit - Add Ice Flurry Dummy to (Last created unit)
  • Unit - Order (Last created unit) to Night Elf Warden - Fan Of Knives
My problem is that the fan of knives fires before the Blizzard hail hits the ground. I want to make it so the blizzard hits the ground then "shatters" sending iceparts towards the enemies. And it would look wierd if the ice-splints were created before the hail hits the ground.
 
Level 4
Joined
Apr 18, 2009
Messages
127
But then I would have to use multiple triggers right?

EDIT: So, to make this abit mroe clear I'll post the whole trigger

  • Ice Spikes
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ice Flurry
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Ice_Flurry Less than 1000
        • Then - Actions
          • Set Ice_Flurry = (Ice_Flurry + 1)
        • Else - Actions
          • Set Ice_Flurry = 1
      • Set IceFlurry_Caster[Ice_Flurry] = (Triggering unit)
      • Set IceFlurry_Point[Ice_Flurry] = (Target point of ability being cast)
      • Set IceFlurry_LVL = (Level of Ice Flurry for (Triggering unit))
      • For each (Integer IF_Integer) from 1 to (IceFlurry_LVL x 3), do (Actions)
        • Loop - Actions
          • Set IF_Spawn_Randoms[Ice_Flurry] = (Random point in ((Region centered at IceFlurry_Point[Ice_Flurry] with size (1500.00, 1500.00)) offset by (10.00, 10.00)))
          • Unit - Create 1 Ice Flurry Dummy for (Owner of (Triggering unit)) at IF_Spawn_Randoms[Ice_Flurry] facing (Position of (Triggering unit))
          • Special Effect - Create a special effect at (Position of (Last created unit)) using Abilities\Spells\Human\Blizzard\BlizzardTarget.mdl
          • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Ice Flurry Dummy to (Last created unit)
          • Unit - Order (Last created unit) to Night Elf Warden - Fan Of Knives
 
Level 4
Joined
Apr 18, 2009
Messages
127
But how to link those triggers so the variables are the same as in trigger nr.1?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
A minimum time of a wait call is about 0.27 seconds or so everybody's saying.
You can use it with locals if your waits are a few seconds long (or longer of course) without any problems.

As to timers, you could use the search, but who uses it anyway... :icon_sarcasm:

JASS:
function callback takes nothing returns nothing
    local timer t = GetExpiredTimer()
    
    // actions

    call DestroyTimer(t)
    
    // in case your timer runs multiple times (boolean = true), you will have to
    // find another way to destroy the timer when you need to destroy it.

    set t = null
endfunction

function init takes something returns something
    local timer t = CreateTimer()
    call TimerStart(t,0.04,false,function callback)
    set t = null
endfunction
 
Level 7
Joined
Aug 15, 2007
Messages
52
i made a timing system tat allow simulation of wait. Timer is easy and nice for repeating stuffs, but dynamic timing for movies etc. my system provide the answer.
This code is from my currently cinematic:
JASS:
//! runtextmacro NewScene("DanceScene","sDanceCine")
    local Object O
//! runtextmacro WaitOn()
    call PlayCameraSequence.Play(DanceCine,GetLocalPlayer())
    //! runtextmacro Wait("1")
    call MoveLocation(tmpLoc,17835,-10050)
    call Dance.MoveWalk(tmpLoc,0,9,270,7)
    //! runtextmacro Wait("4")
    call MoveLocation(tmpLoc,18720,-10113)
    call Enemy.MoveWalk(tmpLoc,0,9,270,7)
    //! runtextmacro Wait("3")
    call ResetUnitAnimation(Dance.M.P.Unit)
    //! runtextmacro Wait("4")
    call ResetUnitAnimation(Enemy.M.P.Unit)
    //! runtextmacro Wait("2")
    call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 2, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
    //! runtextmacro Wait("3.2")
    call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 0, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
    //! runtextmacro Wait("6")
    call Enemy.PlayAnimation(10,1.333,1,0)
    //! runtextmacro Wait("0.3")
    call Enemy.StretchAnimation(1.)
    call Enemy.PauseAnimation(1.)
    //! runtextmacro Wait("0.15")
    set oBullet = CreateProjectile(GetUnitX(Enemy.M.P.Unit),GetUnitY(Enemy.M.P.Unit),50,AngleBetweenPoints(GetUnitLoc(Enemy.M.P.Unit),GetUnitLoc(Dance.M.P.Unit)),0,Player(0))
    call oBullet.ShootToward(GetUnitLoc(Dance.M.P.Unit),50,0,0,28)
    set oBullet.AvoidOn = true
    call SetUnitVertexColor(oBullet.M.P.Unit,255,255,255,0)
    //! runtextmacro Wait("0.30")
    call SetUnitVertexColor(oBullet.M.P.Unit,255,255,255,255)
    call oBullet.ShootToward(GetUnitLoc(Dance.M.P.Unit),50,0,0,2)
    call Enemy.StretchAnimation(6.)
//! runtextmacro EndScene()

and the system is here: http://www.wc3c.net/showthread.php?t=101988
 
Level 11
Joined
Feb 22, 2006
Messages
752
But how to link those triggers so the variables are the same as in trigger nr.1?

Can't be done in GUI if you want the spell to be fully MUI.

Also, if the timer is periodic, you need to pause it before destroying it, or else bad things start to happen...(i.e. bugs)

EDIT: Man...that's some nice textmacro abuse lol...why not just use a function instead...I'm pretty sure ONE function call isn't gonna kill your efficiency.
 
Level 7
Joined
Aug 15, 2007
Messages
52
im afraid here functions cant do anything, ull know why if u read the documentation.
I use Jass to make a stepping machine similar to assembly way, you have steps and u jump to them in different times depends on the wait macros.
Everything in between the macros are wrapped in if/then/else conditions to check when its needed to run the action.
The core is a timer tat runs at 0.01 stepping, so the accuracy here is only 0.01, means if u wait for less than this periode then it will still be 0.01. but tat is plenty good enough for my wait needs.
This is not fast, not recommended for rapid constant timing for effects n systems. It is good if u wanna easily have different waits, espeically for cinematics.
I use it for everything tho, cus im too lazy to write function for timer, n its action.

This also feature LOOP, and IF/THEN/ELSE. yes capslock version, they are all macros, but allow u to wrap Wait macros inside, cus if u wrap Wait macros inside normal if then else or loop, everything will bug.
Now with this system we can do the legendary noob style to move unit:
Loop+wait inside to move in a straight line XD
 
Status
Not open for further replies.
Top