Page 1 of 1

Using Portraits with custom names not index

Posted: Wed Mar 27, 2019 10:54 pm
by Heiden
Hi!

I was wondering if there was a way to change Portraits by names I've given them, instead of the index. I have ~128 different expressions for each of my characters (oops;; haha) and it would be a lot easier if I could just name all of them and then do [pic="angryface"] instead of trying to figure out which number it's assigned to.

Thank you!

Re: Using Portraits with custom names not index

Posted: Wed Mar 27, 2019 11:25 pm
by Tony Li
Hi,

Not exactly. But here are some ideas:

1. Put the portrait files in a Resources folder (or assetbundle if you prefer). You can put them in subfolders by actor name, such as "Resources / Bob / angryface". Then use the SetPortrait() sequencer command, such as:
  • Sequence: SetPortrait(Bob, Bob/angryface)
The difference between [pic=#] in Dialogue Text and SetPortrait() in a Sequence is that SetPortrait() permanently changes the portrait until you change it again with another SetPortrait() command.

2. Or define dialogue database variables with names such as "angryface" and set their numeric values (e.g., 42). Then change the [pic=42] to [pic=[var=angryface]].

Re: Using Portraits with custom names not index

Posted: Thu Mar 28, 2019 2:13 am
by DragoonHP
It would be really nice if using custom names for portrait is possible

Re: Using Portraits with custom names not index

Posted: Thu Mar 28, 2019 9:43 am
by Tony Li
I agree. The number system comes from Chat Mapper. The Dialogue System was originally a Unity front-end for Chat Mapper and uses Chat Mapper's data format. In general it's a robust format that's used widely by professional narrative writers. But there are a few areas like this where it's a bit awkward.

Any suggestions about how you'd define those custom names? Would it be sufficient to simply go by the image filename?

Re: Using Portraits with custom names not index

Posted: Thu Mar 28, 2019 10:15 am
by DragoonHP
Actors field can have a portrait field array where people can drag in the image and give it a custom name?

Re: Using Portraits with custom names not index

Posted: Thu Mar 28, 2019 11:31 am
by Tony Li
I think that should work. When you add a portrait, the name will default to the image filename, but you can change it. I'll add this to the roadmap.

Re: Using Portraits with custom names not index

Posted: Thu Mar 28, 2019 9:06 pm
by Heiden
Oh thank you!!

I think I'll try the SetPortrait() method for now!
And excited to hear that a change has been added to the roadmap!