• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

Can I use "wait" actions in a campaign cinematic?

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
I know people hate "wait - game time" actions for a variety of reasons, but they are very convenient. I use waits in some of the cinematics in my campaign and they seem to work fine for me, but I actually don't understand the problem with them. For your convenience I'll just simple yes or no questions:

1. If I have a cinematic with a "wait" action in it that looks just fine on my computer, will it also look fine if someone else downloads the campaign and plays it? Keep in mind it is not multiplayer.

2. I know "waits" are not accurate (i.e. 2 seconds of waiting will not be precisely 120 seconds) but are they reliable? In other words, a 2 second wait during a cinematic is actually 115 seconds when I play it today will it also be 115 seconds when I play it tomorrow?
 
Level 5
Joined
Mar 6, 2015
Messages
130
wait usually leaks in spells or non-global triggers for example i`ve created a spell that is not mui. it has a wait function on it so when a player run this spell for the first time the variables will be setted for that player but within the wait time another player runs this spell too. so the variables changing for first player and after wait time the trigger is not working for first player because everything has been changed after second player ran the same spell but for example if you want to wait 5 seconds then add 500 gold to all players the wait function won`t cause any trouble. and in singleplayer maps it won`t be bugged of course if the trigger is global like cinematic effects
 
Last edited:
You can feel free to use waits. They are a little inaccurate, but for the most part, things should be okay. Keep in mind that the error of waits is roughly +- 0.250, as you go down to really low values (e.g. 0.03 second wait), that error can make an enormous difference. When you get to higher values (e.g. 1 second or more), usually it is hardly noticeable (this should make sense logically).

To answer your question, waits are not 100% deterministic. If you run a wait in one game, it might be off by +0.1 seconds, but the next time you run it, it might be off by -0.05 seconds. So try not to rely on the wait duration too much. If you need things to be really precise, use timers. But if you are just waiting for some text to finish, or if you are waiting a decently long time (e.g. 2 seconds or so) then it should be totally fine.
 
Level 14
Joined
Aug 30, 2004
Messages
909
If you run a wait in one game, it might be off by +0.1 seconds, but the next time you run it, it might be off by -0.05 seconds.

This makes some sense to me. I have a cinematic where a villager jumps off a cliff over a fire, and as they're falling they burst into flames. I then cut to another camera after a wait. Weirdly, sometimes it would cut before the unit burst into flames and other times it would cut after. I couldn't figure out why that was, but I think it must have been the wait action. I've since edited the scene, but if other people have trouble like this use Timers like PurgeandFire suggested.

Thanks everyone.
 
like purge suggested: timers. And also good in cinematics is trigger queue. One timer only, and very accurate scenes. Ill show you how i did it in Gui. Its in multiplayer game and its resistand for lagged players /wait for player window/

  • BattleCinematic
    • Events
    • Conditions
    • Actions
      • -------- ----------CINEMATIC BEGINS --------- --------
      • -------- ------------------- --------
      • Sound - Play BattleMusic <gen>
      • -------- ------------------- --------
      • -------- --- here moved pan camera functions ---------------- --------
      • -------- ----- Pan camera for all players -------------- --------
      • Set CenterPoint = (Center of TeamDuels <gen>)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Camera - Pan camera for (Picked player) to CenterPoint over 0.00 seconds
      • Custom script: call RemoveLocation(udg_CenterPoint)
      • -------- ------------------- --------
      • -------- ----- Pan camera for players on Arena -------------- --------
      • Unit Group - Pick every unit in (Units in TeamVsTeam <gen>) and do (Actions)
        • Loop - Actions
          • Set CenterPoint = (Position of (Picked unit))
          • Camera - Pan camera for (Owner of (Picked unit)) to CenterPoint over 0.00 seconds
          • Custom script: call RemoveLocation(udg_CenterPoint)
      • -------- ------------------- --------
      • Trigger - Add CinematicBattlePart1 <gen> to the trigger queue (Ignoring conditions)
      • Trigger - Add CinematicBattlePart2 <gen> to the trigger queue (Ignoring conditions)
      • Trigger - Add CinematicBattlePart3 <gen> to the trigger queue (Ignoring conditions)
      • -------- ------------------- --------
      • -------- ------------------- --------
  • CinematicBattlePart1
    • Events
    • Conditions
    • Actions
      • Set CinematicRunningTrigger = (This trigger)
      • Countdown Timer - Start CinematicNextTrigger as a One-shot timer that will expire in 3.00 seconds
      • -------- ------ ------------------ --------
      • -------- ------ ------------------ --------
      • Cinematic - Turn cinematic mode On for (All players)
      • -------- ------ ------------------ --------
      • -------- ------ ------------------ --------
      • -------- ------ ------------------ --------
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Camera - Apply CameraFinalAlliance <gen> for (Picked player) over 0.00 seconds
          • Camera - Apply CameraFinalAlliance A <gen> for (Picked player) over 3.00 seconds
      • -------- ------------------------ --------
  • CinematicBattlePart2
    • Events
    • Conditions
    • Actions
      • Set CinematicRunningTrigger = (This trigger)
      • Countdown Timer - Start CinematicNextTrigger as a One-shot timer that will expire in 3.00 seconds
      • -------- ------ ------------------ --------
      • -------- ------ ------------------ --------
      • -------- ------ ------------------ --------
      • -------- ------ ------------------ --------
      • -------- ------ ------------------ --------
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Camera - Apply CameraFinalHorde <gen> for (Picked player) over 0.00 seconds
          • Camera - Apply CameraFinalHorde A <gen> for (Picked player) over 3.00 seconds
      • -------- ------------------------ --------
  • StartNextCinematicPart
    • Events
      • Time - CinematicNextTrigger expires
    • Conditions
    • Actions
      • Trigger - Remove CinematicRunningTrigger from the trigger queue
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,275
There is no issue with using TriggerSleepAction for campaign cinematic. Since it is single player it remains fairly accurate and predictable. I believe Blizzard even used it for their Warcraft III cinematic.

That said do make sure the code is robust. There is only a loose contract as to the passing of time when TriggerSleepAction returns so you cannot assume that an event has occurred or not (always check).
 
There is another problem with waits, though it doesn't matter in singleplayer games:
If a player lags, the lagging time will be ignored.

So, for example, if you have a message displayed, wait 10 seconds, then have another message but one player lags and triggers the "wait for player dialog" for 10 seconds inbetween both messages, the second message will pop up instantly after the dialog fades.

So cinematics can be terribly messed up by this in multiplayer if you rely on waits to trigger effects or unit actions.


As typical example would be: unit A talks and while talking moves to point B. It takes roughly 5 seconds to point B. So after a 5 second wait, you display another message. If a player is lagging inbetween those actions, the unit might already display its second message before reaching point B, as the unit movement got halted when a player lagged, but not the waiting time.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,275
So, for example, if you have a message displayed, wait 10 seconds, then have another message but one player lags and triggers the "wait for player dialog" for 10 seconds inbetween both messages, the second message will pop up instantly after the dialog fades.

This is fixed by using PolledWaitBJ? That uses a timer to synchronize the TriggerSleepAction. However that leaks a handle index so you would need a custom "fixed" implementation that sets the local declared local timer to null before function return.
 
This is fixed by using PolledWaitBJ? That uses a timer to synchronize the TriggerSleepAction. However that leaks a handle index so you would need a custom "fixed" implementation that sets the local declared local timer to null before function return.
It's about time we find a hack to make waits more precise so that a new accurate polled wait function is possible. I'm sick of having to use timers for fucking everything.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,275
It's about time we find a hack to make waits more precise so that a new accurate polled wait function is possible. I'm sick of having to use timers for fucking everything.
It is called StarCraft II where the "Wait" native there is perfectly accurate.

In Warcraft III it is just not possible due to how TriggerSleepAction works, you can get it accurate within a second or two using timers but not much more.
 
Status
Not open for further replies.
Top