Introduce your characters#
An Actor turns a line into speech: it gives the line a display name, a look, and a way of revealing its text. You'll define the gate guard and the player character in a Compendium, then give the guard a calm and an angry portrait for the moment the conversation turns sour.
Before you begin#
Complete Write your first conversation. This guide continues with its Gate Conversation Script and the Village Gate game object. You'll also need two portraits for the guard, one calm and one angry, imported as Sprites.
Create a Compendium#
Actors live in a Compendium, the asset that resolves the identifiers a Script uses.
- Right-click a folder in the Project window.
- Choose
Create→Game Creator→Dialogue→Compendium. - Name the asset
Village.
You don't need to assign the Compendium anywhere. Dialogue collects every Compendium asset in the project automatically, so every Script can use its definitions. To check, open Window → Visual Script → Settings, select Dialogue, and find Village in the Compendiums list. Click Refresh if it's missing.
Add the Actors#
Select Village, click Add Actor…, and set Actor to Guard and Name to Bram. Then add a second Actor with Actor set to Player and Name set to Ash.
The Actor field is the identifier you'll write in the Script, while Name is what the player reads. Because the two are separate, you can rename Bram later without editing a single line of dialogue.
An Actor also has Description, Sprite, and Color fields. Whether they appear on screen depends on the Skin. The sample Skins show the Actor's name, and take the portrait from the line's Expression, which you'll add later in this guide.
Give lines a speaker#
Open Gate Conversation and replace its text. Write the Actor identifier, a colon, and the line:
The road ends at a wooden gate set into the village wall.
Guard: Halt! State your business, traveler.
Player: I'm looking for a place to rest for the night.
Guard: The inn is full of merchants this week. Try the barn.
Player: The barn? I've walked all day.
Guard: Then walk a little further. The gate stays shut.When a line plays, Dialogue looks up Guard in the Compendium and hands the interface everything it knows about Bram. The first line has no speaker, so it still appears as narration.
Identifiers must match exactly
Guard and guard are different identifiers. When a line names an Actor that no Compendium defines, Dialogue drops the identifier and shows the text as narration, without an error. If a name is missing in Play mode, compare the spelling in the Script with the Actor field.
The same rule catches narration that happens to start with a word and a colon. Dialogue reads Warning: the bridge is out. as a line spoken by an Actor called Warning, so the player sees the bridge is out. with no speaker. Rephrase the line, or move the colon away from the first word.
Type the guard's lines#
A Text Effect controls how a line appears. Select the Guard Actor and change Text Effect to Typewriter.
Typewriter reveals the line one character at a time. Speed is measured in characters per second and starts at 24, and a short gibberish sound repeats while the text types. Try a lower speed for a slow, gruff voice.
While a line is still typing, pressing continue completes it immediately. The next press moves to the following line, so a player who reads quickly is never held back.
Add portraits with Expressions#
An Expression is an alternative look for an Actor, chosen line by line. Give the guard two:
- Expand the
GuardActor and click Add Expression…. - Set Expression to
calmand assign the calm portrait to Sprite. - Add a second Expression, set it to
angry, and assign the angry portrait.
Add a period and the Expression identifier after the Actor to use it:
The road ends at a wooden gate set into the village wall.
Guard.calm: Halt! State your business, traveler.
Player: I'm looking for a place to rest for the night.
Guard.calm: The inn is full of merchants this week. Try the barn.
Player: The barn? I've walked all day.
Guard.angry: Then walk a little further. The gate stays shut.Each line shows only the Expression it names, which is why both calm lines name calm. The last line switches the guard to angry. A guard line without an Expression would show no portrait at all, because the sample Skins take it from the Expression.
Later guides leave the Expression out
To keep the examples short, the following guides write Guard: without an Expression. Add .calm to the guard's lines in your own Scripts to keep his portrait on screen.
An Expression can also run Instructions. On Enter runs when the guard's line switches to that Expression, and On Exit runs when his next line names another Expression or none, or when the conversation ends. Because both calm lines name calm, its On Enter runs once, and Ash's line in between doesn't interrupt it. Use them for effects that last, such as playing an animation on the guard's model.
Verify the result#
Enter Play mode and read through the conversation:
- The first line appears without a name.
- Bram's lines show his name and the calm portrait, and type out one character at a time.
- Ash's lines show the name
Ashand appear all at once. - The last line switches to the angry portrait.
Where to go next#
- Start a conversation near an NPC — play this conversation when the player walks up to the guard.
- Compendiums — review every Actor and Expression field.
- User interface — swap the speech bubble for a different one with an Expression's Speech field.