• 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.

Create precise timing cinematic using real variable

Level 31
Joined
May 3, 2008
Messages
3,154

Create precise timing cinematic using real variable


Creating cinematic using real instead of countdown timer are efficient and less time consuming. Real are also quite accurate just like countdown timer does and easier to organize.

First of all, create a Initialization trigger.

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Execution_Order = 0
      • Trigger - Run Execution Order <gen> (ignoring conditions)
Execution order are integer variable, this variable are use to arrange each trigger files action.

  • Gametime 0 Initialization
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set Execution_Order = 0
      • Trigger - Run Next Trigger <gen> (ignoring conditions)
You need to set another trigger that run at time elapsed. Do remember you need to reset the execution order back to 0 since the trigger Trigger - Run Execution Order at Initialization trigger have set it to 1 instead of 0.

If you do not reset it back to 0, it would skip the earliest trigger action of your cinematic.

This are also another trigger setup you cannot miss.

  • Trigger Active
    • Events
    • Conditions
    • Actions
      • Set Wait_Script[Execution_Order] = Wait_Time
      • Set Trigger_Script[Execution_Order] = Trigger
      • Set Execution_Order = (Execution_Order + 1)

Variable Type


Wait Script - Real array (Remember to set the size).
Execution_Order - Integer.
Wait_Time - Real
Trigger - Trigger
Trigger_Script - Trigger array
Time_Expire - Timer

