Changing character portrait

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
sanmaow
Posts: 6
Joined: Tue Jul 05, 2022 4:24 pm

Changing character portrait

Post by sanmaow »

Having trouble changing character portrait during conversation. I am using the SetPortrait(actorName, textureName) sequence function. I first tried directly putting the portrait sprite name, and the console returned a not found message. I did realize that the parameter requires a path to a texture inside the resources folder, but I don't know the correct syntax for stating a path for Lua, I tried using "/" and still getting the not found message. Also stating the path every time seems error prone, can anyone explain how to define multiple portrait images in the database?
User avatar
Tony Li
Posts: 22140
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing character portrait

Post by Tony Li »

Hi,

The easiest way is to assign the portraits to the actor in the Dialogue Editor's Actors section. Each portrait will a have a number (1, 2, 3, etc.). Then use [pic=#] in a dialogue entry node's Dialogue Text to use the specified portrait for only that node. To change it ongoing, use the SetPortrait() sequencer command (it's not a Lua function) with pic=# as the second parameter. For example, if you want to change the actor named Fred to portrait #2:

Code: Select all

{{default}}; // Also play Dialogue Manager's Default Sequence.
SetPortrait(Fred, pic=2)
sanmaow
Posts: 6
Joined: Tue Jul 05, 2022 4:24 pm

Re: Changing character portrait

Post by sanmaow »

Where exactly is the Dialogue Editor's Actor section? Is it the actors section in the database, or the actors tab when editing a conversation, in either cases I don't see an option to upload/drop sprites.
sanmaow
Posts: 6
Joined: Tue Jul 05, 2022 4:24 pm

Re: Changing character portrait

Post by sanmaow »

Neverminded, I've found it :)
Post Reply