Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.Scenery.ECBehaviorConversation Class Reference

Behavior element behavior adding conversation support. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorConversation:
Dragengine.Scenery.DefaultECBehavior Dragengine.Scenery.ECBehavior Dragengine.Scenery.BehaviorCompatiblePersistency

Classes

class  Factory
 Behavior factory. More...
class  Instance
 Behavior instance. More...

Public Member Functions

void dispose ()
 Dispose of behavior.
ECPStringID getAddPlayer ()
 Add player to conversation with identifier or null otherwise.
ECBehaviorBehaviorTree getBehaviorTree ()
 Behavior tree or null.
ECPConversation getConversation ()
 Conversation.
ECBehaviorConversationActor getConversationActor ()
 Conversation actor behavior or null if not used.
ECPBoolean getDirectCamera ()
 Conversation directs camera.
ECBehaviorPlayerControllable.Tracker getPlayerControlledActor ()
 Player controlled actor or null.
String getPrefix ()
 Prefix.
ECPSimpleConversation getSimpleConversation ()
 Simple conversation.
SimpleConversationConverter getSimpleConversationConverter ()
 Simple conversation converter.
ECPStringID getTopic ()
 Topic to use for conversation.
ECPStringID getTopicGroup ()
 Topic group to use for conversation.
ECBehaviorTriggered getTriggered ()
 Trigger conversation.
Instance instance (BehaviorElement element)
 Get instance in element from owner element class.
ECBehaviorConversation new (BehaviorElementClass eclass)
 Create behavior element class.
ECBehaviorConversation new (BehaviorElementClass eclass, Loaders loaders, TSTriggerTable triggerTable, ECBehaviorPlayerControllable.Tracker playerControlledActor)
 Create behavior element class.
ECBehaviorConversation new (BehaviorElementClass eclass, Loaders loaders, TSTriggerTable triggerTable, ECBehaviorPlayerControllable.Tracker playerControlledActor, String id)
 Create behavior element class.
ECBehaviorConversation new (BehaviorElementClass eclass, Loaders loaders, TSTriggerTable triggerTable, ECBehaviorPlayerControllable.Tracker playerControlledActor, String id, String subID)
ECBehaviorConversation new (BehaviorElementClass eclass, Loaders loaders, TSTriggerTable triggerTable, ECBehaviorPlayerControllable.Tracker playerControlledActor, String id, String subID, String prefix)
ECBehaviorConversation new (BehaviorElementClass eclass, String id)
 Create behavior element class.
ECBehaviorConversation new (BehaviorElementClass eclass, String id, String prefix)
 Create behavior element class.
void setBehaviorTree (ECBehaviorBehaviorTree behaviorTree)
 Set behavior tree or null.
void setConversationActor (ECBehaviorConversationActor conversationActor)
 Set conversation actor behavior or null if not used.
void setPlayerControlledActor (ECBehaviorPlayerControllable.Tracker playerControlledActor)
 Set player controllable tracker or null.
void setSimpleConversationConverter (SimpleConversationConverter converter)
 Set smple conversation converter.
Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
void assignInstanceIndex (int instanceIndex)
 Assign instance index.
String getBehaviorID ()
 Unique identifier of behavior.
String getID ()
 Identifier.
int getInstanceIndex ()
 Instance index.
void loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance)
 Load instance data of another behavior.
bool supportsBehaviorID (String identifier)
 Behavior supports loading instance data of another behavior.
Public Member Functions inherited from Dragengine.Scenery.ECBehavior
ECBehaviorInstance createInstance (BehaviorElement element)
 Create Behavior instance.

Static Public Member Functions

static ECBehaviorConversation getBehaviorIn (BehaviorElementClass eclass)
 Get behavior in element class or null if absent.

Public Attributes

ECPStringID pAddPlayer
ECBehaviorBehaviorTree pBehaviorTree
ECPConversation pConversation
ECBehaviorConversationActor pConversationActor
ECPBoolean pDirectCamera
ECBehaviorPlayerControllable.Tracker pPlayerControlledActor
String pPrefix
ECPSimpleConversation pSimpleConversation
SimpleConversationConverter pSimpleConversationConverter
ECPStringID pTopic
ECPStringID pTopicGroup
ECBehaviorTriggered pTriggered

Additional Inherited Members

Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
void setBehaviorID (String identifier)
 Set behavior identifier.
void useClassNameAsBehaviorID ()
 Set behavior identifier to "<class-name>:<identifier>".
void useFullyQualifiedClassNameAsBehaviorID ()
 Set behavior identifier to "<fully-qualified-class-name>:<identifier>".

Detailed Description

Behavior element behavior adding conversation support.

Loads a conversation resource file and allows to start a conversation using a user defined topic. Conversations are loaded once so multiple behaviors can load the same conversation file without doing the actual loading multiple times.

