Player 'Reactive' Barks

Announcements, support questions, and discussion for the Dialogue System.
MudPuppet
Posts: 24
Joined: Sun Jan 19, 2020 7:41 pm

Player 'Reactive' Barks

Post by MudPuppet »

Hello Tony,

I am working in the Top-Down Engine. Thus far I have successfully implemented the DS/Corgi Integration stuff along with everything else you helped me with (Rewired etc). At the moment I have NPC Conversations and NPC Barks all looking how I want and working nicely.

What I am trying to conquer right now is Reactive Barks with the Player. For example, the Player walks near a signpost and Barks - but utilising the same UI stuff that I already have in place.

I guess that I am just a bit confused as to what DS components to add to either the Signpost or the Player without causing problems with my existing working setups for NPC Conversations and NPC Barks.

The attached image will show what I have done for the Signpost. It has a Box Collider Trigger, Dialogue System Trigger, Dialogue Actor, and a Range Trigger. I have set the Accepted Tags to the Player. I am assuming that the Dialogue Actor Component should only be on the Player. I also tried to have the Dialogue System Trigger 'Actions' as Bark (but it fails)and currently have it set to Start Conversation so that I can at least access the Stop Conversation/Distance functions to stop all other NPC Barks.

With the Player I have just added as a child the same NPC Barks structure setup - except that I have the Barks On Idle along with the Dialogue Actor Component.

Hehe, at some stage in my trial and error I 'did' actually get the Player Barks to work but then it wasn't utilising my GUI stuff. Currently I am trying to get back to that to see if I can move forwards and get things working.

Would you have an existing example or link for this kind of setup at all? I tried looking through the Forum but thus far haven't found much to point me in the right direction without adding extra confusion - but did see some other topics of interest for much later on in development.

Regards,
MudPuppet
Attachments
DS_SignPostSetup.jpg
DS_SignPostSetup.jpg (200 KiB) Viewed 856 times
User avatar
Tony Li
Posts: 20762
Joined: Thu Jul 18, 2013 1:27 pm

Re: Player 'Reactive' Barks

Post by Tony Li »

Hi,

Here's an example:

DS_TDE_BubbleAndPlayerBarkExample_2020-03-06.unitypackage

The package contains the original bubble subtitle panel example scene as well as new variation named "TDE Bubble Example With PC Bark". If you play that scene and walk near the spikes in the room to the left of the starting position, the player will bark "Yikes! That looks dangerous."

The TDE LevelManager loads a custom Koala prefab named Koala_Barker that has a bark UI as a child GameObject. The bark UI's Layer is UI and its Sorting Layer is Above. The prefab has a Dialogue Actor that points to this bark UI.

The Dialogue System Trigger barks a conversation in which the player is assigned as both participants.
MudPuppet
Posts: 24
Joined: Sun Jan 19, 2020 7:41 pm

Re: Player 'Reactive' Barks

Post by MudPuppet »

Hello Tony, much thanks for that! I will take a look shortly and see what the setup is like.
MudPuppet
Posts: 24
Joined: Sun Jan 19, 2020 7:41 pm

Re: Player 'Reactive' Barks

Post by MudPuppet »

Hey Tony,

Phew Boy what a pain this was to sort out. Basically I couldn't get your example scene to work at all (although I didn't try it in a new vanilla TDE/DS project). However, by looking at the setup I was able to get something working in my own project (a 3d one). I am not needing the Dialogue Actor component on my Player but it works - although this may have something to do with my next issue.

I am now stuck with another problem that causes the working solution to fail. This is because I am instantiating the Player at runtime via the TDE Level Manager.

So, after digging around and a fair bit of trial and error I have narrowed the problem down to the Signpost's Dialogue System Trigger > Actions > Bark > Barker slot whereby if this is empty it causes the setup to fail and it only works if the Player Prefab is already in the scene and I have dragged it into the Barker slot (I tried using the actual Prefab from Prefabs folder but no joy).

