Table of Contents

,

Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorActorCutscene

ECBehaviorActorCutscene

Behavior adding cutscene support to actors.

Allows actor to perform cutscene actions controlled by conversation scripts.

Loads a custom animator and applies it to ECBehaviorConversationActor. Controller mappings assigned to ECBehaviorConversationActor do affect the loaded animator so cutscene animators can integrate into switched animators. In addition this behavior adds a controller named cutscene which is used to play back the cutscene.

Upon starting the animation captures the current animation state into state number 0. This allows cutscenes to blend over from the current state if required.

Supports adding break points to interrupt playing back a cutscene until the conversation script decides to continue. This allows for special configurations and requires the used animator to support playing back an idle animation (for example using idle controller) while the cutscene controller is frozen at the break point value.

Also supports loading a sound or synthesizer to play back while the cutscene is running.

When using this behavior make sure the BaseActorAction subclass used supports changing animator assigned to ECBehaviorActorAnimated while the action is in used. If this is not the case the BaseActorAction subclass can access AnimatorController of the previous animator causing problems.

See also:

Instance Counts

This behavior can be used only once on an element.

Element Class Properties

Element class properties have the prefix cutscene..

controllerName

Set name of playback controller.

Events

This behavior has these events:

cutsceneStarted

Cutscene started.

cutsceneStopped

Cutscene stopped.

cutscenePaused

Cutscene hit break point and is now waiting.

cutsceneResumed

Cutscene continues after waiting at a break point.

Conversation Commands

This behavior adds these conversation commands.

cutscene

Control cutscene. The following syntax is supported:

cutscene start [path] {[breakPoint1] … [breakPointN]}

Start playing cutscene.

ParameterDescription
pathPath to animator to load.
breakPoint*Break points to wait on in seconds in ascending order.

cutscene resume

Resume cutscene if paused (hence waiting at a break point).

cutscene stop

Stop cutscene if running.

cutscene synthesizer [path] [range] {[positionX] [positionY] [positionZ] {[bone]}}

Loads synthesizer and starts playing it back. Attaches the speaker to the actor.

ParameterDescription
pathAbsolute path to synthesizer to load.
rangeRange in meters of speaker.
position*Position relative to actor origin to attach speaker to.
boneAttach relative to bone instead of actor origin.

Conversation Conditions

This behavior adds these conversation conditions.

cutscene

cutscene playing

Cutscene is playing.

cutscene paused

Cutscene is paused (hence waiting at a break point).

cutscene stopped

Cutscene is stopped.

Required Behaviors

Optional Behaviors

This behavior does not support optional behaviors.

Persistency

This behavior does support element class to be persistable (setPersistable).

API Documentation

ECBehaviorActorCutscene.

Since DragonScript Module Version 1.0

Use Cases

Element Class Example

This example defines an element which supports cutscenes.

class MyElement extends BehaviorElementClass
  public var ECBehaviorComponent component
  public var ECBehaviorCollider collider
  public var ECBehaviorConversationActor conversationActor
  public var ECBehaviorActorCutscene actorCutscene
  func new()
    component = ECBehaviorComponent.new(this, null)
    collider = ECBehaviorCollider.new(this, component)
    conversationActor = ECBehaviorConversationActor.new(this)
    actorCutscene = ECBehaviorActorCutscene.new(this, collider, conversationActor)
  end
end

Behavior Factory

Using element class supporting adding behaviors the behavior can be added like this:

<?xml version='1.0' encoding='UTF-8'?>
<elementClass name='MyClass' class='GenericBehaviorElement'>
  <behavior type='ECBehaviorComponent'/>
  <behavior type='ECBehaviorCollider'/>
  <behavior type='ECBehaviorConversationActor'/>
 
  <behavior type='ECBehaviorActorCutscene'>
    <!-- set element properties. omit property prefix if used inside behavior tag -->
    <string name='.name'>value</string>
  </behavior>
</elementClass>

Live Examples