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 "GameFramework/Character.h"
|
||||
#include "Kismet/KismetStringLibrary.h"
|
||||
#include "Misc/OutputDeviceNull.h"
|
||||
#include "the_twilight_abyss/Quest/QuestSystem.h"
|
||||
|
||||
// Sets default values for this component's properties
|
||||
@ -115,6 +116,9 @@ void UDialogueNPC::TickComponent(float DeltaTime, ELevelTick TickType, FActorCom
|
||||
|
||||
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 (CurrentDialogueStringPath.IsEmpty())
|
||||
{
|
||||
@ -162,8 +166,8 @@ void UDialogueNPC::EndDialogue()
|
||||
|
||||
UDialoguePath* UDialogueNPC::CreateRootDialoguePath()
|
||||
{
|
||||
RootDialoguePath = NewObject<UDialoguePath>();
|
||||
return RootDialoguePath;
|
||||
//RootDialoguePath = NewObject<UDialoguePath>();
|
||||
return NewObject<UDialoguePath>();
|
||||
}
|
||||
|
||||
UDialoguePath* UDialogueNPC::AddDialogue(UDialoguePath* DialoguePath, FText TextInput)
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
UPROPERTY(EditAnywhere)
|
||||
FString NPCName;
|
||||
|
||||
UPROPERTY()
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
UDialoguePath* RootDialoguePath;
|
||||
UPROPERTY()
|
||||
UDialoguePath* CurrentDialoguePath;
|
||||
|
@ -34,6 +34,10 @@ public:
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Instanced)
|
||||
TArray<UBaseItem*> Rewards;
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
TMap<FString, bool> QuestFlagsOnAdd;
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
TMap<FString, bool> QuestFlagsOnComplete;
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
bool bShowQuestCompletedNotification = true;
|
||||
|
||||
bool CheckConditions(UWorldState* WorldState) const;
|
||||
|
@ -60,6 +60,10 @@ void UQuestSystem::CheckActiveQuestConditions()
|
||||
{
|
||||
CompletedQuests.Add(Quest);
|
||||
Quest->ApplyRewards(PlayerInventory);
|
||||
for (TTuple<FString, bool> QuestFlag : Quest->QuestFlagsOnComplete)
|
||||
{
|
||||
QuestFlags.Add(QuestFlag.Key, QuestFlag.Value);
|
||||
}
|
||||
QuestCompletionTitle->SetText(Quest->Title);
|
||||
if (Quest->QuestLine == EQuestLine::Sub)
|
||||
{
|
||||
@ -90,6 +94,10 @@ bool UQuestSystem::AddQuest(UQuest* Quest)
|
||||
if (HasActiveQuest(Quest)) return false;
|
||||
if (!Quest->CheckPreConditions(GetWorldState())) return false;
|
||||
ActiveQuests.Add(Quest);
|
||||
for (TTuple<FString, bool> QuestFlag : Quest->QuestFlagsOnAdd)
|
||||
{
|
||||
QuestFlags.Add(QuestFlag.Key, QuestFlag.Value);
|
||||
}
|
||||
if (Quest->QuestLine == EQuestLine::Sub)
|
||||
{
|
||||
bHasSubQuest = true;
|
||||
@ -123,6 +131,12 @@ bool UQuestSystem::HasActiveQuest(UQuest* Quest) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UQuestSystem::HasQuestFlag(FString FlagName) const
|
||||
{
|
||||
if (QuestFlags.Contains(FlagName)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void UQuestSystem::UpdateQuestGoalsUI(const UQuest* Quest) const
|
||||
{
|
||||
FString GoalsText;
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
bool CheckPreConditions(UQuest* Quest) const;
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool HasActiveQuest(UQuest* Quest) const;
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool HasQuestFlag(FString FlagName) const;
|
||||
|
||||
private:
|
||||
UInventoryComponent* PlayerInventory;
|
||||
|
Loading…
Reference in New Issue
Block a user