Demo Spawner Missing

Announcements, support questions, and discussion for Quest Machine.
Gandoff
Posts: 20
Joined: Mon Jan 01, 2018 7:13 pm

Re: Demo Spawner Missing

Post by Gandoff »

In your step two (assigning player to interact object), how could I do this via C#?
Gandoff
Posts: 20
Joined: Mon Jan 01, 2018 7:13 pm

Re: Demo Spawner Missing

Post by Gandoff »

Also select the blank element in the Dialogue For Rewards Section, then click the "+". This is a mistake in the prefab that's fixed in version 1.0.2.
What option do I select from the pop up menu once I have clicked the plus?
User avatar
Tony Li
Posts: 20759
Joined: Thu Jul 18, 2013 1:27 pm

Re: Demo Spawner Missing

Post by Tony Li »

Gandoff wrote: Wed Jan 03, 2018 6:36 pm
Also select the blank element in the Dialogue For Rewards Section, then click the "+". This is a mistake in the prefab that's fixed in version 1.0.2.
What option do I select from the pop up menu once I have clicked the plus?
Oops, sorry, I meant "-". The intent is to remove the erroneous blank element.
User avatar
Tony Li
Posts: 20759
Joined: Thu Jul 18, 2013 1:27 pm

Re: Demo Spawner Missing

Post by Tony Li »

Gandoff wrote: Wed Jan 03, 2018 6:33 pm In your step two (assigning player to interact object), how could I do this via C#?
I'll explain how to set up the Targetable component's OnInteract() event below. But, since you're using C#, you may find it easier to simply call the C# method. If your C# script is on the quest giver, do something like this:

Code: Select all

var player = GameObject.FindWithTag("Player");
GetComponent<QuestGiver>().StartDialogue(player);

However, if you want to set up the Targetable component, try this:

Code: Select all

var targetable = GetComponent<Targetable>();
var questGiver = GetComponent<QuestGiver>();
var player = GameObject.FindWithTag("Player");
targetable.onInteract.AddListener(delegate { questGiver.StartDialogue(player); });
Gandoff
Posts: 20
Joined: Mon Jan 01, 2018 7:13 pm

Re: Demo Spawner Missing

Post by Gandoff »

Thank you very much. You have been very thorough and quick to respond. That makes for GREAT customer service!

That was just what I was looking for.
User avatar
Tony Li
Posts: 20759
Joined: Thu Jul 18, 2013 1:27 pm

Re: Demo Spawner Missing

Post by Tony Li »

My pleasure.

Full disclosure: I typed the second code block directly into the reply. I didn't test it. There might be typos. If it doesn't work right off the bat, you may need to fiddle with it. I'll give it a test now and fix my reply if necessary.

Edit: Okay, tested and corrected. Apologies for my laziness earlier.

One thing I should add: In version 1.0.1, the Player prefab isn't tagged "Player", so the code above won't find the player unless you set the tag.
Post Reply