Quest not accepted but variables go up

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
StrujaMojaKuja
Posts: 7
Joined: Thu Aug 24, 2023 7:05 am

Quest not accepted but variables go up

Post by StrujaMojaKuja »

So I have a prefab in my scene that spawns enemies on random location, the enemies are not in the scene but i set them up accordingly with the help of your video tutorial that is on youtube. The issue is when I kill the enemy and the quest is not accepted, the counter goes up. Also, the enemies are in the scene before accepting the quest. The other issue is when I'm done with the quest, let's say I killed 15/15 enemies, the counter will go up after I kill them again, 16/15, etc... Is there any easy way to fix this that I missed out on? Thank you for your help
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest not accepted but variables go up

Post by Tony Li »

Hi,

The info in How To: Set Up Quests Without Conversations may be helpful, even if you're using conversations for the quest.

On your enemy prefab, make sure the Increment On Destroy component's Conditions > Quest Conditions are set so it will only increment if the quest is active. Also set the max value so it won't go above 15.

The bottom of the How To I linked above explains how to change scenes to prevent incorrect incrementing.
StrujaMojaKuja
Posts: 7
Joined: Thu Aug 24, 2023 7:05 am

Re: Quest not accepted but variables go up

Post by StrujaMojaKuja »

Thank you that worked. :D May I ask you one more thing, on scene change (level 1, back to main menu, main menu back to level 1), all of the UI for the dialogue manager is gone, i can't open journal, interact panel doesn't show, but the dialogue does show. Is there an easy fix to this? Sorry for bothering you.
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest not accepted but variables go up

Post by Tony Li »

Hi,

There's probably an easy fix, but it depends on how you're changing back to the main menu and then back to level 1. What code and/or components are you using to go to the main menu and to level 1 from the main menu?
StrujaMojaKuja
Posts: 7
Joined: Thu Aug 24, 2023 7:05 am

Re: Quest not accepted but variables go up

Post by StrujaMojaKuja »

To go back to the main menu I use this method from a button:

public void MainMenu()
{
Time.timeScale = 1f;
SceneManager.LoadScene("MainMenu");
}

and I'll send you the whole class that I use to load a level:

public class LoadingScene : MonoBehaviour
{
public GameObject loadingScreen;
public Image loadingBarFill;
public GameObject mainUI;
public GameObject sounds;
public GameObject playUI;
public GameObject backgroundMusic;

IEnumerator LoadSceneAsync(int sceneId)
{
AsyncOperation operation = SceneManager.LoadSceneAsync(sceneId);

loadingScreen.SetActive(true);

while (!operation.isDone)
{
float progressValue = Mathf.Clamp01(operation.progress / 0.9f);
loadingBarFill.fillAmount = progressValue;
yield return null;
}
}

public void LoadScene(int sceneID)
{
StartCoroutine(LoadSceneAsync(sceneID));
mainUI.gameObject.SetActive(false);
sounds.gameObject.SetActive(false);
playUI.gameObject.SetActive(false);
backgroundMusic.gameObject.SetActive(false);
}
}

It's a pretty basic loading screen and that's it, I can't find why it ''destroys'' the dialogueManager, but when i restart the game and load it back from the main menu it works good. It's also loaded with a button, a LoadScene method that I sent.
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest not accepted but variables go up

Post by Tony Li »

Hi,

Are there any errors or warnings in the Console?

Have you changed any settings in the Dialogue Manager GameObject's Other Settings section, such as Don't Destroy On Load or Allow Only One Instance?

Do any other GameObjects in your main menu scene have a Save System component or Input Device Manager component?
Post Reply