Page 1 of 1

Change Player portrait picture

Posted: Thu Apr 04, 2024 10:57 am
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

Re: Change Player portrait picture

Posted: Thu Apr 04, 2024 11:42 am
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.