Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » ECBehaviorActorTransmission
Behavior adding support for sub title transmission to actor.
For doing sub title text output conversation scripts have to be used. This allow for the highest control over the conversation. For first person only self conversation or receiving transmissions using conversation scripts can be cumbersome. For this situation this behavior provides a simpler solution.
The behavior acts similar to CActionActorSpeak.executeSubTitle() in that it supports creating and adding a series of sub titles for an actor as if a conversation is used. Since no conversation is used the actor is free to be controlled by the player.
This behavior uses ECBehaviorConversationActor. Calls createSubTitleText() to create sub title as if a conversation creates it. This way the same look and feel is used. Adds a listener to cause the actor to wait in conversations if such sub titles are running. This feature is by default disabled and can be enabled to avoid conversation script sub titles showing at the same time as sub titles driven by this behavior.
This behavior can be used only once on an element.
Element class properties have the prefix transmission.
.
If enabled causes conversation scripts to wait for the transmission to end.
transmission.waitInConversation
false
<boolean name='transmission.waitInConversation'>true</boolean>
Style identifier to use. Same as style identifiers used in sub title boxes.
transmission.style
null
<string name='transmission.style'>think</string>
Timeout in seconds to display individual transmission parts.
transmission.timeout
5
<string name='transmission.timeout'>ik.height</string>
Set clear transmission upon entering conversation.
transmission.clearEnterConversation
<boolean name='transmission.clearEnterConversation'>true</boolean>
This behavior has no events.
This behavior does not support optional behaviors.
This behavior supports persistency. These parameters are persisted:
Since DragonScript Module Version 1.7
pin Dragengine.Scenery class ObjectElementClass extends BaseActorClass public var ECBehaviorActorTransmission actorTransmission public func new() super("ExampleObject") // the base actor class creates a conversation actor behavior we can use // create actor transmission behavior. uses the BaseGameApp created subtitle box. actorTransmission = ECBehaviorActorTransmission.new(this, getConversationActor()) end end class ExampleAction extends BAAFirstPerson public var ECBehaviorActorTransmission.Instance actorTransmission public func new() end // store the behavior so we can use it protected func void initBehaviors() super.initBehaviors() actorTransmission = ECBehaviorActorTransmission.getInstanceIn(actor) end // at some point trigger a transmission to the player. this example shows a // transmission with two parts. any number of parts can be used but shorter // is usually better. for longer transmissions better use conversation // scripts since there you have much more possibilities. public func void showTransmission(String text1, String text2) // clear transmission if one is running. you can use isRunning() to check actorTransmission.clear() // add two parts to the transmission. transmission starts as soon as one // part is present and ends once all parts have been shown actorTransmission.addPart(UnicodeString.newFromUTF8(text1)) actorTransmission.addPart(UnicodeString.newFromUTF8(text2)) 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='ECBehaviorConversationActor'/> <behavior type='ECBehaviorActorTransmission'> <!-- optional: use BaseGameApp sub title. game can add more supported values. default is 'default' --> <string name='subTitle'>default</string> <!-- set element properties. omit property prefix if used inside behavior tag --> <float name='.timeout'>3</float> </behavior> </elementClass>