Response Menu SetPortrait() Sequence.

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

Response Menu SetPortrait() Sequence.

Post by HughDMann »

HI, I have an issue with using SetPortrait() in a response menu sequence.

Basically, I've found that it only seems to work part of the time.

I'm checking the box for to add the response menu sequence, and am then calling the sequence like this:
SetPortrait(Player,pic=5)

For the same exact response in the same database, it will sometimes work during runtime, and sometimes the picture will be blank. I've noticed that it will be blank more often when clicking through the dialogue faster, in which case it will mostly return blank, but even when not clicking through fast, it seems to work only about 50% of the time in my testing.

Any idea what might be the issue?

The other thing is that I'm confused as to how to access the source code, on the site it said to: import the package Assets/Dialogue System/Scripts/Source Code.unitypackage, but, I'm not finding this package. (I do have the paid version).

What I was trying to actually do was interface with different categories of usables in different ways. Basically, NPC dialogue would run off of the proximity selector, and interactables would use the selector script with raycast from camera at mouse position with different keybindings for the actions. I.E. U to Use, T to Talk for instance.

It seems like I could accomplish this if both the selector and proximity selector had a layer mask option, then I could set up 'talkables' and 'interactables' on different layers, but from what I can see, only the selector has the layermask check. - So this is a suggestion for a possible feature to consider (unless I'm missing a way to do it already), but in the mean-time, if I could get into the source code, I could probably get this working myself.

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

Re: Response Menu SetPortrait() Sequence.

Post by Tony Li »

Hi,
HughDMann wrote: Mon Jun 03, 2019 7:31 amI'm checking the box for to add the response menu sequence, and am then calling the sequence like this:
SetPortrait(Player,pic=5)
Change it to this:

Code: Select all

required SetPortrait(Player,pic=5)
The "required" ensures that it runs even if the player clicks past very quickly. If this doesn't fix it, please let me know so we can investigate further.
HughDMann wrote: Mon Jun 03, 2019 7:31 amThe other thing is that I'm confused as to how to access the source code, on the site it said to: import the package Assets/Dialogue System/Scripts/Source Code.unitypackage, but, I'm not finding this package. (I do have the paid version).
In version 2.x, the source code is included as script files in Plugins / Pixel Crushers / Dialogue System / Scripts. There's no need to import any packages. Please make sure you're looking at the version 2.x Dialogue System for Unity Manual. (To make it possible to switch between script files and compiled DLLs, MonoBehaviours also use a 'Wrappers' subclass. You can pretty much ignore these and look at the actual classes in Scripts.)
HughDMann wrote: Mon Jun 03, 2019 7:31 amIt seems like I could accomplish this if both the selector and proximity selector had a layer mask option, then I could set up 'talkables' and 'interactables' on different layers, but from what I can see, only the selector has the layermask check. - So this is a suggestion for a possible feature to consider (unless I'm missing a way to do it already), but in the mean-time, if I could get into the source code, I could probably get this working myself.
Selector and ProximitySelector are fairly easily subclassable. However, you shouldn't need to make subclasses. Set up your Selector's Layer Mask to detect the 'interactables' layer. ProximitySelector works using regular Unity trigger colliders; set it up so it only registers collisions with the 'talkables' layer. You can put it on a child object if you need the main object to be a different layer; in this case, set the ProximitySelector's Actor Transform field to the main object.
HughDMann
Posts: 8
Joined: Fri Feb 08, 2019 10:25 am

Re: Response Menu SetPortrait() Sequence.

Post by HughDMann »

Thanks for the tip, I did try out the: required SetPortrait(Player,pic=5), but didn't have much luck with it.

One observation that I can make is that the Player's portrait tends to get set if there are 2 Player responses in a row, the 2nd one usually works if the previous response sequence had a SetPortrait for the Player (even if the 1st one didn't work).

What I've mostly noticed is that when the Player portrait doesn't load and shows up blank, it is the Player response immediately following another actor's/NPC's response.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu SetPortrait() Sequence.

Post by Tony Li »

I'll take a look and let you know what I find. I won't be able to check it for about 2-3 hours, but I'll reply here when I've had a chance to investigate.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu SetPortrait() Sequence.

Post by Tony Li »

I'm having trouble reproducing the issue.

Are there any warnings or errors in the Console window?

What are the values of these Dialogue Manager checkboxes:
  • Subtitle Settings > Show PC Subtitles During Line
  • Subtitle Settings > Skip PC Subtitle After Response Menu
  • Input Settings > Always Force Response Menu
If you temporarily set the Dialogue Manager's Other Settings > Debug Level to Info and play the conversation, each SetPortrait() command will log two lines in the Console window. The first is the command as the sequencer's parser understands it; this appears when the node first plays. The second is the command when the sequencer actually runs it. When the problem occurs, do you see both lines in the Console window?

Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com? To keep the upload smaller, you can zip up just the Assets and ProjectSettings folders. I don't need any other folders.

Side note: You can also use the [pic=#] markup tag in your Dialogue Text fields to use a different portrait image for a single node.
HughDMann
Posts: 8
Joined: Fri Feb 08, 2019 10:25 am

Re: Response Menu SetPortrait() Sequence.

Post by HughDMann »

HughDMann wrote: Mon Jun 03, 2019 3:47 pm Thanks for the tip, I did try out the: required SetPortrait(Player,pic=5), but didn't have much luck with it.

One observation that I can make is that the Player's portrait tends to get set if there are 2 Player responses in a row, the 2nd one usually works if the previous response sequence had a SetPortrait for the Player (even if the 1st one didn't work).

What I've mostly noticed is that when the Player portrait doesn't load and shows up blank, it is the Player response immediately following another actor's/NPC's response.
Thanks, I got into the source code and have the selector and proximity selector working on different layers, so I have different buttons for conversations and interactables. The mouse works for interactables selecting at mouse position and the proximity works for NPC conversations.
HughDMann wrote: Mon Jun 03, 2019 3:47 pm What are the values of these Dialogue Manager checkboxes:

Subtitle Settings > Show PC Subtitles During Line
Subtitle Settings > Skip PC Subtitle After Response Menu
Input Settings > Always Force Response Menu

If you temporarily set the Dialogue Manager's Other Settings > Debug Level to Info and play the conversation, each SetPortrait() command will log two lines in the Console window. The first is the command as the sequencer's parser understands it; this appears when the node first plays. The second is the command when the sequencer actually runs it. When the problem occurs, do you see both lines in the Console window?
The settings are as follows:

Show PC Subtitles During Line = false
Skip PC Subtitle After Response Menu = true
Always Force Response Menu = true

Let me know if changing these settings to something else might help, the project is pretty big, so it wouldn't be suitable to send it.

One other suggestion is to provide a way to directly remove a usable object from the usable list for the proximity selector without relying on the ontriggerexit event. (Perhaps there is a way already, but I didn't see it) - I made my own small function for this.

The use case for me was the dialogue triggered an animation sequence in timeline and while this sequence was playing as a 'scene', didn't want the actor to still be usable. Simply removing the usable component wasn't enough because the ontriggerexit seemed to need the usable component active anyway and also relied on getting out of actor trigger range, which wasn't necessarily applicable. So having a simple function to call directly which basically did what ontriggerexit would do solved it for me.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu SetPortrait() Sequence.

Post by Tony Li »

HughDMann wrote: Mon Jun 03, 2019 3:47 pmThe settings are as follows:

Show PC Subtitles During Line = false
Skip PC Subtitle After Response Menu = true
Always Force Response Menu = true
Thanks. I'll try to reproduce this.
HughDMann wrote: Mon Jun 03, 2019 3:47 pmOne other suggestion is to provide a way to directly remove a usable object from the usable list for the proximity selector without relying on the ontriggerexit event. (Perhaps there is a way already, but I didn't see it) - I made my own small function for this.
Good idea. I'll add it.
Post Reply