Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: cdavenport on Sun 06/05/2018 00:02:54

Title: Creating a Quest Journal
Post by: cdavenport on Sun 06/05/2018 00:02:54

I'm looking at trying to create an extremely simple quest journal to give some feedback to the player on different objectives that haven't been solved yet. Was wondering if anyone has made one for their game, or could suggest some threads I could study.

Also, I have seen the Journal module but I was not sure if it's supported by the latest AGS (Build 3.4.1.11) I'm currently using. Has anyone tried it recently?

I would really just like to be able to present a straight-forward list of goals which could appear as lines of text over a background, in the order that they're discovered. I've done a lot of scripting with other things but so far have not tackled anything like this where you have messages and feedback given to the player. Any suggestions of where I can start to look to find the easiest way of doing this?
Title: Re: Creating a Quest Journal
Post by: eri0o on Sun 06/05/2018 00:13:26
You can use a simple array of strings to store the quest text, an array of booleans to tell if the quest has been completed and another array o booleans to tell if the player knows the quest. Use a enumerator or defines to srefer to the quests index in your code. Use a function to show and hide your GUI, that will also update your GUI and finally two labels, one for solved quests and another for known but not solved quests. This is just a suggestion on a simple system structure.
Title: Re: Creating a Quest Journal
Post by: Matti on Sun 06/05/2018 12:44:03
You could also create a listbox and use AddItem / RemoveItem whenever a quest starts or ends. Then make an extra text label for the quest description.
Title: Re: Creating a Quest Journal
Post by: Narehop on Sun 06/05/2018 14:15:55
Monty Drake and me made a system of quests for Train to nowhere with extra help from the Tween Module. If you give me some time I can try to compile the code and share it.

You can:
- Add new Quests in anyone order.
- Delete quests.
- Complete quests.
- all quests have a different color if you want.
- open / close menu quests with any key when you want.

You can't:
- Create secondary quests into primary quests
- add "icon/label" called "NEW" for new quests.
- Expand info on click quest.


(https://i.gyazo.com/45002243499a1072403233c88cf78758.gif)
Title: Re: Creating a Quest Journal
Post by: cdavenport on Sun 06/05/2018 15:15:46
Quote from: eri0o on Sun 06/05/2018 00:13:26
You can use a simple array of strings to store the quest text, an array of booleans to tell if the quest has been completed and another array o booleans to tell if the player knows the quest. Use a enumerator or defines to srefer to the quests index in your code. Use a function to show and hide your GUI, that will also update your GUI and finally two labels, one for solved quests and another for known but not solved quests. This is just a suggestion on a simple system structure.
Quote from: Matti on Sun 06/05/2018 12:44:03
You could also create a listbox and use AddItem / RemoveItem whenever a quest starts or ends. Then make an extra text label for the quest description.

Thanks for the help, I've been looking at doing it as a listbox and have a very simple sample done, but how would you go about making a text label for the quest description and have it displayed under the AddItem? So far I can create/remove simple entries but knowing how to add a text description label would be nice. I'll Keep looking into it.

Quote from: Narehop on Sun 06/05/2018 14:15:55
Monty Drake and me made a system of quests for Train to nowhere with extra help from the Tween Module. If you give me some time I can try to compile the code and share it.

You can:
- Add new Quests in anyone order.
- Delete quests.
- Complete quests.
- all quests have a different color if you want.
- open / close menu quests with any key when you want.

You can't:
- Create secondary quests into primary quests
- add "icon/label" called "NEW" for new quests.
- Expand info on click quest.


(https://i.gyazo.com/45002243499a1072403233c88cf78758.gif)

Thanks for the offer, I'm not using the Tween module but if you get a chance to post I'd love to take a look at it and I'm sure others may be able to use something like this too it's a fairy standard feature in most games these days.
Title: Re: Creating a Quest Journal
Post by: Matti on Tue 08/05/2018 14:00:27
Quote from: cdavenport on Sun 06/05/2018 15:15:46
Quote from: Matti on Sun 06/05/2018 12:44:03
You could also create a listbox and use AddItem / RemoveItem whenever a quest starts or ends. Then make an extra text label for the quest description.

Thanks for the help, I've been looking at doing it as a listbox and have a very simple sample done, but how would you go about making a text label for the quest description and have it displayed under the AddItem? So far I can create/remove simple entries but knowing how to add a text description label would be nice. I'll Keep looking into it.

Just create a text label under or next to the list. One way to set the description for the currently selected quest would be to check the item name and set the label text accordingly. Something like this should work:
Code (ags) Select

if (Listbox.Items[Listbox.SelectedIndex] == "Return the gold")
{
  Label.Text = "Find the entrance to the sewers and the rat hideout, then take the gold and bring it back.";
}

Replace Listbox and Label with the actual GUI names and do this for every quest there is (you don't need the {}, you could write this in one line).

I can't test this right now. Also this might not be the most elegant way to do it and you have to make sure that the quest names are correct.
Title: Re: Creating a Quest Journal
Post by: cdavenport on Thu 10/05/2018 14:39:21
Quote from: Matti on Tue 08/05/2018 14:00:27
Quote from: cdavenport on Sun 06/05/2018 15:15:46
Quote from: Matti on Sun 06/05/2018 12:44:03
You could also create a listbox and use AddItem / RemoveItem whenever a quest starts or ends. Then make an extra text label for the quest description.

Thanks for the help, I've been looking at doing it as a listbox and have a very simple sample done, but how would you go about making a text label for the quest description and have it displayed under the AddItem? So far I can create/remove simple entries but knowing how to add a text description label would be nice. I'll Keep looking into it.

Thanks Matti, I'll certainly try this I'd like to be able to add a bit more description.

Just create a text label under or next to the list. One way to set the description for the currently selected quest would be to check the item name and set the label text accordingly. Something like this should work:
Code (ags) Select

if (Listbox.Items[Listbox.SelectedIndex] == "Return the gold")
{
  Label.Text = "Find the entrance to the sewers and the rat hideout, then take the gold and bring it back.";
}

Replace Listbox and Label with the actual GUI names and do this for every quest there is (you don't need the {}, you could write this in one line).

I can't test this right now. Also this might not be the most elegant way to do it and you have to make sure that the quest names are correct.

Thanks Matti, I'll try this out. ;-D
Title: Re: Creating a Quest Journal
Post by: Khris on Sun 13/05/2018 19:16:16
Please don't quote the entire immediately previous post. There's a Reply button at the bottom.
Title: Re: Creating a Quest Journal
Post by: Hobbes on Sun 03/03/2019 13:02:19
Dear all,

I've been looking for a very similar function for my game. I think I've set up my GUI correctly but my question is, where would this script described above go? If I declare it as a custom function in my global script, where/how would I call it?

I'm very sorry for bringing back this topic, but it seems to be exactly what I need. Any help would be much appreciated.
Title: Re: Creating a Quest Journal
Post by: Hobbes on Sun 03/03/2019 13:56:03
Fixed it! Apparently I declared an incorrect number of parameters in my script function. Whatever that meant. :-) It's working now!