Change Player portrait picture

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Grayson
Posts: 20
Joined: Wed Jan 13, 2021 4:00 pm

Change Player portrait picture

Post by Grayson »

Hi Tony,

Is there a way to change the player portrait sprite dynamically? For example, when the player is a human I want a human portrait to display in the dialogue boxes, but when they are an Orc I want an orc portrait to be displayed, Any help is appreciated.

Thanks,

Grayson
User avatar
Tony Li
Posts: 20774
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change Player portrait picture

Post by Tony Li »

Hi,

One way is to assign the different images to the Actor's Portrait Sprites list in the Dialogue Editor. Note the number of each image (e.g., [1] for human, [2] for orc, [3] for elf, etc.). Then use the C# method DialogueManager.SetPortrait(). For example, to set the Player actor's portrait to [2]:

Code: Select all

DialogueManager.SetPortrait("Player", "pic=2");
Alternatively, you can put the portrait images in a folder named "Resources" and then specify an image name. Example:

Code: Select all

DialogueManager.SetPortrait("Player", "orc"); // Assumes image named "orc" is in a Resources folder.
Post Reply