Page 1 of 2

Dialogue System with a Quest

Posted: Wed Jul 28, 2021 6:19 pm
by Mach4
Hi Tony -

First of all, thanks for all the great video tutorials that you have made as they are very helpful.
I was able to get the Dialogue system and Quest setup to work as per your video.

Instead of the baby cubes being "destroyed" or removed, how would I keep them in the scene with the ability to move then to another location? I know how to code the player to pick them up and move them but I don't want to "break" the DS / QM setup.


Thanks
Rick

Re: Dialogue System with a Quest

Posted: Wed Jul 28, 2021 7:10 pm
by Tony Li
Hi Rick,

It depends on how you want to increment and/or finish the quest.

If you want the player to deliver the baby cubes to the quest giver, you could keep track of how many cubes the player has picked up -- for example, track it in a Dialogue System variable. Then expand the quest giver's conversation to check the value of that variable.

Similarly instead of tracking how many cubes the player is holding, you could track how many baby cubes are in a specific area, such as the babies' "crib," in a Dialogue System variable. As the player puts each cube in the crib, increment the variable.

Re: Dialogue System with a Quest

Posted: Wed Jul 28, 2021 9:32 pm
by Mach4
Hi Tony -

I am really close to what I need to do.
All I want to do is to keep the cubes from be destroyed (disappearing), and then put each one in a specified area of the scene.
In the meantime, I will revisit the manual for hints.

Thanks so much;
Rick

Re: Dialogue System with a Quest

Posted: Wed Jul 28, 2021 9:50 pm
by Tony Li
Hi Rick,

Definitely sounds like you're close. There's no need for the baby cube's Dialogue System Trigger that's set to OnTriggerEnter, and probably no need for the Increment On Destroy component either, since it sounds like you'll be handling that with your own script that takes care of picking up and putting down objects.

Re: Dialogue System with a Quest

Posted: Wed Jul 28, 2021 9:57 pm
by Mach4
Ok, I will work that method and see how it goes.

Thanks very much;

Rick

Re: Dialogue System with a Quest

Posted: Fri Jul 30, 2021 1:06 pm
by Mach4
Hi Tony -

As I mentioned before, I have been successful in getting things up and running per your video using DS and QM.
How do I keep track of the cubes "rescued" and still keep track of the number of cubes if I remove the "Increment on destroy" component. I searched for another component that would increment without destroy but no success.

I want to move my player to each cube and then move each one to a specified location (That has its own trigger). As each cube is placed the Quest would still keep track of the number of cubes placed on its own location.

It seems I am just one step away from this ...

Thanks again
RIck

Re: Dialogue System with a Quest

Posted: Fri Jul 30, 2021 1:15 pm
by Tony Li
Hi,

Are you planning to use some mechanism external to the Dialogue System to handle picking up cubes and putting them down? (For example -- an inventory system asset, or a grab-and-move script, or even a gravity gun.)

Increment On Destroy isn't the only way to increment a variable. You can use a Dialogue System Trigger, which is a general-purpose component used to do a variety of activities in the Dialogue System. Or you can manually increment the variable in your own script, like this:

Code: Select all

using PixelCrushers.DialogueSystem; //<-- place this line at the top of your script.
...
// Increment the variable:
int numCubesPlaced = DialogueLua.GetVariable("NumCubesPlaced").asInt;
DialogueLua.SetVariable("NumCubesPlaced", numCubesPlaced + 1);
// Send "UpdateTracker" message to quest UIs to tell them to update:
DialogueManager.SendUpdateTracker();

Re: Dialogue System with a Quest

Posted: Fri Jul 30, 2021 1:21 pm
by Mach4
Hi Tony -

Yes I have a grab and move script that I attach to the player, so I can get the cubes moved. I have three locations and want to put a cube in each location. when I get all three cubes in their own location, the quest would be complete.

Re: Dialogue System with a Quest

Posted: Fri Jul 30, 2021 1:24 pm
by Tony Li
I can think of two good ways to increment the variable in that case:

1. When the player drops the cube into the proper location, manually increment the variable like in the code above.

2. Or set up a trigger collider and Dialogue System Trigger set to OnTriggerEnter. Set the Accepted Tags or Accepted GameObjects to only accept the cubes. Configure Actions > Run Lua Code to increment the variable. Example:

Code: Select all

Variable["NumCubesPlaced"] = Variable["NumCubesPlaced"] + 1;
 UpdateTracker)();

Re: Dialogue System with a Quest

Posted: Fri Jul 30, 2021 1:50 pm
by Mach4
There look like great options. I will try out both.

Thanks very much;

Have a great weekend