• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Campaign] Storing quests in the game cache

Status
Not open for further replies.
Level 10
Joined
Apr 4, 2010
Messages
286
I've reviewed several tutorials on the basics of the game cache (MAJOR thank you to Ralle and Mtlhead for that tutorial). My one outstanding question is about the best way to store quest information from map to map in a Rexxar-style campaign.

Here's what I want: When you jump from Map A to Map B, and open up your Quests panel, everything looks the same as it did when you were in Map A. If you complete a quest while in Map B, then jump back to Map A, that quest shows up in your Quests panel as being completed. In other words, I want your entire set of quests to be saved and loaded via the game cache every time you transition.

Looking at the different possible triggers, there obviously isn't a simple "Game Cache -- Store quests" or similar. The best I've been able to come up with is a long and clunky set of booleans tracking each separate quest and quest objective, all of which are saved and loaded individually in the game cache, and then individually checking all of those booleans and rebuilding the quests from scratch in the next map.

Is there a more elegant way to do this? Thanks in advance!
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
My personal preference would be to use booleans.

So in all your maps, you've got a quest-variable (with array) and a quest requirement-variable (also with array).
Inside those, you store all quests/quest requirements (the array in all maps has to be the same: Quest[1] in the first map also has to be Quest[2] in the second map).

Additionally, you also create a boolean variable (with array). This boolean will hold false if the quest hasn't been completed, and true if it has.
So if Quest[1] has been completed, then you can set QuestBool[1] to true.

When switching maps, you loop from 1 to (amount of quests) and save QuestBool[LoopInt] in the game cache (Category: "Quests" / Label: 'LoopInt').
Upon loading the game cache, you loop through it (again, from 1 to the amount of quests) and if QuestBool[LoopInt] is true, then mark the quest Quest[LoopInt] as completed.

Same method for the quest requirements.

Edit: I believe you use separate variables (no array) when you said it was a 'clunky method', correct? Because with arrays, it's all done automatically.
 
Level 10
Joined
Apr 4, 2010
Messages
286
I believe you use separate variables (no array) when you said it was a 'clunky method', correct? Because with arrays, it's all done automatically.

This is correct, I was looking at separate variables. I guess with arrays it's still performing the same actions theoretically, but at least I can automate it somewhat with loops and not have to do the whole thing by hand. That should save some aggravation, anyway.

Thanks!
 
Status
Not open for further replies.
Top