Page 1 of 1

Switching Character portraits in script

Posted: Tue May 04, 2021 11:44 am
by rykaan
Hi Tony,

I'm attempting to switch the default portrait of a character during a conversation via script, then using the 'SetPortrait(CHARACTERNAME, default)' sequence to refresh to the newly updated portrait. It works for a single line of dialogue, but then the portrait is missing in the following line. The documentation reads that the 'SetPortrait' sequence would keep the change until changed again, so I'm confused as to why this wouldn't remain for the whole conversation.
Switch Snake Portrait.jpg
Switch Snake Portrait.jpg (43.35 KiB) Viewed 299 times
Switch Snake Portrait disappear.jpg
Switch Snake Portrait disappear.jpg (139.75 KiB) Viewed 299 times

Re: Switching Character portraits in script

Posted: Tue May 04, 2021 2:22 pm
by Tony Li
Hi,

Treat the dialogue database as read-only at runtime.

When a conversation starts, it caches the actors' info, including their display names and portraits. Try changing the cached value. Example:

Code: Select all

DialogueManager.conversationModel.SetActorPortraitSprite("Fruit Snek", snakeSegments[9].segment.sprite);

Re: Switching Character portraits in script

Posted: Wed May 05, 2021 6:10 am
by rykaan
Thanks Tony,

The portrait being removed on the following line of dialogue had something to do with using the sequence command. When I switched to using the code you suggested it switched correctly. By using both the cache change in conversation + the database change, the portrait is correct for subsequent conversations too.

Cheers!
Rob

Re: Switching Character portraits in script

Posted: Wed May 05, 2021 8:11 am
by Tony Li
Hi Rob,

Great! Glad it's working now.