Changing player portraits.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
HughDMann
Posts: 8
Joined: Fri Feb 08, 2019 10:25 am

Changing player portraits.

Post by HughDMann »

Hi, so I'm using the SetPortrait() function, and am able to get portraits to change. However, the portraits aren't changing immediately, the change doesn't take effect until the next subtitle.

According to the documentation for the SetPortrait() command:
As of version 1.2.4, this command takes visual effect immediately instead of waiting until the next subtitle.

I'm on the newest release, version 2.1.1, so presumably this should be working.

What can I do to get the portrait changes to take effect immediately on the subtitle that they're assigned to?

Thanks.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing player portraits.

Post by Tony Li »

Hi,

I'll check this today and provide an answer or a fix.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing player portraits.

Post by Tony Li »

Hi,

Can you provide an example scene?

I haven't been able to reproduce the issue. Here's an example: Test_SetPanel_2019-02-08.unitypackage

The NPC goes from a green portrait to a red portrait to an anime portrait. The portrait changes happen on the same node that contains the SetPanel() command.
HughDMann
Posts: 8
Joined: Fri Feb 08, 2019 10:25 am

Re: Changing player portraits.

Post by HughDMann »

Hi, thanks for the response.

I can see that the NPC portraits are working as expected. I should have mentioned that I was actually having issues with the Player portaits. When setting up the Player portraits in the same way that the NPCs are setup, and using the JRPG Unity UI Dialogue UI so the Player's portraits are also visible, the Player is not updating until the following subtitle.

For an example of this, I extended the example that you sent and added some lines for the Player attempting to change the portrait using SetPortrait() in the same way.

https://mega.nz/#!iXQAXKbb!aHNTnXsvVbT2 ... WFKzuyzN14
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing player portraits.

Post by Tony Li »

Thanks for sending that. Let's take a look at this player response entry:
  • Dialogue Text: "Player should be red."
  • Sequence: SetPortrait(Player,pic=2)
The issue is that the Sequence doesn't run until the player has selected the response. (Otherwise, if it played during the menu and the menu had multiple responses, the Dialogue System wouldn't know which response's sequence to play.) So it won't change the portrait until the player clicks on "Player should be red."

The solution is to move SetPortrait(Player,pic=2) to the previous node's Response Menu Sequence.
HughDMann
Posts: 8
Joined: Fri Feb 08, 2019 10:25 am

Re: Changing player portraits.

Post by HughDMann »

Ok cool, response menu sequence, didn't see that before. Thanks!
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing player portraits.

Post by Tony Li »

I think the response menu sequence will take care of this.

However, if you still need to change the player's portrait while an NPC subtitle is being displayed, can you use the Standard Dialogue UI instead of the deprecated Unity UI Dialogue UI? There is a JRPG template in Plugins / Pixel Crushers / Dialogue System / Prefabs / Standard UI Prefabs / Templates / JRPG. If you switch to the Standard Dialogue UI version, I think you'll find that it works the way you expect.

The Unity UI Dialogue UI is still supported, but it wasn't designed to distinguish shared UI elements the same way that the Standard Dialogue UI does.
Post Reply