Hi everybody,
I was just wondering if there is an easy way to implement objectives where the player is collecting multiples of the same item?
The example I have of this is that one stage in a quest you might be collecting the ingredient for a dinner for someone. Cooking grilled salmon for a group of people might consist of collecting 6 pieces of meat, potatoes, carrots, and a pile of salt.
The only method I can think of is creating a separate quest objective for each iteration. Such as - Quest Objective 201: 'Collect salmon meat (4/6)', Quest Objective 202: 'Collect salmon meat (5/6)'.
As the player picks up a piece of salmon I would hide objective 201 and display object 202, and the inverse when they drop an item. But this is a really ugly implementation, especially when I'm dealing with more than one collections of quest items.
This is my code at the moment:
Scriptname AA92CaptiveAtSeaPlayer extends ReferenceAlias Actor Property PlayerRef auto Quest Property AA92CaptiveAtSea auto GlobalVariable Property HeideDishSelection auto {Various ingredients for Heide's sub quest} Potion Property FoodRabbit auto Potion Property FoodPotato auto Ingredient Property Garlic auto Potion Property Ale auto Potion Property FoodSalmon auto Potion Property FoodCarrot auto Potion Property FoodHorkerMeat auto Ingredient Property SaltPile auto Ingredient Property Lavender auto Potion Property FoodLeek auto Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if (AA92CaptiveAtSea.GetStage() == 54) int selection = HeideDishSelection.GetValue() as int if (selection == 1) ;check if player has collected ingredients for rabbit stew if (hasRabbitIngredients()) progressQuest() endif elseif (selection == 2) ;check if player has collected ingredients for grilled salmon if (hasSalmonIngredients()) progressQuest() endif elseif (selection == 3) ;check if player has collected ingredients for horker soup if (hasHorkerIngredients()) progressQuest() endif endif endif EndEvent bool Function hasRabbitIngredients() if ((PlayerRef.GetItemCount(FoodRabbit) >= 6) && (PlayerRef.GetItemCount(FoodPotato) >= 4) && (PlayerRef.GetItemCount(Garlic) >= 1) && (PlayerRef.GetItemCount(Ale) >= 1)) return true endif return false EndFunction bool Function hasSalmonIngredients() if ((PlayerRef.GetItemCount(FoodSalmon) >= 6) && (PlayerRef.GetItemCount(FoodPotato) >= 6) && (PlayerRef.GetItemCount(FoodCarrot ) >= 6) && (PlayerRef.GetItemCount(SaltPile) >= 1)) return true endif return false EndFunction bool Function hasHorkerIngredients() if ((PlayerRef.GetItemCount(FoodHorkerMeat) >= 6) && (PlayerRef.GetItemCount(Garlic) >= 3) && (PlayerRef.GetItemCount(Lavender) >= 1) && (PlayerRef.GetItemCount(FoodLeek) >= 1)) return true endif return false EndFunction Function progressQuest() AA92CaptiveAtSea.SetObjectiveCompleted(54) AA92CaptiveAtSea.SetStage(56) AA92CaptiveAtSea.SetObjectiveDisplayed(56) EndFunction
I would love to make this a little verbose, at the moment the player is running blind and doesn't know how they are progressing with their collection of ingredients until they have the complete set.
Any recommendations that you guys have would be greatly appreciated!
Thanks,
Allan