Conversations

From The DarkMod Wiki
Jump to navigationJump to search

Adding Conversations to your Map

All the info regarding a map's conversations are contained within atdm:conversation_info entities. Each of these entities can define one or more conversations. In the end of the day there will be a custom conversation editor GUI for DarkRadiant, but for now you'll need to add these entities yourself and set the spawnargs manually.

Each conversation can have one or more Actors. These are the AI which will participate in the conversation.

Each conversation consists of a sequence of so-called Conversation Commands, which are atomic actions you can use to make the actors do what you want them to. Examples are "Talk", "Attack", "WalkToEntity", etc.

Add a Conversation Info entity

Right-click somewhere in the grid view and hit "Create Entity" which will open the dialog for selecting the entity classes. Go to Conversation and select atdm:conversation_info.

Add the conversation spawnargs

Once the entity is created you can start defining your conversation. Here is an example of a simplistic "conversation" containing exactly one command:

"conv_1_name" "Testconversation 1"                // defines the name of the conversation (mandatory)
"conv_1_actor_1" "atdm:ai_builder_guard_1"        // first actor
"conv_1_actor_2" "atdm:ai_builder_guard_2"        // second actor

// Here's the first conversation command
"conv_1_cmd_1_actor" "1"                          // Actor 1
"conv_1_cmd_1_type" "Talk"                        // should "Talk"
"conv_1_cmd_1_arg_1" "tdm_test_conversation_1_1"  // the sound shader 'tdm_test_conversation_1_1'

So basically, this conversation has a name Testconversation 1, two actors (builder_guard_1 and 2) and lets the actor 1 play the sound shader tdm_test_conversation_1_1.

As you can see, the naming convention for the spawnargs is like this:

conv_<index>_<key>

The purpose of <index> is to distinguish multiple conversations defined on the same conversation info entity. The <key> is then defining the properties and commands of this conversation. Each conversation can have multiple commands, that's why these spawnargs are equipped with indices as well ("conv_1_cmd_N_...").

The above example is defining a command called Talk. There are more conversation commands available, each having a varying number of arguments. See the section below for details.

Each conversation must have a name and at least one actor and one command, otherwise the parser will flag the conversation as invalid and it will therefore be ignored.

Note: The <index> value is always numeric and starts with 1.

Spawnargs

Conversation

These spawnargs can be used to define properties that affect the conversation as a whole. The uppercase N indicates the conversation number (starting from 1).

conv_N_name (string)
defines the name of the conversation. This is a mandatory spawnarg, a conversation without a name will be ignored.
conv_N_actor_Y (entity name)
define the names of the AI participating in this conversation. At least one actor is required, otherwise the conversation is invalid.
conv_N_actors_must_be_within_talkdistance (1/0) default is 1
if set to "1", all actors are told to walk towards each other before the conversation actually starts.
conv_N_talk_distance (float) default is 60
defines the maximum distance AI should be away from each other while talking. When the spawnarg actors_must_be_within_talkdistance is set to 1, this distance tells the AI when to stop when walking towards each other.
conv_N_max_play_count (int) default is -1
defines the maximum number of times this conversation is allowed to "play". After this number has been exhausted, the conversation won't be started anymore.
conv_N_cmd_Y_...
the conversation commands (see below). One conversation must have at least one and is allowed to have multiple conversation commands.

Conversation Commands

These spawnargs can be used to define the properties of a single conversation command. The prefix conv_N_ refers to the conversation these commands are associated with. The number M refers to the command number (starting at 1).

conv_N_cmd_M_type (string == command type name)
defines the type of this command (this is a mandatory spawnarg, each command must have a type). See below for a list of available type names, an example is the type RunScript.
conv_N_cmd_M_actor (integer actor number, starting from 1)
defines which actor should perform this command. Note that the value of this spawnarg is a number X referring to the conv_N_actor_X definition above. You address a conversation's actor by this number, not by its name. This allows for quick reassignment of actors just by replacing the actor in the conversation without having to traverse the conversation commands.
conv_N_cmd_M_wait_until_finished (1/0), default is 1
defines whether the conversation should wait for the actor to complete this command before the next command is executed. Setting this to "0" allows to step over to the next command with nearly no time loss. This can be used to issue two or more commands at virtually the same time to an actor, so that the commands "Talk" and "PlayAnimOnce" are executed side-by-side by the same AI, for instance.
conv_N_cmd_M_arg_L
defines the arguments of this conversation command. The actual arguments depend on the command type, each type is requiring a different amount of arguments, and some of them are optional. See below for a description of the command's arguments.

Conversation Commands

The following is a list of available conversation commands:

  • Talk
  • WalkToEntity
  • StopMove
  • TurnToEntity
  • TurnToPosition
  • TurnToActor
  • LookAtEntity
  • LookAtPosition
  • LookAtActor
  • AttackEntity
  • AttackActor
  • ActivateTarget
  • WaitSeconds
  • WalkToPosition
  • PlayAnimOnce
  • PlayAnimCycle
  • InteractWithEntity (AI walks to an entity, plays use anim and triggers frobaction script)
  • RunScript (runs a local or global script function)