Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

DialogNodeBuilder

One node of a conversation, one method each: what the NPC says, what the player may answer, and what the node does. Targets gathers the nodes its choices go to, which start checks.

Type Parameter Default type
Values extends DialogValues -
Targets extends string never

new DialogNodeBuilder<Values, Targets>(name, values): DialogNodeBuilder<Values, Targets>

Parameter Type
name string
values Values

DialogNodeBuilder<Values, Targets>

choice<To>(text, to, choiceOptions?): DialogNodeBuilder<Values, Targets | To>

An answer the player may pick, which goes to the node to.

Type Parameter
To extends string
Parameter Type
text string
to To
choiceOptions ChoiceOptions<Values>

DialogNodeBuilder<Values, Targets | To>


do(action): DialogNodeBuilder<Values, Targets>

Runs action once as the node begins, before its line shows: what a choice does in the world, such as a purchase.

Parameter Type
action (talk) => void

DialogNodeBuilder<Values, Targets>


end(): DialogNodeBuilder<Values, Targets>

Ends the conversation on the Interact key once the line shows.

DialogNodeBuilder<Values, Targets>


say<Line>(line): DialogNodeBuilder<Values, Targets>

The NPC’s line, with {name} for a value: "Moonleaf, {price} coins.".

Type Parameter
Line extends string
Parameter Type
line CheckedLine<Line, ValueName<Values>>

DialogNodeBuilder<Values, Targets>