This is probably a backwards way of doing things, or at least I will assume so with my lack of knowledge using DS, but is there a way I can hook up the Barker slot to the instantiated Player Prefab (in Prefabs folder)? I anticipate that this would need to be done with code but maybe you can shed some light on the situation from reading all of this as it could just be that my setup has been done backwards or something (LOL).

EDIT: I just spotted the info "The Dialogue System Trigger barks a conversation in which the player is assigned as both participants." so will have another look-see in the morning, change this in my dialogue, add the Dialogue Actor component back onto the Player and see what I get out of it. Sorry to be a pain with all of this.
User avatar
Tony Li
Posts: 20762
Joined: Thu Jul 18, 2013 1:27 pm

Re: Player 'Reactive' Barks

Post by Tony Li »

Hi,

Yes, I think if you do those two things, barking should work. To recap:
  • Add a Dialogue Actor component to the player prefab. Set its Actor dropdown to Player. Assign the bark UI to the component. You can assign a prefab to TDE's Level Manager; it doesn't have to be in the scene.
  • Set both conversation participants to Player.
MudPuppet
Posts: 24
Joined: Sun Jan 19, 2020 7:41 pm

Re: Player 'Reactive' Barks

Post by MudPuppet »

Hey Tony,

Unfortunately no luck so far. I even just created a new vanilla project to test your supplied example file which also does not seem to work. However, I did notice that there is an error with the TDE Integration package on the 'DialogueSystemTopDownEventListener' class whereby the Class Name does not match in the script itself and there is an error with the Load/Save Dialogue section at the bottom as well.

It's weird, I can get it to work in my own project but only if I don't instantiate the player and have added the player into the Barker slot - and that's after sorting Player/Player in the dialogue itself.

Sorry that I am being a pain in the rear with this. If I could have gotten your example file to work I might be able to dig further and see what the issue is with my own project but essentially it is the same setup.
User avatar
Tony Li
Posts: 20762
Joined: Thu Jul 18, 2013 1:27 pm

Re: Player 'Reactive' Barks

Post by Tony Li »

Hi,

Please import the updated TopDown Engine Support package from the Dialogue System Extras page. This package is also in DS version 2.2.5, which should be on the Asset Store early next week.

The example scene was created in Unity 2019.2, the latest TDE for 2019.2, and DS 2.2.4 with the updated support package from the Extras page.
MudPuppet
Posts: 24
Joined: Sun Jan 19, 2020 7:41 pm

Re: Player 'Reactive' Barks

Post by MudPuppet »

Hey Tony, yep I am running the same versions. Anyway, I will just keep tinkering at my end and see what I can find out - in the least I will become a bit more familiar with DS and learn a few things along the way.
User avatar
Tony Li
Posts: 20762
Joined: Thu Jul 18, 2013 1:27 pm

Re: Player 'Reactive' Barks

Post by Tony Li »

Did you enable Physics2D support? (Tools > Pixel Crushers > Dialogue System > Welcome Window, then tick the 2D Physics checkbox.)
MudPuppet
Posts: 24
Joined: Sun Jan 19, 2020 7:41 pm

Re: Player 'Reactive' Barks

Post by MudPuppet »

Hello Tony, aaah no I didn't! This allows me to get a result in your example but again only when the Player Prefab isn't instantiated and I drag the Player Prefab into the 'Barker' slot on the Dialogue System Trigger.

I am actually working on a 3d project so today I built up a fresh testing scene (Minimal3d scene and Minimal3d character) but no matter what I always end up with the same result where if the Dialogue System Trigger 'Barker' slot isn't filled there is no display of the Bark.

However, the good news is that I just solved it using a script.

Code: Select all

private GameObject ThisPlayerCharacter;

    // Update is called once per frame
    void Update()
    {
        ThisPlayerCharacter = GameObject.FindGameObjectWithTag("Player");
        GetComponent<DialogueSystemTrigger>().barker = ThisPlayerCharacter.transform;
    }
I am pretty useless at programming so would have preferred it not be in Update but all of my attempts failed in Start where having it in Update worked so I will run with this for now as at least I can move forwards and not be stuck trying to solve the one thing for a while :D
Post Reply