Page 3 of 6
Re: SetContinueMode Forcing Conversation to Auto Progress
Posted: Tue Nov 17, 2020 11:09 am
by Tony Li
Hi,
jae026 wrote: ↑Tue Nov 17, 2020 10:51 amHey, I tried the script change and the third one still appears.
That script change works in the repro project that you sent me. Can you share the current content of your CurrentResponsePage script?
jae026 wrote: ↑Tue Nov 17, 2020 10:51 amAlso, where can In set the volume of audioclips played from nodes? They seem to be set to max volume.
Audio clips play on an Audio Source component. Sequencer commands such as
AudioWait() operate on a GameObject that it refers to as the subject.; For example, in this command:
the subject is the GameObject named 'Bob'. If Bob has an Audio Source component, AudioWait() will use it. If it doesn't already have an Audio Source component, AudioWait() will create a default one with max volume. If you want to adjust the subject's volume, 2D/3D panning, mixer channel, etc., add an Audio Source and configure it.
If you omit the subject from the AudioWait() command:
then it will use the GameObject that's assigned as the node's speaker.
If you need to confirm which GameObject is assigned as the node's speaker, temporarily set the Dialogue Manager's Other Settings > Debug Level to Info. This will log info to the Console. When a conversation starts, look for a line such as:
Dialogue System: Starting conversation 'title' with actor=AAA and conversant=BBB
where AAA and BBB are the GameObjects of the conversation's primary participants.
Re: SetContinueMode Forcing Conversation to Auto Progress
Posted: Tue Nov 17, 2020 11:35 am
by jae026
Code: Select all
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI.Extensions;
using UnityEngine.UI;
using PixelCrushers.DialogueSystem;
public class CurrentResponsePage : MonoBehaviour
{
public int currentPage = 0;
[Space]
public List<Button> Pages = new List<Button>();
public void Enable()
{
currentPage = 0;
}
public void UpdateCurrentPageUp()
{
var isNextResponseValid = currentPage <= DialogueManager.currentConversationState.pcResponses.Length && DialogueManager.currentConversationState.pcResponses[currentPage].enabled;
if (currentPage <= Pages.Count - 1 && isNextResponseValid)
{
currentPage++;
}
}
public void UpdateCurrentPageDown()
{
if (currentPage > 0)
{
currentPage = 0;
}
}
public void ToggleInteractivity(int i)
{
foreach (Button BTN in Pages)
{
BTN.interactable = false;
}
Pages[i].interactable = true;
}
public void Update()
{
switch (currentPage)
{
case 4:
break;
case 3:
break;
case 2:
ToggleInteractivity(2);
break;
case 1:
ToggleInteractivity(1);
break;
case 0:
ToggleInteractivity(0);
break;
default:
break;
}
}
}
Re: SetContinueMode Forcing Conversation to Auto Progress
Posted: Tue Nov 17, 2020 12:55 pm
by Tony Li
Thanks. That looks fine to me. I no longer have a copy of your reproduction project. If you can't identify the issue, please feel free to send me a fresh reproduction project and provide the steps I should follow to reproduce the issue.
Re: SetContinueMode Forcing Conversation to Auto Progress
Posted: Thu Nov 26, 2020 7:52 am
by jae026
Tony, we had a lot of things to do since our last conversation but I was unable to figure out the issue. They also pointed out that the choices started at 2 in stead of 1 so you had to go left to see the first choice. I reuploaded a project. There is a scene called "Character Development" that plays a conversation on start that has the issue. The player is a prefab so any fixes will fix it across the board.
Re: SetContinueMode Forcing Conversation to Auto Progress
Posted: Thu Nov 26, 2020 8:10 am
by Tony Li
Hi James,
Thanks. I'm downloading your repro project now and will investigate later today.
Re: SetContinueMode Forcing Conversation to Auto Progress
Posted: Thu Nov 26, 2020 10:10 am
by Tony Li
Hi,
Although your Next and Prev buttons' OnClick events point to CurrentResponsePage, that script doesn't do anything. Still, update it in case you end up using it in the future. Change the first line in UpdateCurrentPageUp() to:
Code: Select all
var isNextResponseValid = (currentPage + 1) < DialogueManager.currentConversationState.pcResponses.Length && DialogueManager.currentConversationState.pcResponses[currentPage + 1].enabled;
This next step is the important one. Edit ScrollSnap.cs. Change the NextScreen() method to this:
Code: Select all
public void NextScreen()
{
UpdateListItemPositions();
var currentPage = CurrentPage();
var isNextResponseValid = (currentPage + 1) < PixelCrushers.DialogueSystem.DialogueManager.currentConversationState.pcResponses.Length && PixelCrushers.DialogueSystem.DialogueManager.currentConversationState.pcResponses[currentPage + 1].enabled;
if (CurrentPage() < _pages - 1 && isNextResponseValid)
{
_lerp = true;
_lerpTarget = _pageAnchorPositions[CurrentPage() + 1];
PageChanged(CurrentPage() + 1);
}
}
Finally, the buttons are showing in the correct order. It's just that the order in which you've arranged in the nodes on your canvas is misleading. Inspect the "What was that light?" node. You'll see that the actual order is:
- jaeOrder.png (23.47 KiB) Viewed 619 times
Use the up arrow button on the second node to reorder it before the first one.
Re: SetContinueMode Forcing Conversation to Auto Progress
Posted: Tue Dec 15, 2020 11:59 am
by jae026
Tony, I am having trouble getting the queststate from via script. IS this the best place to look.
PixelCrushers.DialogueSystem.QuestLog.IsQuestSuccessful(quest.questName);
Trying to set a bool based on the state. This for some reason returns unassigned
Re: SetContinueMode Forcing Conversation to Auto Progress
Posted: Tue Dec 15, 2020 12:55 pm
by Tony Li
Hi,
That's the correct API call. Make sure quest.questName matches the Name of a quest in your dialogue database.
Re: SetContinueMode Forcing Conversation to Auto Progress
Posted: Thu Dec 31, 2020 7:07 am
by jae026
It seems to not carry the Quest State from scene to scene in regards to Debugging the state. If I make make a conversation choice and a quest is then checked as successful in one scene it carries over fine in conversations.
However, when I run a debug check at the start of a level it returns the Quest State as "Active" even though dialogue that is reliant on the quest being successful recognizes it as being successful and works fine.
However, if I manually mark a quest as successful by default and run the check at start, it recognizes it as successful.
Below is my current code.
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PixelCrushers.DialogueSystem;
using System;
[System.Serializable]
public class QuestStatus
{
public string questName;
public bool successful;
public List<GameObject> QuestItem = new List<GameObject>();
public QuestStatus(string s, bool b, List<GameObject> go)
{
this.questName = s;
this.successful = b;
this.QuestItem = go;
}
}
public class ButterflyFXItems : MonoBehaviour
{
[SerializeField]
public List<QuestStatus> Quests = new List<QuestStatus>();
private void OnEnable()
{
Lua.RegisterFunction("SetActiveQuestItem", this, SymbolExtensions.GetMethodInfo(() => SetActiveQuestItem(0)));
}
private void OnDisable()
{
Lua.UnregisterFunction("SetActiveQuestItem");
}
//Turn On Quest Items from Conversation Node
public void SetActiveQuestItem(double index)
{
int indexValue = (int)index;
//Go through and turn on each item in the quest response item list
foreach (GameObject item in Quests[indexValue].QuestItem)
{
Quests[indexValue].successful = true;
//items do not exist
if (item == null)
{
Debug.LogErrorFormat("Items for this quest are not populated. Please populate Quest Items in Butterfly FX Items for " + Quests[indexValue].questName);
return;
}
else
{
item.SetActive(true);
}
}
}
//Reset All Quest Items to Default State (Off)
public void ResetItemStates()
{
for (int i = 0; i < Quests.Count; i++)
{
Quests[i].successful = false;
foreach (GameObject item in Quests[i].QuestItem)
{
if (item == null)
{
return;
}
else
{
item.SetActive(false);
}
}
}
}
public void CheckAllQuestStates()
{
Debug.Log("Checking States");
foreach (QuestStatus quest in Quests)
{
quest.successful = PixelCrushers.DialogueSystem.QuestLog.IsQuestSuccessful(quest.questName);
Debug.Log(PixelCrushers.DialogueSystem.QuestLog.IsQuestSuccessful(quest.questName));
Debug.Log("The quest : " + quest.questName + " is " + PixelCrushers.DialogueSystem.QuestLog.CurrentQuestState(quest.questName));
if (!quest.successful)
{
foreach (GameObject item in quest.QuestItem)
{
if (item == null)
{
return;
}
else
{
item.SetActive(false);
}
}
}
else
{
foreach (GameObject item in quest.QuestItem)
{
if (item == null)
{
return;
}
else
{
item.SetActive(true);
}
}
}
}
}
Re: SetContinueMode Forcing Conversation to Auto Progress
Posted: Thu Dec 31, 2020 7:10 am
by jae026
Also, the reason behind this is because I have items that exist in each scene that are set active based on different quest states. So I run a check at the start of each scene and turn on/off objects based on the quest states returned.