- Home /
Kimmons Dialogue and JS Scripts / Player Inventory
So I have made a dialogue in Unity with Kimmons Dialogue Generator. I am using the script function and trying to insert a script that will redirect the dialogue if the player has gotten the right item before talking to that character.
For example, when the character has obtained item2, a jar, he will trade it with a particular character who is in need of a jar.
Somehow when I put in the script to redirect the instance of the dialogue, to a new component, the dialogue just doesn't continue or redirect, even after hitting the "next button", which is supposed to make the dialogue continue.
The redirect script is as follows:
function Awake()
{
inventory = GameObject.FindWithTag("Player").GetComponent(Inventory);
if (!inventory.hasItem1)
{
gameObject.GetComponents(DialogueInstance)[0].enabled=false;
gameObject.GetComponents(DialogueInstance)[1].enabled=true;
}
}
Anyone have experience with scripting in this generator? And I will not buy the Unity dialogue generator for $100. Thanks.
Your answer
Follow this Question
Related Questions
referencing a component of a gameobject 1 Answer
2D Animation does not start 1 Answer
store a component in a variable? 2 Answers
How to instantiate multiple Prefabs to multiple Childs randomly ? 2 Answers
Prefabs instantiating at wrong spot 1 Answer