Alternate portrait not registering

Announcements, support questions, and discussion for the Dialogue System.
Laurie_CF
Posts: 10
Joined: Sat Aug 13, 2016 3:31 pm

Alternate portrait not registering

Post by Laurie_CF »

Hi Tony,

Thanks for a brilliant tool!

I've not been able to change to a custom portrait. I read this post also: viewtopic.php?f=3&t=671&p=3302&hilit=portraits#p3302 but couldn't see anything missing. It's just showing the regular portrait.

Here's my setup (with a big green circle on her face to be sure it worked!):
Screen Shot 2016-08-13 at 20.40.32.png
Screen Shot 2016-08-13 at 20.40.32.png (26.46 KiB) Viewed 3048 times
And the Dialogue Entry:
Screen Shot 2016-08-13 at 20.40.50.png
Screen Shot 2016-08-13 at 20.40.50.png (31.95 KiB) Viewed 3048 times
But the result:
Screen Shot 2016-08-13 at 21.04.27.png
Screen Shot 2016-08-13 at 21.04.27.png (188.79 KiB) Viewed 3048 times
Is there anywhere else I need to look to make sure it's enabled, extra setup I missed, or something like that?

(I have version 1.5.8 of DSfU and 5.3.3f1 of Unity, if that's relevant, but I imagine the issue is me, rather than the software.)

Thank you for your time :-)
Laurie_CF
Posts: 10
Joined: Sat Aug 13, 2016 3:31 pm

Re: Alternate portrait not registering

Post by Laurie_CF »

Hi Tony, quick update on this.

I did a little more prodding and it works fine with a different actor, and NPC, so I think there might be a problem with the way we're doing our main character's text box. Can you think of any reason it might work for one actor but not another?

I'm sorry, I'm not the programmer for our game - he's on holiday and I'm out of my depth!
User avatar
Tony Li
Posts: 20651
Joined: Thu Jul 18, 2013 1:27 pm

Re: Alternate portrait not registering

Post by Tony Li »

Hi,

Is the main character's Image UI element assigned to the dialogue UI component's Dialogue > PC Subtitle > Portrait Image field? Here's an example of what I mean:

Image

Does the Console window contain any warnings or errors?

What happens if you temporarily try one of the prefab UIs? Inspect your scene's Dialogue Manager GameObject, and drag the prefab Prefabs/Unity UI Prefabs/Generic/Generic Unity UI Dialogue UI onto the Dialogue Manager's Dialogue UI field. Then click OK on the pop-up window about adding an instance to the canvas.

If the Generic UI works, the issue is in your dialogue UI. If the Generic UI doesn't work, it may be an issue in the dialogue database or conversation trigger.

If your dialogue UI GameObject has a "Use Animated Portraits" component, please let me know. It might be overriding the [pic=#] tag.

If none of that sheds any light on the issue, please feel free to send an example project to tony (at) pixelcrushers.com. The easiest way to send the whole thing is to zip up the Assets and ProjectSettings folders.
Laurie_CF
Posts: 10
Joined: Sat Aug 13, 2016 3:31 pm

Re: Alternate portrait not registering

Post by Laurie_CF »

Hi Tony,

Thanks for the speedy and helpful reply! Top marks for customer support :) Here are my findings:

1) The Image UI element seems to be assigned correctly. Here's the setup for it, in case there's anything to look for here:
Screen Shot 2016-08-14 at 18.03.27.png
Screen Shot 2016-08-14 at 18.03.27.png (124.15 KiB) Viewed 3044 times
(I tried swapping out the image, and it still drew from the Actors image instead, so that's working correctly)

2) The Console didn't show anything irregular as far as I could tell (though again, I'm no programmer!). Here's what it said:

"
UnityEngine.Debug:Log(Object)
OnConversationSnifffer:OnConversationLine(Subtitle)
UnityEngine.Component:BroadcastMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.ConversationView:NotifyParticipantsOnConversationLine(Subtitle)
PixelCrushers.DialogueSystem.ConversationView:StartSubtitle(Subtitle, Boolean, Boolean)
PixelCrushers.DialogueSystem.ConversationController:GotoState(ConversationState)
PixelCrushers.DialogueSystem.ConversationController:OnSelectedResponse(Object, SelectedResponseEventArgs)
PixelCrushers.DialogueSystem.ConversationView:SelectResponse(SelectedResponseEventArgs)
PixelCrushers.DialogueSystem.ConversationView:OnSelectedResponse(Object, SelectedResponseEventArgs)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnClick(Object)
UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.UnityGUI.GUIButton:Click()
InputManager:Update()
"

3) I've popped in a Generic UI (went for "JRPG2 Unity UI Dialogue UI", if that's of note), and the same problem persists - the NPC changes, but not the PC.

