New account registration is temporarily disabled.

[RM2K3] QUEST LOG CONUNDRUM

Posts

Pages: 1
So... I plan to have a quest log in my game.

The quest names I have in a picture used as a sprite sheet, listed vertically.

Now I need to figure out a way to tell which quest has been accepted first, to know which frame of the picture needs to be displayed at the top of the quest log.

I have a variable that's keeping track of the amount of quests (QuestAmount). Each time a quest is accepted, its value is increased by 1. I've thought about making a variable for every quest that I have, and setting it equal to the value of QuestAmount when the quest is picked up.

The problem with it is, it would require a conditional branch for every quest I have in the game, for every quest log position. If I end up having 100 quests, that's a ton of clutter.

For example:
If ExampleQuest1 == 1, Show Picture of this quest name at the top of the quest log.
If ExampleQuest2 == 1, Show Picture of this quest name at the top of the quest log.

I'd have to repeat that 100 times if I have 100 quests. And I'd have to do it for every "slot" in the quest log.

If ExampleQuest1 == 2, Show Picture of this quest name at the 2nd slot of the quest log.
If ExampleQuest2 == 2, Show Picture of this quest name at the 2nd slot of the quest log.

I feel like there must be a way to do this that doesn't require possibly hundreds of conditional branches. But I can't quite think of it.

Any creative minds here who can think of a more efficient way?
Dyluck
For thousands of years, I laid dormant. Who has disturbed my slumber?
5184
Basically, instead of having 100 quest variables containing their possible positions, you can have variables for each position slot containing the quest ID number.

For example if the first quest is Quest6, set variable Slot1 = 6.
If second quest is Quest 4, set variable Slot2 = 4, etc.

Then when it's time to display the log, you check which picture to display based on what number is stored in Slot1, Slot2, etc. You can play around with the Show Picture command, and there's some options to choose the picture based on a variable, or based on filename, or something like that.
Ofcourse! Just do it the other way around. I think that might be it. Gonna try this out.

Actually, the only problem I see with it is, how do I know the first quest is Quest6? Assuming quests can be picked up in a non-linear fashion, I don’t know how many quests the player might already have when picking up Quest6.

The only way I can think of is to check the quest slots when talking to every quest giver. So when talking to the Quest6 questgiver:

If Slot1 is == 0, set it to 6 (Quest6).
If not, check if Slot2 == 0, then set it to 6.

And do that for every quest giver, for every slot.

Dyluck
For thousands of years, I laid dormant. Who has disturbed my slumber?
5184
You said you already have a variable QuestAmount, so you know if this is the first or second accepted quest.

If QuestAmount = 1, then set Slot1 = ID of this quest that just got accepted.
If QuestAmount = 2, then set Slot2 = ID of this quest, etc

You can also make "ID of this quest" a variable, then put this whole Slot Check logic as a Common Event that gets called whenever you accept a quest.

Also if you have a lot of slots, you can try putting the logic in a loop, and play around with "Reference Variable" under Set Variables. It basically lets you have another variable point to which variable ID you want to change. So if you put all your Slot variables in say #25 to #34 sequentially, you can just +1 to the reference variable in each loop pass.
Oh, yeah. I think that would work. But I don't see how it would work as a Common Event tho. Because I can only assign one quest ID to Slot1 at a time, otherwise it will just do them all and set it to the one that is last. And to know which quest ID to assign to it, I need to know to which quest giver the player is talking. But a common event that works would be a lot easier than to check 10 or 20 quest slots for every quest giver.

I don't think I'd even need a separate variable for every quest, right? Because the quest names are assigned a number in the sprite sheet anyway, the top one being 1. So I can just go off of that.
Dyluck
For thousands of years, I laid dormant. Who has disturbed my slumber?
5184
I think you might be misunderstanding common events. Yes, every time you accept a quest, you need to check which slot the quest should go to. I'm saying that's why you can do this check by calling a common event, instead of manually rewriting the whole checking logic each time.

Example, you have CommonEvent called CheckSlots something like this:
If QuestAmount = 1, then Slot1 = CurrentQuest
If QuestAmount = 2 then Slot2 = CurrentQuest
Etc...

-You talk to an NPC and accept Quest#6. The event is like this:
QuestAmount += 1
CurrentQuest = 6
Call CommonEvent: CheckSlots

-You talk to another NPC and accept Quest#4. The event is like this:
QuestAmount += 1
CurrentQuest = 4
Call CommonEvent: CheckSlots

-You accept Quest#7, etc.

-So now you have
Slot1 = 6
Slot2 = 4
Slot3 = 7
Etc...

Then when you write the code for displaying the Quest log, you can use the Slot1, Slot2, Slot3 variables etc, to determine which picture to display or whatever.
Oh yeah, you’re right. Gonna try that.
Pages: 1