Exposed Quest Flags to Dialogue System
This commit is contained in:
parent
fc9597ed33
commit
daaa624dd9
BIN
Content/Blueprints/Quests/Quest_SistersPendant.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Quests/Quest_SistersPendant.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Dialogue/SM_Merchant_Blueprint.uasset
(Stored with Git LFS)
BIN
Content/Dialogue/SM_Merchant_Blueprint.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Levels/Build.umap
(Stored with Git LFS)
BIN
Content/Levels/Build.umap
(Stored with Git LFS)
Binary file not shown.
@ -6,6 +6,7 @@
|
|||||||
#include "Components/TextBlock.h"
|
#include "Components/TextBlock.h"
|
||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
#include "Kismet/KismetStringLibrary.h"
|
#include "Kismet/KismetStringLibrary.h"
|
||||||
|
#include "Misc/OutputDeviceNull.h"
|
||||||
#include "the_twilight_abyss/Quest/QuestSystem.h"
|
#include "the_twilight_abyss/Quest/QuestSystem.h"
|
||||||
|
|
||||||
// Sets default values for this component's properties
|
// Sets default values for this component's properties
|
||||||
@ -115,6 +116,9 @@ void UDialogueNPC::TickComponent(float DeltaTime, ELevelTick TickType, FActorCom
|
|||||||
|
|
||||||
void UDialogueNPC::StartDialogue()
|
void UDialogueNPC::StartDialogue()
|
||||||
{
|
{
|
||||||
|
FOutputDeviceNull AR;
|
||||||
|
const FString Command = FString::Printf(TEXT("SetRootDialoguePath"));
|
||||||
|
GetOwner()->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
|
||||||
if (IsValid(RootDialoguePath)) CurrentDialogueStringPath = RootDialoguePath->Dialogue;
|
if (IsValid(RootDialoguePath)) CurrentDialogueStringPath = RootDialoguePath->Dialogue;
|
||||||
if (CurrentDialogueStringPath.IsEmpty())
|
if (CurrentDialogueStringPath.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -162,8 +166,8 @@ void UDialogueNPC::EndDialogue()
|
|||||||
|
|
||||||
UDialoguePath* UDialogueNPC::CreateRootDialoguePath()
|
UDialoguePath* UDialogueNPC::CreateRootDialoguePath()
|
||||||
{
|
{
|
||||||
RootDialoguePath = NewObject<UDialoguePath>();
|
//RootDialoguePath = NewObject<UDialoguePath>();
|
||||||
return RootDialoguePath;
|
return NewObject<UDialoguePath>();
|
||||||
}
|
}
|
||||||
|
|
||||||
UDialoguePath* UDialogueNPC::AddDialogue(UDialoguePath* DialoguePath, FText TextInput)
|
UDialoguePath* UDialogueNPC::AddDialogue(UDialoguePath* DialoguePath, FText TextInput)
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
UPROPERTY(EditAnywhere)
|
UPROPERTY(EditAnywhere)
|
||||||
FString NPCName;
|
FString NPCName;
|
||||||
|
|
||||||
UPROPERTY()
|
UPROPERTY(BlueprintReadWrite)
|
||||||
UDialoguePath* RootDialoguePath;
|
UDialoguePath* RootDialoguePath;
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
UDialoguePath* CurrentDialoguePath;
|
UDialoguePath* CurrentDialoguePath;
|
||||||
|
@ -34,6 +34,10 @@ public:
|
|||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Instanced)
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Instanced)
|
||||||
TArray<UBaseItem*> Rewards;
|
TArray<UBaseItem*> Rewards;
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
|
TMap<FString, bool> QuestFlagsOnAdd;
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
|
TMap<FString, bool> QuestFlagsOnComplete;
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
bool bShowQuestCompletedNotification = true;
|
bool bShowQuestCompletedNotification = true;
|
||||||
|
|
||||||
bool CheckConditions(UWorldState* WorldState) const;
|
bool CheckConditions(UWorldState* WorldState) const;
|
||||||
|
@ -60,6 +60,10 @@ void UQuestSystem::CheckActiveQuestConditions()
|
|||||||
{
|
{
|
||||||
CompletedQuests.Add(Quest);
|
CompletedQuests.Add(Quest);
|
||||||
Quest->ApplyRewards(PlayerInventory);
|
Quest->ApplyRewards(PlayerInventory);
|
||||||
|
for (TTuple<FString, bool> QuestFlag : Quest->QuestFlagsOnComplete)
|
||||||
|
{
|
||||||
|
QuestFlags.Add(QuestFlag.Key, QuestFlag.Value);
|
||||||
|
}
|
||||||
QuestCompletionTitle->SetText(Quest->Title);
|
QuestCompletionTitle->SetText(Quest->Title);
|
||||||
if (Quest->QuestLine == EQuestLine::Sub)
|
if (Quest->QuestLine == EQuestLine::Sub)
|
||||||
{
|
{
|
||||||
@ -90,6 +94,10 @@ bool UQuestSystem::AddQuest(UQuest* Quest)
|
|||||||
if (HasActiveQuest(Quest)) return false;
|
if (HasActiveQuest(Quest)) return false;
|
||||||
if (!Quest->CheckPreConditions(GetWorldState())) return false;
|
if (!Quest->CheckPreConditions(GetWorldState())) return false;
|
||||||
ActiveQuests.Add(Quest);
|
ActiveQuests.Add(Quest);
|
||||||
|
for (TTuple<FString, bool> QuestFlag : Quest->QuestFlagsOnAdd)
|
||||||
|
{
|
||||||
|
QuestFlags.Add(QuestFlag.Key, QuestFlag.Value);
|
||||||
|
}
|
||||||
if (Quest->QuestLine == EQuestLine::Sub)
|
if (Quest->QuestLine == EQuestLine::Sub)
|
||||||
{
|
{
|
||||||
bHasSubQuest = true;
|
bHasSubQuest = true;
|
||||||
@ -123,6 +131,12 @@ bool UQuestSystem::HasActiveQuest(UQuest* Quest) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UQuestSystem::HasQuestFlag(FString FlagName) const
|
||||||
|
{
|
||||||
|
if (QuestFlags.Contains(FlagName)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void UQuestSystem::UpdateQuestGoalsUI(const UQuest* Quest) const
|
void UQuestSystem::UpdateQuestGoalsUI(const UQuest* Quest) const
|
||||||
{
|
{
|
||||||
FString GoalsText;
|
FString GoalsText;
|
||||||
|
@ -61,6 +61,8 @@ public:
|
|||||||
bool CheckPreConditions(UQuest* Quest) const;
|
bool CheckPreConditions(UQuest* Quest) const;
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
bool HasActiveQuest(UQuest* Quest) const;
|
bool HasActiveQuest(UQuest* Quest) const;
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
bool HasQuestFlag(FString FlagName) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UInventoryComponent* PlayerInventory;
|
UInventoryComponent* PlayerInventory;
|
||||||
|
Loading…
Reference in New Issue
Block a user