4) The "Use Animated Portraits" component - should I be looking for that at the root of the whole prefab, like in the image you attached? I don't appear to have one.

5) Thank you for offering to look at the project, but regretfully I'm under a legal agreement not to share it with individuals outside the company. Super sorry! (Especially as I appreciate this would be the most efficient route to solve this...)

You mentioned that it since the problem persists with a Generic UI, there may be an issue in the dialogue database or conversation trigger. You reminded me that I had another problem with using Lua in the Dialogue Entry. I tried to make it so that a certain branch was only available on a condition but was unsuccessful. However, when I put it as a condition in the Conversation Trigger (Script), it worked correctly. Perhaps something is stopping Lua on the PC from getting through?

Does this help narrow things down? Are you able to assist any further without the project? Thank you again, I really appreciate your support!
User avatar
Tony Li
Posts: 20651
Joined: Thu Jul 18, 2013 1:27 pm

Re: Alternate portrait not registering

Post by Tony Li »

Hi,

Thanks for running the test with "JRPG2 Unity UI Dialogue UI". That eliminates your dialogue UI from the list of suspects.

OnConversationSnifffer isn't a Dialogue System script. Your programmer may have written it to perform extra processing on lines before they're displayed. It might be stripping out the [pic=#] tag. As a test, you could locate this script in your scene and temporarily remove it. (Don't just disable it, in case the script isn't written to pay attention to its enabled/disabled state.) It's probably on the Dialogue Manager GameObject, although it might be on one of the characters. Then see if the player's portraits change.


For your other question (Lua conditions), I'm not sure if this is the issue in your case, but one thing to keep in mind is that the Dialogue System evaluates links one extra level ahead of the conversation. (It has to do this to properly handle certain continue button modes.) This means that if you set a value in one dialogue entry node (e.g., node A), you can't then check it in the next node (node B) because the Dialogue System will have already checked the condition of node B prior to running node A.

Instead, you need to separate them with an empty spacer node to delay evaluation of the condition. Here's an example:

Image
In the example above, the "Flipping coin" node sets a variable x randomly to 1 or 2. We can't immediately follow this with the two conditional nodes ("Heads" and "Tails") because the Dialogue System evaluates one level ahead -- meaning that it's already tested the conditions of "Heads" and "Tails" before the "Flipping coin" node has even run.

To work around this, I added an intermediate node to the conversation, set the title to "delay evaluation" to remind myself what it's for, and left the Dialogue Text blank. I set the Sequence to None() so it will immediately progress to the next step in the conversation. (If you're using continue buttons, then on the Sequence field select "+" > Continue > Simulate continue button click instead.)

It may also be helpful to temporarily set the Dialogue Manager's Debug Level to Info. This will add a lot of information to the Console window. If you pick through it, you'll find lines similar to the ones shown below:

Code: Select all

Dialogue System: Lua(x = math.random(2))
Dialogue System: Referee says 'Flipping coin...'
Dialogue System: Block on False Link (Referee): ID=5:3 'Heads!' Condition='x == 1'
Dialogue System: Add Link (Referee): ID=5:4 'Tails!' (True)
Dialogue System: Referee says 'Tails!'
Lines 3-4 indicate that the link to 'Heads' is blocked because 'x==1' is false, but it's adding the link to 'Tails' (because 'x==2' is true).
Laurie_CF
Posts: 10
Joined: Sat Aug 13, 2016 3:31 pm

Re: Alternate portrait not registering

Post by Laurie_CF »

Hi Tony, thanks for your continued support.

I tried removing the OnConversationSnifffer script (found on the player prefab). Is seems that its purpose was to stop the character when she hits a dialogue zone, but unfortunately the portrait still didn't change. I also found Override Actor Name and tried removing that too, just in case, but as the script name suggest, the only change was her name started showing in her portrait box again.

Thanks very much for that lesson on Lua. I don't think it was the case for me, as the scripts were at the start and ends with plenty in between, but that's very good to know!

I tried setting the Debug Level to Info, here's what it came up with:

