{{tag>dragonscript behavior}}
[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorActorTransmission**
* [[behaviors_use_cases|Behaviors Explained: By Use-Case]]
* [[behaviors_a_to_z|Behaviors Explained: From A to Z]]
====== 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 #@LinkApiDocDEDS2_HTML~classDragengine_1_1ConversationSystem_1_1CActionActorSpeak.html#a3eff8b891213431c4c33cb296b5c3ad1,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 [[behavior_conversationactor|ECBehaviorConversationActor]]. Calls #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorConversationActor_1_1BehaviorConversationActor.html#afef6b6232c0c2df564a7f83a68e31f0c,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.
====== Instance Counts ======
This behavior can be added only once to an element class. While technically possible it there is no reason to use multiple transmissions since the sub titles can be styled.
====== Element Class Properties ======
Element class properties have the prefix **transmission.** if id is not empty.
===== waitInConversation =====
If enabled causes conversation scripts to wait for the transmission to end.
* Full name: "transmission.waitInConversation"
* Type boolean
* Default Value false
* Example (*.deeclass) true
===== style =====
Style identifier to use. Same as style identifiers used in sub title boxes.
* Full name: "transmission.style"
* Type string
* Default Value //null//
* Example (*.deeclass) think
===== timeout =====
Timeout in seconds to display individual transmission parts.
* Full name: "transmission.timeout"
* Type float
* Default Value 5
* Example (*.deeclass) ik.height
====== Required Behaviors ======
* [[behavior_conversationactor|ECBehaviorConversationActor]]
====== Optional Behaviors ======
This behavior does not support optional behaviors.
====== Persistency ======
This behavior supports persistency. These parameters are persisted:
* Wait in conversation flag
* Remaining display time
* Array of transmission parts remaining to be displayed
* Sub title widget being displayed right now
====== API Documentation ======
#@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorActorTransmission.html,ECBehaviorActorTransmission~@#.
Since DragonScript Module Version **1.7**
====== Use Cases ======
* Display single-line shouts of actors examining objects
* Display short notifications to player like touching a trigger
* Display true NPC communications
====== Element Class Example ======
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