All this variable are the variable require for you to start off with. Create this trigger in order for the action to took place.

  • Next Trigger
    • Events
      • Time - Time_Expire expires
    • Conditions
    • Actions
      • Trigger - Run Trigger_Script[Execution_Order] (checking conditions)
      • Set Execution_Order = (Execution_Order + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Wait_Script[Execution_Order] Greater than or equal to 0.00
        • Then - Actions
          • Countdown Timer - Start Time_Expire as a One-shot timer that will expire in Wait_Script[Execution_Order] seconds
          • Set Time_Expire = (Last started timer)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Wait_Script[Execution_Order] Greater than 0.00
            • Then - Actions
              • Trigger - Run Next Trigger <gen> (ignoring conditions)
            • Else - Actions
  • Set Execution_Order = (Execution_Order + 1)
Each time you run an trigger, it would add 1 values into the trigger. Once the action was done, it would run another action instead of repeating it.

  • Execution Order
    • Events
    • Conditions
    • Actions
      • -------- Scene 1A --------
      • Set Trigger = Scene 1A <gen>
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
      • -------- Scene 1B --------
      • Set Trigger = Scene 1B <gen>
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
      • -------- Scene 1C --------
      • Set Trigger = Scene 1C <gen>
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
This is where you set each of the trigger action is. Set the Wait_Time to xxx seconds to indicate how long you want the trigger to be execute.

From what you seens, Wait_Time at scene 1A was set at 2 seconds. Once 2 second have pass, it would execute Scene 1B and so on.

Remember, you need to create a trigger files for the action just like this.

  • Scene 1A
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in Player and do (Camera - Apply Camera[1] for (Picked player) over 0.00 seconds)
      • Cinematic - Fade in over 2.00 seconds using texture White Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
Do not forget to destroy the trigger files upon usage to increase the performance of it.

  • Custom script: call DestroyTrigger(GetTriggeringTrigger())

Why real are better than countdown timer


Less time consumption


It was easy to be organize compare to countdown timer.

When you are using countdown timer, you need to create this action at each of the trigger.

  • Scene 1
    • Events
    • Conditions
    • Actions
      • Set Trigger = Scene 1 <gen>
      • Countdown Timer - Start NextTrigger as a One-shot timer that will expire in 2.00 seconds
      • Trigger - Add Scene 2 <gen> to the trigger queue (Ignoring conditions)
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
It was more tiring and time consuming when you need to constantly click each trigger and then paste it. If you are using real, you could paste everything into 1 trigger files just like this.

  • Execution Order
    • Events
    • Conditions
    • Actions
      • -------- Scene 1A --------
      • Set Trigger = Scene 1A <gen>
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
      • -------- Scene 1B --------
      • Set Trigger = Scene 1B <gen>
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
      • -------- Scene 1C --------
      • Set Trigger = Scene 1C <gen>
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
It also reduce mistake when you are doing in according to this technique.

Reduce mistake and easier to check


When you are using countdown timer, there is a possibility of you making a mistake and it would take you time to look at each trigger to see where you did wrong.

  • Scene 3
    • Events
    • Conditions
    • Actions
      • Set Trigger = Scene 2 <gen>
      • Countdown Timer - Start NextTrigger as a One-shot timer that will expire in 2.00 seconds
      • Trigger - Add Scene 4 <gen> to the trigger queue (Ignoring conditions)
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
If you view this trigger above you, you would notice a mistake had been done at Set Trigger - Scene 2 since it was suppose to be Set Trigger - Scene 3.

When you are using countdown timer, you would have hundred of trigger like this. It won't be easy to find the trigger that are mistakenly set if you are using countdown timer.

However, if you are using real. A mistake like this can be browse through a single trigger file and easier to be spot.

  • Execution Order
    • Events
    • Conditions
    • Actions
      • -------- Scene 1A --------
      • Set Trigger = Scene 1A <gen>
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
      • -------- Scene 1B --------
      • Set Trigger = Scene 1A <gen>
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
      • -------- Scene 1C --------
      • Set Trigger = Scene 1C <gen>
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
By a quick glance, even you could notice it and there's no need to browse through each trigger files.

Can be repeated


Countdown timer doesn't allowed you to repeat the same action. If you want to repeat the same action, you have to create more than 1 trigger files of the same action. This isn't that good and time consuming if the repetition is frequent.

However, by using real; you can do it. Simply add Trigger - Run Active Trigger more than 1 just like this example below.

  • Execution Order
    • Events
    • Conditions
    • Actions
      • -------- Scene 1A --------
      • Set Trigger = Scene 1A <gen>
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
      • -------- Scene 1B --------
      • Set Trigger = Scene 1B <gen>
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
      • -------- Scene 1C --------
      • Set Trigger = Scene 1C <gen>
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Trigger - Run Trigger Active <gen> (ignoring conditions)
      • Set Wait_Time = 2.00
As you can see, it have 3 run trigger action that run for 2 seconds. That's mean scene C would repeat for another 3 times in the next 2 seconds after it's execution.
 
Last edited:
Level 24
Joined
Feb 28, 2007
Messages
3,479
Okay first and foremost, the grammar and the spelling needs fixing.
Moving on I think this looks like a good tutorial, the formatting is clean and (besides from the english) the tutorial is easy to follow for the reader. I think after fixing the grammar & spelling, this tutorial is ready for approval.
 
Level 31
Joined
May 3, 2008
Messages
3,154
Why not just create all your timers at INIT, and use loops if you want to repeat something?

Yes, you can use loops to repeat it. The problem is, you would make it fix for 1 time only. For example, if you set the countdown timer to 2 seconds; it means all your trigger files would be execute every 2 seconds and cannot be varied.

Let's said if you want the cinematic where a unit walk to xxx region in about 5 seconds and then cast animation 2 seconds later. You cannot create a trigger files with countdown timer for 5 seconds and another trigger files with countdown timer of 2 seconds since you fix it at 2 seconds.
 
Level 31
Joined
May 3, 2008
Messages
3,154
Using single timer is a horrible idea as you cause the timer to be exactly at 1 fix time.

For example, you want unit xxx to move to xxx for about 3 seconds. The next action is to enable unit xxx to attack unit B in within 1 seconds, so if you set the timer to fix at 3 seconds. It would cause unit xxx to attack unit B 2 seconds slower, which could show a bizzare effects.

Another fine example is conversation. For example, you want unit xxx to talk for 8 seconds while the timer last for 5 seconds.

This resulted unit into talking for 5 seconds without finish it's conversation.
 
Top