Essentially I would like for the system to work like this:
Player interacts with quest giver to start quest.
Player must obtain ItemX for quest giver
Player obtains ItemX
Player returns to quest giver to complete quest.
Currently, this item quest ends as soon as the player picks up the item, and I would rather have it set up
so that the player can’t end the quest until he returns to the quest giver.
I’m still new to programming, and I apologize for how unorganized my code looks, but I assume having some relevant examples of the code I’m using will shed some light.
This is the bit that checks for quest triggers
private void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.tag == "Player" && !theQM.questCompleted[questNumber])
{
if(startQuest && !theQM.quests[questNumber].gameObject.activeSelf)
{
theQM.quests[questNumber].gameObject.SetActive(true);
theQM.quests[questNumber].StartQuest();
}
if(endQuest && theQM.quests[questNumber].gameObject.activeSelf)
{
theQM.quests[questNumber].EndQuest();
}
}
}
You’ll notice it’s lacking any checks or references for any type of quest items.
Currently, I have a separate script for that, which looks like this…
private void OnTriggerEnter2D(Collider2D other)
{
if(other.tag == "Player")
{
if(!theQM.questCompleted[questNumber] && theQM.quests[questNumber].gameObject.activeSelf)
{
theQM.itemCollected = itemName;
gameObject.SetActive(false);
}
}
}
Now, both of these quest scripts are working, but the problem is that in the first script I am able to set
where the quest will start, and where it will end, but with the quest item script, the quest will always end
at the moment I pick up the item. I’m sure there is a way I can combine my quest item check with my original quest trigger script, but I feel like I’m just beating my head against a wall right now.
I tried searching here and on google, but I wasn’t able to find anything helpful.
If there is anyone who can point me in the right direction I would be much appreciative, and I do apologize if there’s anything I’m missing. Cheers!