By default the conversation is started without adding any actors.

If the "addPlayer" stub property is not empty string the BaseGameApp.getPlayerControlledActor() actor is added to the conversation as first actor using the property value as its alias id. If the actor does not have a BaseActorConversation assigned an exception is thrown. The default element class property sets AddPlayer to "player".

If ECBehaviorConversationActor is present and has a conversation actor it is added as second actor to the conversation using the property valus as id. Additional actors can be added using conversation actions.

If the "directCamera" stub property is true the conversation does direct the camera using ConversationCameraDirector instance. The default element class property sets DirectCamera to true. Set this property to false to keep the camera unchanged which is required to do first person camera animations.

Starting the conversation can be done by calling startConversation(). This can be done by other behaviors or a subclass. Care has to be taken when starting conversation if another conversation is running. Actors are not allowed to be involved in more than one conversation but any number of conversation can be running at the same time as long as this rule is fulfilled.

To protect against this situation the method canStartConversation() is provided. It checks if the player and this behavior element have a ConversationActor and are both not involved in a conversation (given they are used for the conversation).

A typical use pattern is to start a conversation with a suitable element if the player "uses" said element. The code example below shows how this can be done in a simple way.

// this method is assumed to be called by the player implementation when he uses
// an element. this method is usually part of an ElementVisitor subclass
func void visitBehaviorElement(BehaviorElement element)
if instance != null and instance.canStartConversation()
instance.startConversation()
end
end
Behavior element.
Definition BehaviorElement.ds:56
Behavior instance.
Definition ECBehaviorConversation.ds:152
Behavior element behavior adding conversation support.
Definition ECBehaviorConversation.ds:105
Instance instance(BehaviorElement element)
Get instance in element from owner element class.

It checks if a behavior element has the ECBehaviorConversation behavior present. If this is the case it checks if the conversation can be started and starts it.

Another way to start a conversation is using the triggerConversation. If this trigger expression is not empty it will be used to start the conversation if the trigger expression evaluates to true. The method canStartConversation() is used to not check if the conversation is possible. If the check fails an exception is thrown to not silently not start a conversation.

This method is typically used to trigger conversation if the player enters a TriggerTouch or he finished a sequence of actions ending in firing a trigger.

This element behavior can be present only once in a BehaviorElement. Trying to add more than one instance results in an exception thrown.

Element class properties have the prefix "conversation.".

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

See also
https://developer.dragondreams.ch/wiki/doku.php/dragengine:modules:dragonscript:behavior_conversation

Member Function Documentation

◆ dispose()

void Dragengine.Scenery.ECBehaviorConversation.dispose ( )

Dispose of behavior.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

References getTopic(), pTopic, and pTopicGroup.

Referenced by getBehaviorIn().

◆ getAddPlayer()

ECPStringID Dragengine.Scenery.ECBehaviorConversation.getAddPlayer ( )

Add player to conversation with identifier or null otherwise.

Referenced by getBehaviorIn().

◆ getBehaviorIn()

◆ getBehaviorTree()

ECBehaviorBehaviorTree Dragengine.Scenery.ECBehaviorConversation.getBehaviorTree ( )

◆ getConversation()

ECPConversation Dragengine.Scenery.ECBehaviorConversation.getConversation ( )

Conversation.

References pDirectCamera.

Referenced by getBehaviorIn().

◆ getConversationActor()

ECBehaviorConversationActor Dragengine.Scenery.ECBehaviorConversation.getConversationActor ( )

Conversation actor behavior or null if not used.

References pTopic.

Referenced by getBehaviorIn(), getTopicGroup(), instance(), and new().

◆ getDirectCamera()

ECPBoolean Dragengine.Scenery.ECBehaviorConversation.getDirectCamera ( )

Conversation directs camera.

Referenced by getBehaviorIn(), and setConversationActor().

◆ getPlayerControlledActor()

ECBehaviorPlayerControllable.Tracker Dragengine.Scenery.ECBehaviorConversation.getPlayerControlledActor ( )

Player controlled actor or null.

Referenced by getBehaviorIn(), and getSimpleConversation().

◆ getPrefix()

String Dragengine.Scenery.ECBehaviorConversation.getPrefix ( )

◆ getSimpleConversation()

ECPSimpleConversation Dragengine.Scenery.ECBehaviorConversation.getSimpleConversation ( )

Simple conversation.

Version
1.25

References getPlayerControlledActor().

Referenced by getBehaviorIn().

◆ getSimpleConversationConverter()

SimpleConversationConverter Dragengine.Scenery.ECBehaviorConversation.getSimpleConversationConverter ( )

Simple conversation converter.

Version
1.25

Referenced by getBehaviorIn().

◆ getTopic()

ECPStringID Dragengine.Scenery.ECBehaviorConversation.getTopic ( )

Topic to use for conversation.

