I'm still using Invector, and this quest specifically is a simple "Get vItem" fetch quest, and it was working weeks ago. However, now when i go get the item, instead of switching to the next node, it kicks out this error in the MessageSystem.
per my last few threads, I had these "QuestNodeListener" scripts written that use the MessageSystem to check when Nodes are active, to switch some UI stuff, and they all were working flawlessly with your help. But now this error is happening, and i cannot figure out why. I've been looking at everything I changed recently, and still nothing seems to be causing it. Nothing's changed in the scripts or prefabs in forever, so anything you might notice would be super helpful.
Here's the script itself that was listening, It was working fine last i checked weeks ago:
EDIT: Looks like this only happens to some of my quests, but nothing seems to be different between the ones that work and ones that dont- both have the same requirements, i.e. "Get vItem". But some work and others give that error
Code: Select all
public class QuestNodeListener : MonoBehaviour, IMessageHandler
{
public StringField requiredQuestID;
public StringField requiredQuestNodeID;
[Space]
public bool NodeStateActive;
[Space]
public UnityEvent OnNodeActive;
public UnityEvent OnNodeInactive;
void Start()
{
}
void OnEnable()
{
MessageSystem.AddListener(this, QuestMachineMessages.QuestStateChangedMessage, requiredQuestID);
SceneManager.sceneLoaded += OnSceneLoaded;
}
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
CheckIfNodeIsActive();
}
void OnDisable()
{
MessageSystem.RemoveListener(this);
}
public void OnMessage(MessageArgs messageArgs)
{
// "Quest State Changed" is sent when a quest state or quest node state changes.
// - Parameter: Quest ID.
// - Value 0: [StringField] Quest node ID, or null for main quest state.
// - Value 1: [QuestState] / [QuestNodeState] New state.
if (messageArgs.values[0] == null)
{
// If value 0 is null, this is the main quest state so just exit:
return;
}
else
{
string questID = messageArgs.parameter;
StringField questNodeID = (StringField)messageArgs.values[0];
QuestNodeState questNodeState = (QuestNodeState)messageArgs.values[1];
if ((questID == requiredQuestID.value) && (questNodeID.value == requiredQuestNodeID.value))
{
// This is the quest node we're interested in, so set the quest pointer based on the node's current state:
if (questNodeState == QuestNodeState.Active)
{
// (Quest node is active)
NodeStateActive = true;
OnNodeActive.Invoke();
//Debug.Log(requiredQuestID + " is in " + requiredQuestNodeID + " Node");
}
else
{
// (Quest node is not active)
NodeStateActive = false;
OnNodeInactive.Invoke();
//Debug.Log(requiredQuestID + " is out of " + requiredQuestNodeID + " Node");
}
}
}
}
public void CheckIfNodeIsActive()
{
// This is the quest node we're interested in, so set the quest pointer based on the node's current state:
if (NodeStateActive == true)
{
// (Quest node is active)
OnNodeActive.Invoke();
//Debug.Log(requiredQuestID + " is in " + requiredQuestNodeID + " Node");
}
}
}