Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorConversationActor
Behavior adding conversation actor support to actors.
Provides ConversationActor with basic properties set depending on what behaviors are present before this behavior. In addition supports for other behaviors to modify and extend the ConversationActor namely adding game and condition commands or modify sub title boxes using istener support.
Basic ConversationActor is set up like this:
convoActor.name
This behavior does not update itself automatically during thinking because locomotion handling in actors needs a specific order to work correctly:
ECBehaviorConversationActor.updateLocomotion() has to be called before calling Locomotion.update() since the HeadLookAtPlayback modifies the locomotion goal parameters.
ECBehaviorConversationActor.updateAnimator() has to be called before applying animations since playback instances use the base animator instance controllers as input.
It is possible to use this behavior on non-actor elements. In this case add first a behavior providing animator support and assign it to the behavior. Then this behavior will register and update in the right time. Supports ECBehaviorActorAnimated, ECBehaviorAnimated or ECBehaviorTwoStateAnimated for this use-case.
Bone Name Remapping
Behavior supports re-mapping bone names in response to ConversationActor.getMatrix() and ConversationActor.getInverseMatrix() . Define bone mappings using setBoneMapping(). The mappings are persistent until changed. Bone mappings are useful for various situations including the following ones:
See also:
This behavior can be used multiple times on an element to add multiple custom colors to mainpulate. Use the behavior identifier to tell them apart.
Element class properties have the prefix convoActor.
.
Set unique identifier of conversation actor.
convoActor.id
<string name='convoActor.id'>merchant</string>
Set alias identifier of conversation actor. Has to be unique inside the same conversation playback. Allows to add any actor with a known alias. For example the game can have conversation actors with id merchant1
and merchant2
. While talking to one of the two they can be added with the alias npc
. This way conversation scripts can refer to this actor using id npc
without needing to know which actor it is actually or they can use the actual id of the actor. Game scripts can use custom alias instead of this one.
convoActor.aliasId
<string name='convoActor.aliasId'>npc</string>
Set unicode display name.
convoActor.name
<string name='convoActor.name'>Tools Merchant</string>
Set subtitle selector. This allows to add designer selector to the game gui theme to style conversation panels shown for this conversation actor.
convoActor.subtitleSelector
<string name='convoActor.subtitleSelector'>ConvoActor.Merchant.Tools</string>
Set head rotator bone. Using a head rotator bone improves the head and eye look-at handling. Typically this is the head bone.
convoActor.headRotatorBone
<string name='convoActor.headRotatorBone'>head</string>
Set head rotator offset. If headRotatorBone
is used the offset is relative this bone. Otherwise the offset is relative to the element coordinate system.
convoActor.headRotatorOffset
<vector name='convoActor.headRotatorOffset' x='0' y='-1.65' z='0.2'/>
Set to register conversation actor in game world. Allows game scripts to locate conversation actors by identifier without needing to know which element they belong to.
convoActor.registerConvoActor
false
<boolean name='convoActor.registerConvoActor'>true</boolean>
This behavior has these events:
Return true if actor is doing something blocking if conversation actions wait for this actor.
Actor entered conversation.
Actor left conversation.
Modify sub title text created by behavior. Multiple listeners can modify sub title text by either modifying the widget pass to the listener or creating a new one.
This behavior adds these behavior tree actions.
This behavior adds these behavior tree conditions.
Determines if conversation actor is in a conversation.
This is an example of an action that can only run if the actor is in a conversation:
<action name='myAction' id='doing something'> <condition>conversationActor.inConversation</condition> </action>
Determines if conversation actor is not in a conversation.
This is an example of an action that can only run if the actor is not in a conversation:
<action name='myAction' id='doing something'> <condition>conversationActor.notInConversation</condition> </action>
This behavior requires no other behaviors.
This behavior does support element class to be persistable (setPersistable).
Since DragonScript Module Version 1.0
This example defines an element which has a conversation actor.
class MyElement extends BehaviorElementClass public var ECBehaviorComponent component public var ECBehaviorCollider collider public var ECBehaviorColliderAI colliderAI public var ECBehaviorLocomotion locomotion public var ECBehaviorParameterTable parameterTable public var ECBehaviorActorAnimated actorAnimated public var ECBehaviorBehaviorTree behaviorTree public var ECBehaviorConversationActor conversationActor func new() component = ECBehaviorComponent.new(this, null) collider = ECBehaviorCollider.new(this, component) colliderAI = ECBehaviorColliderAI.new(this, collider) locomotion = ECBehaviorLocomotion.new(this, colliderAI) parameterTable = ECBehaviorParameterTable.new(this) behaviorTree = ECBehaviorBehaviorTree.new(this) actorAnimated = ECBehaviorActorAnimated.new(this, component, locomotion) conversationActor = ECBehaviorConversationActor.new(this) conversationActor.setActorAnimated(actorAnimated) conversationActor.setLocomotion(locomotion) conversationActor.setParameterTable(parameterTable) conversationActor.addBehaviorTree(behaviorTree) end end
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='ECBehaviorColliderAI'/> <behavior type='ECBehaviorLocomotion'/> <behavior type='ECBehaviorParameterTable'/> <behavior type='ECBehaviorActorAnimated'/> <behavior type='ECBehaviorBehaviorTree'/> <behavior type='ECBehaviorConversationActor'> <!-- optional: use actor animated with id instead of empty string --> <string name='actorAnimated'>second</string> <!-- optional: use animated with id instead of empty string --> <string name='animated'>second</string> <!-- optional: use two state animated with id instead of empty string --> <string name='twoStateAnimated'>second</string> <!-- optional: add behavior trees. default adds behavior tree with empty string if present. --> <list name='behaviorTrees'> <!-- add behavior with empty identifier --> <string/> <!-- add behavior with 'default' identifier --> <string>default</string> </list> <!-- optional: use BaseGameApp subtitle theme. game can add more supported values. default is 'default'. also supported is value 'path:/path/to/theme.guitheme' --> <string name='subtitleTheme'>default</string> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.name'>value</string> </behavior> </elementClass>