I’m trying the make the code switch to the next quest when you reach the required amount of points for each quest. For some reason it’s not working and I really can’y work out why.
Any help would be great thanks!
Bit of script I’m trying to make work:
for (int i = currentPoints; i >= 0; i++)
{
if (Quests*.pointsRequired <= currentPoints)*
{
Debug.Log(“ping”);
currentQuestid += 1;
}
}
And the full script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class questManager : MonoBehaviour
{
public int currentQuestid;
[System.Serializable]
public class Quest
{
public int pointsRequired;
public GameObject objects;
public int questID;
public string objective;
public string pointName;
public string info;
public float waitTime;
public bool enabled = false;
public Text objectiveText;
public Text remainingText;
public Text infoText;
}
public Quest[] Quests;
public int currentPoints;
public float currentdelay;
public int required;
void Start()
{
currentQuestid = 0;
currentPoints = 0;
for (int i = 0; i < Quests.Length; i++)
{
Quests_.objectiveText.text = Quests*.objective;
}
}*_
void Update()
{
for (int i = 0; i < Quests.Length; i++)
{
Quests*.objects.SetActive(i == currentQuestid);*
}
for (int i = 0; i < Quests.Length; i++)
{
Quests.remainingText.text = Quests_.pointName + ": " + currentPoints + “/” + Quests*.pointsRequired;
}*_
for (int i = currentPoints; i >= 0; i++)
{
if (Quests*.pointsRequired <= currentPoints)*
{
Debug.Log(“ping”);
currentQuestid += 1;
}
}
}