Page 1 of 1
disable conversation while Paused?
Posted: Mon Apr 12, 2021 8:49 am
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!
Re: disable conversation while Paused?
Posted: Mon Apr 12, 2021 3:14 pm
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;
Re: disable conversation while Paused?
Posted: Mon Apr 12, 2021 11:57 pm
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;
}
Re: disable conversation while Paused?
Posted: Tue Apr 13, 2021 9:14 am
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.
Re: disable conversation while Paused?
Posted: Thu Apr 15, 2021 1:14 am
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!
Re: disable conversation while Paused?
Posted: Thu Apr 15, 2021 8:59 am
by Tony Li
Glad you got it working!