Drag[en]gine Script Module DragonScript  1.21
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  Instance
 Behavior instance. More...
 

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

ECPStringID pAddPlayer
 
ECPConversation pConversation
 
ECBehaviorConversationActor pConversationActor
 
ECPBoolean pDirectCamera
 
ECBehaviorPlayerControllable.Tracker pPlayerControlledActor
 
ECPStringID pTopic
 
ECPStringID pTopicGroup
 
ECBehaviorTriggered pTriggered
 

Additional Inherited Members

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

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)
var ECBehaviorConversation.Instance instance = ECBehaviorConversation.getInstanceIn(element)
end
end
bool canStartConversation()
Conversation can be started.
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).

Member Function Documentation

◆ dispose()

void Dragengine.Scenery.ECBehaviorConversation.dispose ( )

Dispose of behavior.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ getAddPlayer()

ECPStringID Dragengine.Scenery.ECBehaviorConversation.getAddPlayer ( )

Add player to conversation with identifier or null otherwise.

◆ getBehaviorIn()

static ECBehaviorConversation Dragengine.Scenery.ECBehaviorConversation.getBehaviorIn ( BehaviorElementClass  eclass)
static

Get behavior in element class or null if absent.

Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorConversation.

◆ getConversation()

ECPConversation Dragengine.Scenery.ECBehaviorConversation.getConversation ( )

Conversation.

◆ getConversationActor()

ECBehaviorConversationActor Dragengine.Scenery.ECBehaviorConversation.getConversationActor ( )

Conversation actor behavior or null if not used.

◆ getDirectCamera()

ECPBoolean Dragengine.Scenery.ECBehaviorConversation.getDirectCamera ( )

Conversation directs camera.

◆ getPlayerControlledActor()

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

Player controlled actor or null.

◆ getTopic()

ECPStringID Dragengine.Scenery.ECBehaviorConversation.getTopic ( )

Topic to use for conversation.

◆ getTopicGroup()

ECPStringID Dragengine.Scenery.ECBehaviorConversation.getTopicGroup ( )

Topic group to use for conversation.

◆ getTriggered()

ECBehaviorTriggered Dragengine.Scenery.ECBehaviorConversation.getTriggered ( )

Trigger conversation.

◆ instance()

Instance Dragengine.Scenery.ECBehaviorConversation.instance ( BehaviorElement  element)

Get instance in element from owner element class.

◆ new() [1/7]

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

Create behavior element class.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ new() [2/7]

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

Create behavior element class.

◆ 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.

◆ setConversationActor()

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

Set conversation actor behavior or null if not used.

◆ setPlayerControlledActor()

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

Set player controllable tracker or null.

Member Data Documentation

◆ pAddPlayer

ECPStringID Dragengine.Scenery.ECBehaviorConversation.pAddPlayer

◆ pConversation

ECPConversation Dragengine.Scenery.ECBehaviorConversation.pConversation

◆ pConversationActor

ECBehaviorConversationActor Dragengine.Scenery.ECBehaviorConversation.pConversationActor

◆ pDirectCamera

ECPBoolean Dragengine.Scenery.ECBehaviorConversation.pDirectCamera

◆ pPlayerControlledActor

ECBehaviorPlayerControllable.Tracker Dragengine.Scenery.ECBehaviorConversation.pPlayerControlledActor

◆ pTopic

ECPStringID Dragengine.Scenery.ECBehaviorConversation.pTopic

◆ pTopicGroup

ECPStringID Dragengine.Scenery.ECBehaviorConversation.pTopicGroup

◆ pTriggered

ECBehaviorTriggered Dragengine.Scenery.ECBehaviorConversation.pTriggered

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