disable conversation while Paused?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Hereder
Posts: 76
Joined: Mon Dec 21, 2020 2:53 am

disable conversation while Paused?

Post by Hereder »

Hi!
I just managed to disable the Pause function while in a conversation (and freeze the player) but how do I go about to stop a conversation from happening while in pause mode? Meaning, If I stand infront of an NPC, and I hit start to check my items, and I hit (A) in my inventory, the conversation starts running outside the StartMenu. Make sense?

Thankful for answers
Cheers!
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: disable conversation while Paused?

Post by Tony Li »

Hi,

Is this the scenario?

1. Conversation is active. Player character movement is temporarily frozen.

2. Player presses Start button to open StartMenu.

3. Player presses (A) button to navigate the StartMenu, such as navigating the inventory UI.

BUT the active conversation also reacts to the (A) button, either clicking the dialogue UI's continue button or a response in the response menu.

If that's the case, it could be a couple of different things. The most common reason is the dialogue UI is stealing back EventSystem focus. To prevent this, run this line of code when opening the Start menu:

Code: Select all

PixelCrushers.UIPanel.monitorSelection = false;
and this code when closing the Start menu:

Code: Select all

PixelCrushers.UIPanel.monitorSelection = true;
Hereder
Posts: 76
Joined: Mon Dec 21, 2020 2:53 am

Re: disable conversation while Paused?

Post by Hereder »

Tony Li wrote: Mon Apr 12, 2021 3:14 pm Hi,

Is this the scenario?

1. Conversation is active. Player character movement is temporarily frozen.

2. Player presses Start button to open StartMenu.

3. Player presses (A) button to navigate the StartMenu, such as navigating the inventory UI.

BUT the active conversation also reacts to the (A) button, either clicking the dialogue UI's continue button or a response in the response menu.

If that's the case, it could be a couple of different things. The most common reason is the dialogue UI is stealing back EventSystem focus. To prevent this, run this line of code when opening the Start menu:

Code: Select all

PixelCrushers.UIPanel.monitorSelection = false;
and this code when closing the Start menu:

Code: Select all

PixelCrushers.UIPanel.monitorSelection = true;
Yes, thats the scenario... I can start conversations while In my StartMenu and navigating.
I tried the code like this but it didn't work:

Code: Select all


using PixelCrushers.DialogueSystem; // Add to top of your script.

void update()
{
        if (_gm.GameIsPaused)
        {
            PixelCrushers.UIPanel.monitorSelection = false;
        }
        else
        {
            PixelCrushers.UIPanel.monitorSelection = true;
        }
}

Could there be anohter solution or am I missing something? The text "Pixelcrusher" remains in while while .UIPanel. is green when I write the code in my script :/



This is how I managed to turn of my Pause function WHILE THE CONVERSATION is already active:

Code: Select all


        if (DialogueManager.isConversationActive)
        {
            Debug.Log("coversationActive");
            playerChatting = true;
        }
        else
        {
            playerChatting = false; //In gameManager I say - If platerChatting = true -> CanPause = false;
        }
        
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: disable conversation while Paused?

Post by Tony Li »

How are you starting conversations?

For example, does your player have a Proximity Selector and your NPC has Usable and Dialogue System Trigger components?

If so, when you open your StartMenu, disable the player's Proximity Selector. When you close the StartMenu, re-enable Proximity Selector.
Hereder
Posts: 76
Joined: Mon Dec 21, 2020 2:53 am

Re: disable conversation while Paused?

Post by Hereder »

Tony Li wrote: Tue Apr 13, 2021 9:14 am How are you starting conversations?

For example, does your player have a Proximity Selector and your NPC has Usable and Dialogue System Trigger components?

If so, when you open your StartMenu, disable the player's Proximity Selector. When you close the StartMenu, re-enable Proximity Selector.
That sounds like it should work. Yes, im using Proximity Selctor on my Player. But how do I access that script?
If I put the Proximity Selector on a child object of the Player, it won't launch any conversation at all.
(I was thinking I could turn off the GameObject with the Proximity Selector attached on it while Pause is true.)

And If I keep the Proximity Selector on the player I can't reach the script by writing:

Code: Select all


pulibc ProximitySelector _proxy; (its underlined in Red)


EDIT i made it work by adding pixelcrusher to the top of the Playerscipt! My bad!
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: disable conversation while Paused?

Post by Tony Li »

Glad you got it working! :-)
Post Reply