Skip to main content

Crate bevy_map_dialogue

Crate bevy_map_dialogue 

Source
Expand description

bevy_map_dialogue - Dialogue tree types and runtime for bevy_map_editor

This crate provides types for creating branching dialogue trees with support for:

  • Multiple node types (Text, Choice, Condition, Action, End)
  • Player choices with optional conditions
  • Speaker assignments
  • Conditional branching
  • Action triggers

§Usage

use bevy_map_dialogue::{DialogueTree, DialogueNode, DialogueNodeType, DialogueChoice};

let mut tree = DialogueTree::new("greeting");
tree.name = "Merchant Greeting".to_string();

// Add a choice node
let choice_node = DialogueNode {
    node_type: DialogueNodeType::Choice,
    speaker: "Merchant".to_string(),
    text: "Welcome! What would you like?".to_string(),
    choices: vec![
        DialogueChoice { text: "Buy items".to_string(), next_node: Some("shop".to_string()), ..default() },
        DialogueChoice { text: "Sell items".to_string(), next_node: Some("sell".to_string()), ..default() },
        DialogueChoice { text: "Goodbye".to_string(), next_node: Some("end".to_string()), ..default() },
    ],
    ..default()
};
tree.add_node(choice_node);

Structs§

DialogueChoice
A player choice option in a dialogue
DialogueChoiceEvent
Message sent when the player makes a choice
DialogueEndEvent
Message sent when a dialogue ends
DialogueHandle
Component that holds a handle to a dialogue tree asset
DialogueNode
A single node in the dialogue tree
DialoguePlugin
Plugin for dialogue support
DialogueRunner
Current state of an active dialogue
DialogueTree
A complete dialogue tree with nodes and connections
StartDialogueEvent
Message to start a dialogue (sent via MessageWriter, read via MessageReader)

Enums§

DialogueNodeType
Type of dialogue node