How can I setup a trigger box to be a quest giver?. Or been having a few problems getting it to work well
My first thought would be just adding a QuestGiver to the trigger box… then write a script with OnTriggerEnter that checks if the player is the triggering object and if it is, GetComponent<QuestGiver>().GiveQuest();
Should I make it public so that I can choose the type of quest to give?.
The QuestGiver should already have a field for indicating the Quest to give…
public class QuestGiver : MonoBehaviour
{
[SerializeField] Quest quest; //<<<---------
public void GiveQuest()
{
QuestList questList = GameObject.FindGameObjectWithTag("Player").GetComponent<QuestList>();
questList.AddQuest(quest);
}
}
1 Like
Thank you
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.