Referenced by dispose(), and getBehaviorIn().

◆ getTopicGroup()

ECPStringID Dragengine.Scenery.ECBehaviorConversation.getTopicGroup ( )

Topic group to use for conversation.

References getConversationActor().

Referenced by getBehaviorIn(), and new().

◆ getTriggered()

◆ instance()

◆ new() [1/7]

ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new ( BehaviorElementClass eclass)

Create behavior element class.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

References getConversationActor(), and pConversationActor.

Referenced by getBehaviorIn().

◆ new() [2/7]

ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new ( BehaviorElementClass eclass,
Loaders loaders,
TSTriggerTable triggerTable,
ECBehaviorPlayerControllable.Tracker playerControlledActor )

Create behavior element class.

References getTopicGroup(), and pTopicGroup.

◆ new() [3/7]

ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new ( BehaviorElementClass eclass,
Loaders loaders,
TSTriggerTable triggerTable,
ECBehaviorPlayerControllable.Tracker playerControlledActor,
String id )

Create behavior element class.

◆ new() [4/7]

ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new ( BehaviorElementClass eclass,
Loaders loaders,
TSTriggerTable triggerTable,
ECBehaviorPlayerControllable.Tracker playerControlledActor,
String id,
String subID )

◆ new() [5/7]

ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new ( BehaviorElementClass eclass,
Loaders loaders,
TSTriggerTable triggerTable,
ECBehaviorPlayerControllable.Tracker playerControlledActor,
String id,
String subID,
String prefix )

◆ new() [6/7]

ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new ( BehaviorElementClass eclass,
String id )

Create behavior element class.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ new() [7/7]

ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.new ( BehaviorElementClass eclass,
String id,
String prefix )

Create behavior element class.

◆ setBehaviorTree()

void Dragengine.Scenery.ECBehaviorConversation.setBehaviorTree ( ECBehaviorBehaviorTree behaviorTree)

Set behavior tree or null.

Version
1.26

References pConversationActor.

Referenced by getBehaviorIn(), and Dragengine.Scenery.ECBehaviorConversation.Instance.BTAStart.runAction().

◆ setConversationActor()

void Dragengine.Scenery.ECBehaviorConversation.setConversationActor ( ECBehaviorConversationActor conversationActor)

Set conversation actor behavior or null if not used.

References getDirectCamera(), and pDirectCamera.

Referenced by getBehaviorIn().

◆ setPlayerControlledActor()

void Dragengine.Scenery.ECBehaviorConversation.setPlayerControlledActor ( ECBehaviorPlayerControllable.Tracker playerControlledActor)

Set player controllable tracker or null.

Referenced by getBehaviorIn().

◆ setSimpleConversationConverter()

void Dragengine.Scenery.ECBehaviorConversation.setSimpleConversationConverter ( SimpleConversationConverter converter)

Set smple conversation converter.

Version
1.25

Referenced by getBehaviorIn().

Member Data Documentation

◆ pAddPlayer

ECPStringID Dragengine.Scenery.ECBehaviorConversation.pAddPlayer

Referenced by getBehaviorIn(), and getBehaviorTree().

◆ pBehaviorTree

ECBehaviorBehaviorTree Dragengine.Scenery.ECBehaviorConversation.pBehaviorTree

Referenced by getBehaviorIn().

◆ pConversation

ECPConversation Dragengine.Scenery.ECBehaviorConversation.pConversation

Referenced by getBehaviorIn().

◆ pConversationActor

ECBehaviorConversationActor Dragengine.Scenery.ECBehaviorConversation.pConversationActor

◆ pDirectCamera

ECPBoolean Dragengine.Scenery.ECBehaviorConversation.pDirectCamera

◆ pPlayerControlledActor

ECBehaviorPlayerControllable.Tracker Dragengine.Scenery.ECBehaviorConversation.pPlayerControlledActor

Referenced by getBehaviorIn().

◆ pPrefix

String Dragengine.Scenery.ECBehaviorConversation.pPrefix

Referenced by getBehaviorIn().

◆ pSimpleConversation

ECPSimpleConversation Dragengine.Scenery.ECBehaviorConversation.pSimpleConversation

Referenced by getBehaviorIn().

◆ pSimpleConversationConverter

SimpleConversationConverter Dragengine.Scenery.ECBehaviorConversation.pSimpleConversationConverter

Referenced by getBehaviorIn().

◆ pTopic

ECPStringID Dragengine.Scenery.ECBehaviorConversation.pTopic

◆ pTopicGroup

ECPStringID Dragengine.Scenery.ECBehaviorConversation.pTopicGroup

Referenced by dispose(), getBehaviorIn(), and new().

◆ pTriggered

ECBehaviorTriggered Dragengine.Scenery.ECBehaviorConversation.pTriggered

Referenced by getBehaviorIn().


The documentation for this class was generated from the following file: