Page 1 of 1

Finishing a quest without NPC interaction

Posted: Tue Apr 03, 2018 9:17 pm
by CPL_Buddha
Hello all,

I am working on a quest where the player is at a firing range. He is instructed via radio to pick up a weapon and destroy 3 targets. I can get the quest running, counting and displaying the targets destroyed.

What I want to have happen is this. Once the 3rd target is destroyed I want the quest to complete. The instructor then tells the player to move to the next lane.

So how can I do this without having to "turn in" or talk to a NPC? I am using Playmaker so a solution with that might be an option?

Re: Finishing a quest without NPC interaction

Posted: Tue Apr 03, 2018 10:42 pm
by Tony Li
Hi,

You don't even need PlayMaker. Try these steps:

1. In the Dialogue Editor, add a variable to keep track of the number of targets destroyed. Let's say it's named "targetsDestroyed".

2. Add an Increment On Destroy component to each target. Configure it to increment the variable "targetsDestroyed".

3. Add a Quest Trigger to each target.
  • Set the Trigger dropdown to OnUse.
  • Select the Quest Name from the dropdown.
  • Set the Quest State dropdown to success.
  • Optional: Set the Alert Message to something like "Move to the next lane".
  • Set Condition > Lua Conditions to

    Code: Select all

    Variable["targetsDestroyed"] >= 3
4. Back on the Increment On Destroy component, click the "+" in the On Increment () event block. Assign the Quest Trigger component, and select QuestTrigger.OnUse.

How this works: When the target is destroyed, Increment On Destroy activates the Quest Trigger. The Quest Trigger checks if the condition is true (at least 3 targets destroyed). If so, it sets the quest to success and shows an alert message.

If you want to make the instructor bark a line of dialogue instead of using an alert message:

1. Clear the Quest Trigger's Alert Message line.

2. Expand Send Messages, and add an element. Assign the instructor to the Game Object field. Set the Message to OnUse.

3. Add a bark conversation with one node: "Move to the next lane." You can use sequencer commands such as Audio() to play audio with the bark.

4. Add a Bark Trigger to the instructor.
  • Set the Trigger dropdown to OnUse.
  • Select the Conversation from the dropdown.
  • Set Condition > Quest Conditions to (your quest) + success.
How this works: When the Quest Trigger sets the quest to success, it sends the message OnUse to the instructor. The instructor's Bark Trigger will respond to this message by checking its Condition. If the quest is in the success state, it will bark.

Another way to handle the bark conversation and conditions is to put no condition on the Bark Trigger. Instead, add the condition to the bark conversation's node(s). This way you can have lots of barks in the instructor's bark conversation, and use the nodes' Conditions to specify which one to play based on current quest states.