Thanks for this it makes sense.
Still wondering HOW to make it work with unity(my designer ask me ok, How do i set this up)
I want to create a quest with 2 obj.
LIKE IN THE SLIDES
What scripts need to be on what gameObjects?
Can I complete an Objective From a PIckup gemaObject?
I am unable to answer my designers because I have not seen a complete example.
If I had I would be able to make that SLIDE SHOW correctly.
Seems we have TWO places to evaluate
my PredicateEnum has 4 things
public enum PredicateEnum
{
None,
HasQuest,
HasInventoryItem,
HasInventoryItems,
CompletedQuest
}
Of the 4 that would require thought
QuestList should handle HasQuest and CompleteQuest.
ok… Which character should be dragged into the dialogue trigger in order to have the QuestList available?
What script should be dragged under the dialogue trigger?
Inventory should handle HasInventoryItem or HasInventoryItems
ok… Which character should be dragged into the dialogue trigger in order to have the Inventory script available?
What script should be dragged under the dialogue trigger?
not to mention what needs to be on what dialogue node… I will get to that later when I understand better how to set up the HIERARCHY, I have to get those slides together so my designer knows how to use what we have.
1 step at a time.
Thanks for your help on this Brian
QuestList.cs
public bool? Evaluate(PredicateEnum predicate, string[] parameters)
{
switch (predicate)
{
case PredicateEnum.HasQuest:
return HasQuest(Quest.GetByName(parameters[0]));
// case PredicateEnum.HasInventoryItem:
// return HasQuest(Quest.GetByName(parameters[0]));
case PredicateEnum.CompletedQuest:
if(parameters[0]==null) return false;
Quest questToTest = Quest.GetByName(parameters[0]);
if(questToTest==null) return false;
if(!HasQuest(questToTest)) return false;
return GetQuestStatus(Quest.GetByName(parameters[0])).IsComplete();
case PredicateEnum.None:
return null;
}
return null;
}
Inventory.cs
public bool? Evaluate(PredicateEnum predicate, string[] parameters)
{
//Debug.Log($"Evaluate the Inventory.cs: {predicate}");
switch (predicate)
{
case PredicateEnum.HasInventoryItem:
//Debug.Log($"Evaluate the Inventory.cs: {parameters[0]}");
Debug.Log($"HasItem is: {HasItem(InventoryItem.GetFromID(parameters[0]))} and its ID is {parameters[0]}");
return HasItem(InventoryItem.GetFromID(parameters[0]));
case PredicateEnum.HasInventoryItems:
// Debug.Log($"Evaluate the Inventory.cs: {parameters[0]}");
// Debug.Log($"HasItem is: {HasItem(InventoryItem.GetFromID(parameters[0]))}");
int quantity = 0;
if(int.TryParse(parameters[1], out quantity))
{
Debug.Log($"quantity = {quantity}");
}
int slot;
InventoryItem item = InventoryItem.GetFromID(parameters[0]);
if (HasItem(item, out slot))
{
if(GetNumberInSlot(slot) < int.Parse(parameters[1]))
{
return false;
}
}
else
{
return false;
}
return true;
//return HasItem(InventoryItem.GetFromID(parameters[0]));
}
return null;
}