[Feature Request] Change [pic=] markup to use SetPortrait logic

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
digiwombat
Posts: 50
Joined: Sun Jun 16, 2019 4:59 am

[Feature Request] Change [pic=] markup to use SetPortrait logic

Post by digiwombat »

Hey again.

Simple one this time!

Currently the inline markup tag for changing portraits [pic=<index>] uses its own logic that requires the use of the portrait indexes (unless I missed a function call somewhere). It would be mighty fine if the [pic] markup tag used the SetPortrait logic so that we could use portraits from the resources folder or by name.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: [Feature Request] Change [pic=] markup to use SetPortrait logic

Post by Tony Li »

Thanks for the suggestion! To maintain compatibility with Chat Mapper, [pic=#] will remain unchanged. Can you get by with SetPortrait()?
User avatar
digiwombat
Posts: 50
Joined: Sun Jun 16, 2019 4:59 am

Re: [Feature Request] Change [pic=] markup to use SetPortrait logic

Post by digiwombat »

SetPortrait() should actually be enough. I think I made an assumption about the inline command that wasn't true. I was imagining something that would allow mid-dialogue shifting like so:
Bob: [pic=Happy]Hey, I didn't think you'd-- [pic=Concerned]Oh... it's you.
But thinking about the code I was looking at, it just sets things during the text formatting phase and only uses that.

In which case, I'd like to amend my request slightly to be the ability to include a tag or have a bool to set a node to "Append to Previous" which would allow for things like that unless there is currently a way to achieve that that I don't know about.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: [Feature Request] Change [pic=] markup to use SetPortrait logic

Post by Tony Li »

There are currently two ways you can do it:

1. Use RPGMaker codes:
  • Dialogue Text 1: "[pic=Happy]Hey, I didn't think you'd --"
  • Dialogue Text 2: "[pic=Concerned]\>Hey, I didn't think you'd --\< Oh... it's you."
2. Or use SetPortrait() in the Sequence field:
  • DialogueText: "Hey, I didn't think you'd -- Oh... it's you."
  • Sequence: {{default}}; SetPortrait(Happy); SetPortrait(Concerned)@0.6
User avatar
digiwombat
Posts: 50
Joined: Sun Jun 16, 2019 4:59 am

Re: [Feature Request] Change [pic=] markup to use SetPortrait logic

Post by digiwombat »

The first option would work okay except I'm using SuperTextMesh and it uses its own reader code. As such, I've got a request in for a solution for that with Kai.

Though STM does allow inline event firing so I can actually just run an event to handle it I think via <e=String>. So STM might actually have a solution for this particular issue for me.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: [Feature Request] Change [pic=] markup to use SetPortrait logic

Post by Tony Li »

Since you're using STM, inline event firing is a good way to go. You can configure the event to call:

DialogueManager.instance.SetActorPortraitSprite(actorName, sprite);

A simple example if your portraits are in a Resources folder:

Code: Select all

var sprite = Resources.Load<Sprite>("Happy");
DialogueManager.instance.SetActorPortraitSprite("Player, sprite);
If you're using addressables, they load asynchronously, so it's a little more complicated. Example:

Code: Select all

DialogueManager.LoadAsset("Happy", typeof(Sprite),
    (asset) =>
    {
        var sprite = asset as Sprite;
        DialogueManager.instance.SetActorPortraitSprite("Player", sprite);
    }
Post Reply