Skip to content

Dialogues

Greg edited this page Jul 15, 2023 · 15 revisions

Characters

Players

Player dialogues are the simplist and you only need to provide the text and expression used.

player<Unsure>("I'd like to trade.")

image

NPCs

To start a dialogue with an NPC player.talkWith(npc) must first be called.

This is automatically done when interacting with an npc via an NPCOption such as ItemOnNPC.

All future npc dialogues will refer back to the npc being interacted with.

npc<Talk>("Sorry I don't have any quests for you at the moment.")

image

For dialogues with multiple npcs, the npcs ids can be provided

npc<Furious>(npcId = "wally", text = "Die, foul demon!", clickToContinue = false)

image

Choices

Multi-choice options

choice {
    option("Yes I'm sure!") {
        npc<Cheerful>("There you go. It's a pleasure doing business with you!")
    }
    option("On second thoughts, no thanks.")
}

image

Choices can be given custom titles

choice("Start the Cook's Assistant quest?") {
    option("Yes.") {
    }
    option("No.") {
    }
}

Options

Anthing in an action will be executed after an option has been selected. This can include a mix of delays and character modifications as well as other dialogues.

option("Yes I'm sure!") {
   player.inventory.remove("coins", cost)
   npc<Cheerful>("There you go. It's a pleasure doing business with you!")
}

Dialogues will end if an option without an action specified is selected

option("On second thoughts, no thanks.")

Options can be given an expression to have the player repeat the dialogue selected

// ❌ Manual
option("I'd like to trade.") {
    player<Unsure>("I'd like to trade.")
}
// ✅ Automatic
option<Unsure>("I'd like to trade.") {
}

Options be filtered so they are only displayed when the condition is met.

option("Can you teleport me to the Rune Essence?", { player["rune_mysteries"] == "completed" }) {
    player.tele(2910, 4830)
}

When only one options condition is met then that option will be automatically selected

choice {
    option<Talk>("Nothing, thanks.")
}
Clone this wiki locally