Question on Multiple Quest Completions on a single character

So I got Sam’s explanation on the limitation of Unity Events. I also think I understood the recommended solution of sub game objects for multiple quest completion components but it’s so unexpected to me as a solution that I wonder if I understood it correctly.

Question 1. Correct me if I’m wrong, but it sounded like Sam’s suggestion requires you to pair up DialogueTrigger and QuestCompletion components for every Quest Objective you want to mark as completed?

Question 2: But this would seem to require knowing in advance how many child game objects to create and thus wouldn’t work if you’re dynamically creating quest instances. Otherwise how many child objects would you create?

To do something more dynamic, my approach would be similar to how we did some of the inventory and pickup stuff in the Inventory course. I’d dynamically spawn as many QuestCompletion objects as I need and establish a relationship between the dialogue trigger and the quest completion object via event registration and invocation in code vs in the inspector.

Again asking because I want to make sure I correctly understood what Sam presented. I tried playing around with Sam’s suggestion in the Unity Editor and I see how it can work for a limited and predefined set of quests and objectives. Assuming my understanding is correct I think I can code this all up myself given what I’ve learned in the series.

If there’s something later in the course that covers this also helpful to have a heads up. I saw a post by Brian about conditions and enums but it seems that is meant for folks who are past the shops and abilities course.

EDIT: correcting small typos.

The problem with multiple Quest Completions is due to a problem within Unity itself. When you link a component to an event handler and call a method on it, you are really linking to the GameObject, and then it saves the component class and method to call… If there are multiple QuestCompletions on the same GameObject, the first one will always be called.

Yes, because you should have a pretty good idea at design time if the character in question relates to a quest…

Again, the same issue. You should know if this character is involved in a quest. At that point, once you know that this character completes an objective, then you add a GameObject with a QuestCompletion to that specific character and wire it up appropriately.

This seems to be more complicated than simply adding them and wiring them up as needed. If, however, you have an idea for this, I would be interested in seeing it.

I know that guy. I’m pretty sure he’d say you can still use the editor as written, and just ignore the shop specific components (I’m thinking HasTrait is it, but I could be wrong).

Perhaps “quest” is the wrong word. I’m borrowing major pieces from the quest mechanic and creating a closely related game mechanic. It’s not your traditional series pre-scripted of quests.

It’s definitely a tad bit more complicated up front, but if I get it right, I think it should save many times the complexity on the back end. Perhaps I am naive and its more complex than I think it is but it seems so similar to stuff we’ve done in the past.

I’ll post my progress as soon as I have something worth sharing.

1 Like

EDIT Aug 23.

@Brian_Trotter OK I think I have it working. We closed on the basics here.

The new stuff is here. Please take a look Brian :slight_smile: It is working but it’s a bit hacky in a few spots.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms