ID:172526
 
Hey all, long time no see, or should I say long time no chat!

Anyway, off that, my little problem goes as follows, within me newest project which is more than half way done, is at a little stand-still.

The problems stand-still is Quests. I need to create a simple, yet efficient Quest system to holster all the quests I have for the character to do within the game for him/her to progress.

I was looking through lists and being one of the people who has had trouble with lists in the past and still finds them hard, I was woundering, would it be best for me to use Multi-Dimensional Lists?

The way I would see how I would use my list with the Multi-Dimensional way is as follows:

var/Quests[4][10]


That there shows there are four main lists and have a length of 10. Which is what I need anyway.

I have a 5 chapter setup, 4 Chapters consist of 10 quests and the 5th chapter consists of no quest whatsoever. So, the common problem I have now is; How do I actually program this is? How would I set this whole list out?

What I'd like for someone, if not a wide range of people to show me if they will, an example of how you would do something similar to the way I need my lists done, obviously NOT the coding I would use but an example of how it would be done. I would like to know how this would work, not to just copy/paste it within my game.

So, all help will be grateful and hopefully I will get this done :)

Just so you know, the reason I came here is because firstly, I don't know what I'm doing with the lists, and secondly, I don't know how to program it in nor how to go about it.

If I had some sort of self-done code about my quest that I actually did, I'd be going to the Code Problems topic, but now you know why I came here :)

--Lee
Well, you could use that approach and when for instance you wanted to check whether a specific part of any quest has been done all you would need to do is if(Quests[Quest#][Part#] == "Done")

Then when you have the quests completed it can be as simple as
src.gold++
src.Quests[1][2] = "Done"

Then you can also have partway dones parts, thereby talking to Dave would make src.Quests[1][3] = "Half" but I would need to talk to Steve to make it = "Done"

Its an idea ;)
Mellifluous wrote:
Hey all, long time no see, or should I say long time no chat!

Anyway, off that, my little problem goes as follows, within me newest project which is more than half way done, is at a little stand-still.

The problems stand-still is Quests. I need to create a simple, yet efficient Quest system to holster all the quests I have for the character to do within the game for him/her to progress.

I was looking through lists and being one of the people who has had trouble with lists in the past and still finds them hard, I was woundering, would it be best for me to use Multi-Dimensional Lists?

The way I would see how I would use my list with the Multi-Dimensional way is as follows:

var/Quests[4][10]

That there shows there are four main lists and have a length of 10. Which is what I need anyway.

I have a 5 chapter setup, 4 Chapters consist of 10 quests and the 5th chapter consists of no quest whatsoever. So, the common problem I have now is; How do I actually program this is? How would I set this whole list out?

What I'd like for someone, if not a wide range of people to show me if they will, an example of how you would do something similar to the way I need my lists done, obviously NOT the coding I would use but an example of how it would be done. I would like to know how this would work, not to just copy/paste it within my game.

So, all help will be grateful and hopefully I will get this done :)

Just so you know, the reason I came here is because firstly, I don't know what I'm doing with the lists, and secondly, I don't know how to program it in nor how to go about it.

If I had some sort of self-done code about my quest that I actually did, I'd be going to the Code Problems topic, but now you know why I came here :)

--Lee

I say use the multi-dimensional lists, then also store objects in the list with its own special proc, and then access their procs to see if the quest is done.
Mellifluous wrote:
Hey all, long time no see, or should I say long time no chat!

Anyway, off that, my little problem goes as follows, within me newest project which is more than half way done, is at a little stand-still.

The problems stand-still is Quests. I need to create a simple, yet efficient Quest system to holster all the quests I have for the character to do within the game for him/her to progress.

I was looking through lists and being one of the people who has had trouble with lists in the past and still finds them hard, I was woundering, would it be best for me to use Multi-Dimensional Lists?

No. Multi-dimensional lists are rarely a good idea.

The way I would see how I would use my list with the Multi-Dimensional way is as follows:

var/Quests[4][10]

That there shows there are four main lists and have a length of 10. Which is what I need anyway.

I have a 5 chapter setup, 4 Chapters consist of 10 quests and the 5th chapter consists of no quest whatsoever. So, the common problem I have now is; How do I actually program this is? How would I set this whole list out?

If your quests are simply pass/fail quests that never change, then each chapter could simply have a numerical value that uses bit flags to tell if the quests are done. In this case, a value of 1023 could tell you that all quests were done, or maybe that they were all undone, depending on which is easier to wrangle.

What I'd like for someone, if not a wide range of people to show me if they will, an example of how you would do something similar to the way I need my lists done, obviously NOT the coding I would use but an example of how it would be done. I would like to know how this would work, not to just copy/paste it within my game.

A much better approach is to use datums for your quests. Each datum can not only keep track of the quest's status itself, but it can also act as a linked list to other finished or unfinished quests.

Just so you know, the reason I came here is because firstly, I don't know what I'm doing with the lists, and secondly, I don't know how to program it in nor how to go about it.

If I had some sort of self-done code about my quest that I actually did, I'd be going to the Code Problems topic, but now you know why I came here :)

Actually Design Philosophy would be good too.

Lummox JR
In response to Lummox JR
Thanks for the reply everyone, so far I have still come up with nothing, yet, but I'm working on it :)

As for the Datums, Lummox JR, I'll have to look up more about Datums. The only time I ever tried them is when Gazoot gave me a test, well, he did the large majority of it though.

Anyway, I'll try the Datum way and skip the Multi-Dimensional list as you say and hopefully I'll get something :)

Also, for the numerical way, I would be stumped there because you lost me... I don't get how you can use the numbers, says for example 1023 to define that all the quests are done.

--Lee
In response to Mellifluous
If I had to use numbers like that, this is how I would think to do it (for a list of 3):

000 = None done
001 = Only 1st
010 = Only 2nd
011 = Only 3rd
100 = 1st and 2nd
101 = 1st and 3rd
110 = 2nd and 3rd
111 = All done.

But that's with a really short list, if you had a list of 10 then it'd be really long!

~Ease~
In response to Mellifluous
BitFlag GEM

That library will do most of the work for you. Now, to use it
in conjunction with what Lummox was saying, you'd define a quest datum like so:

Quest
var/status = 0
var/name


You'll need reference variables to keep track of them, so each mob will have a variable for each chapter:

mob
var/Quest/Chapter1
var/Quest/Chapter2
var/Quest/Chapter3
var/Quest/Chapter4
var/Quest/Chapter5

I leave it to you to decide how to initialize them, but I recommend using save files and checking to see if the chapters are null (isnull(src.Chapter1)). If they are, use new() to initialize them.

Now that the framework is done, you'll need to actually work with the bit flags. The basis of bitflags is binary. Without going into too much detail this essentially means that you will work in doubles.

I often #define bitflag values to make my life easier. An example would be:
#define Q1 1
#define Q2 2
#define Q3 4
#define Q4 8
#define Q5 16
#define Q6 32
#define Q7 64
#define Q8 128
#define Q9 256
#define Q10 512

Note that the value keeps doubling?

Ok, whenever someone completes a quest you would use SET_BIT(chaptervariable,Q1) for example, where chaptervariable is Chapter[x].status. Using the first chapter as an example; to show that the player has completed the first quest, you would use SET_BIT(src.Chapter1.status, Q1). To set the second quest as done: SET_BIT(src.Chapter1.status, Q2).

If you used the above example, someone who had completed quests 1 and 2 of chapter one would have a Chapter1.status of 3.

To check if someone has completed a given quest, you use the CHECK_BIT() proc. CHECK_BIT(src.Chapter1.status, Q1) will return true if you have used SET_BIT() as shown above.



As a side note, I would like to know why the lib keeps getting deleted from my hub. I use a download URL that works just fine, but after a while I come back and find it deleted.
In response to sapphiremagus
sapphiremagus wrote:
I leave it to you to decide how to initialize them, but I recommend using save files and checking to see if the chapters are null (isnull(src.Chapter1)). If they are, use new() to initialize them.

Ok thanks for the input sapphiremagus, I have taken in what you wrote and I am currently working on what you said, thing is though, what types of other ways can I use to initiate the quests other than that of "Savefiles"?

I've never really worked with savefiles, or should I say custom made savefiles for that matter. To get this done properly at the best potential I'm trying to keep it simple yet have almost if not all the doors to doing this open.

So could you please state what other types of ways I could use to initiate the quests?

--Lee
I particurally did this with variables, and when the guy tht gives you the quest is talked to, it just checks variables.
In response to Metroid
Metroid wrote:
I particurally did this with variables, and when the guy tht gives you the quest is talked to, it just checks variables.

Hopefully, you're using lists, because if you have a lot of quests, that's a lot of unnecessary variables...
In response to Mellifluous
Well, you could use
mob/var
Quest/Chapter1 = new()
...
...


The = new() will initialize the quest datum. The reason I brought up save files is that unless you want this game to run like Pitfall, you'll need some way to save the character data.

Using a savefile is easy enough, especially if you use procs dedicated to saving and loading:

client/proc
Save()
var/savefile/F = new("[ckey].sav")
F<<mob

Load()
var/savefile/F = new("[ckey].sav")
var/mob/temp_mob = new()
F>>temp_mob
if(!temp_mob || isnull(temp_mob)) //bad/nonexistant save file
return
else
mob = temp_mob
if(isnull(mob.Chapter1))
mob.Chapter1 = new()
....


I made it a client proc as opposed to a mob proc because of the ckey value. Only a client (and it's mob) have a key value and a ckey value, and as long as it's a client proc we garuntee that there's a person connected.

What these procs do is save the player's mob ( client.mob ) to the savefile [ckey].sav (sapphiremagus.sav in my case).

The loading proc is a tad more complex. It opens the save file (if there is one, creates one if there isn't) and loads the data in the save file into a temporary mob. The temp_mob is a failsafe incase there is no savefile or the savefile is corrupted. Assuming that the temp_mob is not null, we go ahead and make the temp_mob the client's mob (and as such the player's mob). We then do a series of checks for each chapter variable. If it's null, initialize it.
In response to Metroid
Metroid wrote:
I particurally did this with variables, and when the guy tht gives you the quest is talked to, it just checks variables.

That's an unspeakably bad way to do it with any system with more than a handful of quests.

Lummox JR