OnTriggerEnter combined with Button Press

Announcements, support questions, and discussion for the Dialogue System.
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: OnTriggerEnter combined with Button Press

Post by supadupa64 »

I would probably just use a quest trigger component and set it to "on use" and add a variable alert that says "nice tv." But Tony probably has a better way.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnTriggerEnter combined with Button Press

Post by Tony Li »

I'd use barks. You still have to write a one line conversation, but it's a bit simpler.

(BTW, you can organize conversations in groups by using the "/" character in the title. For example, you could group all your item interaction conversations in an "Items" submenu by titling them "Items/TV", "Items/Toaster", "Items/Oven", etc.)

Create a conversation where the player says "Nice TV!".

Then add a Bark Trigger to the TV. Set the trigger to OnUse, select the conversation, and assign the player as the Conversant.

Finally, add a bark UI to your player.

When the player interacts with the TV, the Bark Trigger will show a one-off line "Nice TV!" through the player's bark UI, which is usually above the player's head.
Xpyke
Posts: 13
Joined: Sun May 22, 2016 11:29 am

Re: OnTriggerEnter combined with Button Press

Post by Xpyke »

Tony Li wrote:I'd use barks. You still have to write a one line conversation, but it's a bit simpler.

(BTW, you can organize conversations in groups by using the "/" character in the title. For example, you could group all your item interaction conversations in an "Items" submenu by titling them "Items/TV", "Items/Toaster", "Items/Oven", etc.)

Create a conversation where the player says "Nice TV!".

Then add a Bark Trigger to the TV. Set the trigger to OnUse, select the conversation, and assign the player as the Conversant.

Finally, add a bark UI to your player.

When the player interacts with the TV, the Bark Trigger will show a one-off line "Nice TV!" through the player's bark UI, which is usually above the player's head.
supadupa64 wrote:I would probably just use a quest trigger component and set it to "on use" and add a variable alert that says "nice tv." But Tony probably has a better way.
I went with barks and it's working really well, thanks for the amazing support!
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnTriggerEnter combined with Button Press

Post by Tony Li »

Glad to help!
OneManOnMars
Posts: 106
Joined: Tue Apr 05, 2016 9:37 am

Re: OnTriggerEnter combined with Button Press

Post by OneManOnMars »

Tony Li wrote:
that's a good question. Here's my reasoning: In a lot of games (especially 2D console games), a common way to start conversations is by walking up to an NPC and pressing an action button. The ProximitySelector is designed to work like that.
That is exactly the reason. I don't want the player talk to a npc when he is to far away and. The same button is used for other things, so the conversation would get triggered all the time if I would not check the proximity
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnTriggerEnter combined with Button Press

Post by Tony Li »

OneManOnMars wrote:
Tony Li wrote:
that's a good question. Here's my reasoning: In a lot of games (especially 2D console games), a common way to start conversations is by walking up to an NPC and pressing an action button. The ProximitySelector is designed to work like that.
That is exactly the reason. I don't want the player talk to a npc when he is to far away and. The same button is used for other things, so the conversation would get triggered all the time if I would not check the proximity
Were you able to get the ProximitySelector working in your scene? (Remember there's also a demo scene here if you'd like to see an example.) If I can help with anything, just let me know!
OneManOnMars
Posts: 106
Joined: Tue Apr 05, 2016 9:37 am

Re: OnTriggerEnter combined with Button Press

Post by OneManOnMars »

Hi Tony,
yes it works. Thank you. The only thing right now that is not perfect is, that I have a text above the character that says Press A. But what I would prefere is to just show a image of the button. Didn't find the solution to that yet. But the functionality is working.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnTriggerEnter combined with Button Press

Post by Tony Li »

Hi,

The easiest way is to use Unity UI. Here are the steps:

1. Let's assume your player already has a Proximity Selector component. Add a Unity UI Selector Display component, too.

2. Create a Unity UI Canvas in your scene if there isn't one already. If you're using the Dialogue Manager prefab from the Prefabs folder, it already has one as a child GameObject.

3. Add Prefabs/Unity UI Prefabs/Generic/Generic Unity UI Selector Panel to the Canvas.

Play the scene and make sure it's working. To see an example of what the Generic Unity UI Selector Panel looks like, play the scene Examples/Unity UI Examples/Generic UI Example Scene. This uses a Selector, not a Proximity Selector, but the Generic Unity UI Selector Panel is the same.

Then customize it. You can change the Reticle In Range and Reticle Out Of Range images, add other images and backgrounds to the Selection Text Panel, etc.
OneManOnMars
Posts: 106
Joined: Tue Apr 05, 2016 9:37 am

Re: OnTriggerEnter combined with Button Press

Post by OneManOnMars »

Thanks a lot I'll try to put it in as soon as I am back on the task
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnTriggerEnter combined with Button Press

Post by Tony Li »

Sounds good! If you get stuck on anything, just let me know.
Post Reply