"
Dialogue System: Add Link (Gaze): ID=10:4 '[pic=2]Here goes...' (True)
UnityEngine.Debug:Log(Object)
PixelCrushers.DialogueSystem.ConversationModel:EvaluateLinksAtPriority(ConditionPriority, DialogueEntry, List`1, List`1, List`1, Boolean)
PixelCrushers.DialogueSystem.ConversationModel:EvaluateLinks(DialogueEntry, List`1, List`1, List`1, Boolean)
PixelCrushers.DialogueSystem.ConversationModel:GetState(DialogueEntry, Boolean, Boolean)
PixelCrushers.DialogueSystem.ConversationModel:GetState(DialogueEntry)
PixelCrushers.DialogueSystem.ConversationController:OnSelectedResponse(Object, SelectedResponseEventArgs)
PixelCrushers.DialogueSystem.ConversationView:SelectResponse(SelectedResponseEventArgs)
PixelCrushers.DialogueSystem.ConversationView:OnSelectedResponse(Object, SelectedResponseEventArgs)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnClick(Object)
UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.UnityGUI.GUIButton:Click()
PixelCrushers.DialogueSystem.UnityGUI.GUIButton:DrawClickable(Vector2)
PixelCrushers.DialogueSystem.UnityGUI.GUIButton:DrawSelf(Vector2)
PixelCrushers.DialogueSystem.UnityGUI.GUIControl:Draw(Vector2)
PixelCrushers.DialogueSystem.UnityGUI.GUIControl:DrawChildren(Vector2)
PixelCrushers.DialogueSystem.UnityGUI.GUIControl:Draw(Vector2)
PixelCrushers.DialogueSystem.UnityGUI.GUIControl:DrawChildren(Vector2)
PixelCrushers.DialogueSystem.UnityGUI.GUIControl:Draw(Vector2)
PixelCrushers.DialogueSystem.UnityGUI.GUIControl:DrawChildren(Vector2)
PixelCrushers.DialogueSystem.UnityGUI.GUIControl:Draw(Vector2)
PixelCrushers.DialogueSystem.UnityGUI.GUIControl:DrawChildren(Vector2)
PixelCrushers.DialogueSystem.UnityGUI.GUIControl:Draw(Vector2)
PixelCrushers.DialogueSystem.UnityGUI.GUIRoot:OnGUI()
"

Don't suppose this helps at all...?

Another thing I tried which might help narrow things down, is that in the Database / Actors, I changed the IsPlayer variable to False. Portrait then changed correctly, but then of course she appeared on the NPC side instead and didn't have her dialogue choices any more.

Many thanks :-)
User avatar
Tony Li
Posts: 20651
Joined: Thu Jul 18, 2013 1:27 pm

Re: Alternate portrait not registering

Post by Tony Li »

Hi,

What are your Dialogue Manager's Subtitle Settings?
Laurie_CF
Posts: 10
Joined: Sat Aug 13, 2016 3:31 pm

Re: Alternate portrait not registering

Post by Laurie_CF »

Hi Tony,

These ones?
Screen Shot 2016-08-16 at 16.19.17.png
Screen Shot 2016-08-16 at 16.19.17.png (208.52 KiB) Viewed 3020 times
Cheers
User avatar
Tony Li
Posts: 20651
Joined: Thu Jul 18, 2013 1:27 pm

Re: Alternate portrait not registering

Post by Tony Li »

As a test, please tick Show PC Subtitles During Line. This will change the behavior of conversations, so it probably isn't what you want to run with, but it will serve as a test. When you select a player response, the dialogue UI will show that response as a subtitle, and I bet it'll also show the alternate portrait. This is because the [pic=#] tag only applies when showing subtitles.

With that checkbox unticked, PC subtitles never appear, so the [pic=#] tag never comes into play.

If you don't want to show PC subtitles, there are still a couple ways to incorporate alternate PC portraits. Here are some ideas:

1. Instead of using the [pic=#] tag, use the SetPortrait() sequencer command. For example:
  • Dialogue Text: "This eyeball feels as though..."
  • Sequence: SetPortrait(Gaze,pic=2)
All subsequent player response menus will use the alternate portrait. Unlike [pic=#], which only applies to the display of the current subtitle, SetPortrait() is permanent until you call SetPortrait(Gaze,default) to reset it.

2. This second idea will require some work from your programmer. Your programmer could add some code that runs when the player highlights/hovers over a response from the player response menu. The code could then grab that response's [pic=#] tag and change the portrait image only while the response is highlighted. So if your menu had a happy response, an angry, and a scared response, the portrait could change accordingly as the player hovered over each response. I can give your programmer a little more guidance on this if you're interested in pursuing this idea.
Laurie_CF
Posts: 10
Joined: Sat Aug 13, 2016 3:31 pm

Re: Alternate portrait not registering

Post by Laurie_CF »

Hi Tony,

You've hit the nail on the head there! Once I ticked Show PC Subtitles During Line the portrait change worked correctly. But, as you said, the system overall is no longer working as desired - It shows her dialogue, which you then select, and then she says the same thing again (but with the typewriter this time).

The SetPortrait(Gaze,pic=2) command also worked, but oddly, only when Show PC Subtitles During Line is ticked. Can you think of any reason for this?

For your suggestion for is a nice idea, but not really where we were looking on going with the dialogue system.

I feel like we're almost there! Thanks so much for hanging in there with me :-)
Post Reply