How do distinguish between input devices?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
musicROCKS013
Posts: 9
Joined: Fri Jan 03, 2025 8:29 pm

How do distinguish between input devices?

Post by musicROCKS013 »

I am creating a local multiplayer game and will have many devices connected at once.

I have a script on each player that sets a bool to true or false when the Select key is pressed for their respective devices.

Whenever I start a conversation as P1 with NPC, P2 can still click the "select" button to continue the conversation because the simulated "Continue" button click isn't tied to any one controller.

How can I use this variable to simulate a button click to the continue button? I intend to modify UIButtonKeyTrigger or StandardUIContinueButtonFastForward in order to do this, but I'm not sure how to access the player gameobject.

What is the best way to do this?

If it's possible, I'd like to reference the proximity selector that started the conversation rather than the "PlayerID" or the "actor" or anything else that could potentially be mismatched.

Thank you!
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do distinguish between input devices?

Post by Tony Li »

Hi,

Assuming you're using Dialogue System Triggers to start conversations:

1. When writing the conversation, assign the generic "Player" actor as the conversation actor.

2. On the Dialogue System Trigger, leave the Actions > Start Conversation > Conversation Actor field unassigned. Each player's ProximitySelector will pass its own GameObject as the interactor, which will be used as the conversation actor.

You'll probably want to tick the Dialogue Manager's Other Settings > Allow Simultaneous Conversations, and add an Override Dialogue UI component to each player GameObject and assign a dialogue UI for that player to use. If you're using overhead bubble subtitle panels, just assign the Basic Standard Dialogue UI prefab.

You can bypass the continue button and set up the player's continue input to call the player's dialogue UI's OnConversationContinue() method. This will allow only that player to advance the player's conversation.
musicROCKS013
Posts: 9
Joined: Fri Jan 03, 2025 8:29 pm

Re: How do distinguish between input devices?

Post by musicROCKS013 »

I set the "Actor" to an actor called "Player" that I marked as a player, but when the player (which has a dialogue actor component marked under a different actor, maybe that was keeping it from working) interacted with the usable it didn't set the Conversation Actor variable, it stayed null.


Also can I ask you about calling conversations and progressing manually?

I already have a system in place where the player detects triggers it Is inside of, and I could easily extend this to include dialogue triggers. Is there a way I could manually start the conversation and go through them based on a certain variable being true (the variable just corresponds to key presses of different devices, which I've already set up)? And if I have certain sequences that take in subjects how can I make sure they stay synced?

Or is it probably best not to run things outside of where they're meant to and I should just use the regular way of using the proximity selector and everything?

Sorry to bother you with so many questions! Thanks for everything.

Also, I don't really want to mark any of the actors as "player" since I just want them to talk like text boxes and everything. Is that okay..?
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do distinguish between input devices?

Post by Tony Li »

Hi,

> Also, I don't really want to mark any of the actors as "player" since I just want them to talk like text boxes and everything. Is that okay..?

That's fine, as long as you're not presenting any response menus (i.e., a node that links to more than one player node at a time). Alternatively, see How To: Bypass Response Menu When Player Has One Choice

You can trigger Dialogue System Triggers manually, such as through your own interaction system. Call the Dialogue System Trigger's OnUse(Transform) method, passing it the player's transform. The conversation will use the player's transform/GameObject as the conversation actor. In the Dialogue Editor, make sure the conversation's Actor dropdown is set to the Player actor and the nodes spoken by the current player are also set to Player.
Post Reply