Multiple on conversation ends?
Posted: Mon May 17, 2021 12:23 pm
Hello Again <3
I was wondering if there was any kind of issue with having a few different system triggers set to go off on conversation end.
I have three achievements that can unlock during a conversation, but I wasn't sure how to use the script I wrote to turn them on from the dialogue manager/conversation node, so I figured I'd do three on conversation ends depending on which choice you picked (setting a variable to use as a condition when the player selects a choice) and then use the on execute command to run my script.
I also have a continute button that I would like to appear when the conversation is over so that the player can move to the next scene.
However, after testing this, it didn't look like the achievement had been set and the button did not appear. I'm curious if there's some kind of issue with having more than one thing set to go when a conversation ends?
(This is the script I use to activate achievements if it helps)
I was wondering if there was any kind of issue with having a few different system triggers set to go off on conversation end.
I have three achievements that can unlock during a conversation, but I wasn't sure how to use the script I wrote to turn them on from the dialogue manager/conversation node, so I figured I'd do three on conversation ends depending on which choice you picked (setting a variable to use as a condition when the player selects a choice) and then use the on execute command to run my script.
I also have a continute button that I would like to appear when the conversation is over so that the player can move to the next scene.
However, after testing this, it didn't look like the achievement had been set and the button did not appear. I'm curious if there's some kind of issue with having more than one thing set to go when a conversation ends?
(This is the script I use to activate achievements if it helps)
Code: Select all
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
public class AchActivation : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
var AchObjects = GameObject.FindGameObjectsWithTag("Ach");
foreach (GameObject achievements in AchObjects)
{
achievements.GetComponent<AchHolder>().AllCode = PlayerPrefs.GetInt(achievements.GetComponent<AchHolder>().Name);
if(achievements.GetComponent<AchHolder>().AllCode == 1)
{
achievements.GetComponent<AchHolder>().Active.SetActive(true);
achievements.GetComponent<AchHolder>().InActive.SetActive(false);
}
}
}
public void UnlockAch(string achName)
{
var AchObjects = GameObject.FindGameObjectsWithTag("Ach");
foreach (var achievements in AchObjects)
{
if (achievements.GetComponent<AchHolder>().Name == achName)
{
achievements.GetComponent<AchHolder>().AllCode = 1;
PlayerPrefs.SetInt(achievements.GetComponent<AchHolder>().Name, achievements.GetComponent<AchHolder>().AllCode);
achievements.GetComponent<AchHolder>().ThisCode = 1;
}
}
}
}