Triggering a sequence using the Flow Graph

Depending on the game or scenario you may be creating, you will likely have different requirements for when and how cut-scenes should be triggered. This is catered quite nicely for designers because of the cross communication within certain tools and systems of the engine. In this recipe, we will use a simple flow graph to trigger a cut-scene when a player walks into a certain trigger.

Getting ready

You must have a level open that has a previously saved Track View sequence in it.

If you have already completed the Animating a camera in the Track View and the Creating a new Track View sequence recipes then you can use the my_first_cutscene sequence.

How to do it...

Let's set up a trigger to launch our cut-scene from game mode:

  1. Click-and-drag a proximity trigger into the level. This can be found under the entities/triggers section in the Rollout bar.
  2. Once you have added it to the level, set the trigger bounds to be big enough to trigger when the player enters it. The values are as follows:
    • DimX Value="5"
    • DimY Value="5"
    • DimZ Value="5"
  3. Next, right-click the proximity trigger and create a Flow Graph on it:
    How to do it...
  4. Name the Flow Graph cutscene_trigger.
  5. Next, create the following Flow Graph by first adding the proximity trigger itself by right-clicking and selecting Add selected entity.
  6. Also add a the Animations:PlaySequence flow node.
  7. Connect the Enter output of the proximity trigger to the start of the trigger of the PlaySequence node.

Your resulting flow graph will look similar to the following screenshot:

How to do it...

You can now enter the game mode and whenever you enter the proximity trigger, the sequence is defined in the sequence parameters of the PlaySequence flow node.

How it works...

As you can see, one of the fastest ways to trigger a sequence is to attach it to a trigger object such as the proximity trigger, which can be positioned in the level.

By building a Flow Graph that connects the trigger output of the ProximityTrigger to the start trigger of a PlaySequence Flow Graph node, one can easily activate a sequence by having a player enter the ProximityTrigger in the game.

There's more...

You may want to expand on this Flow Graph or learn how to use an easier testing method for launching cut-scenes in CryENGINE.

Useful debugging trigger

Sometimes for cut-scenes, it can be easier to not have to enter a trigger every time you wish to run the cut-scene. Another useful trigger is the input:key flow node that allows you to press a defined key that will trigger the cut-scene.

Useful debugging trigger

Start time property

When a sequence is triggered from the PlaySequence node, you can force it to jump to a particular start time. This can be useful if you wish to have multiple different events stored within a single sequence.

Break on stop property

When the sequence is stopped, by default, the time slider will go to the very last frame and trigger the logic that may be stored there. This is typically used because when a scene is skipped, you can still trigger all the logic and positional information on that last frame. Setting Break on Stop to true will overwrite these defaults and cause the logic on the last frame not to be triggered.

See also

  • Refer to the Debugging the Flow Graph recipe in Chapter 9, Game Logic if you cannot get the Flow Graph to function
  • Continue to the next recipe to animate entities in your cut-scene
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.226.66