Bugfix Quest System for Pendant Quest

This commit is contained in:
Philip W 2023-05-15 04:02:05 +01:00
parent 5682929e82
commit 0d7e8c5187
7 changed files with 17 additions and 13 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Content/Levels/Build.umap (Stored with Git LFS)

Binary file not shown.

View File

@ -60,8 +60,9 @@ void UDialogueNPC::NextDialogue()
NextArrow->SetVisibility(ESlateVisibility::SelfHitTestInvisible); NextArrow->SetVisibility(ESlateVisibility::SelfHitTestInvisible);
return; return;
} }
if (CurrentDialogueStringPath[FMath::Clamp(DialogueIndex + 1, 0, CurrentDialogueStringPath.Num() - 1)].Mid(0, 2) == "##") if (CurrentDialogueStringPath[FMath::Clamp(DialogueIndex + 1, 0, CurrentDialogueStringPath.Num() - 1)].Mid(0, 2) == "--")
{ {
UE_LOG(LogTemp, Warning, TEXT("DialogueIndex: %d"), UKismetStringLibrary::Conv_StringToInt(CurrentDialogueStringPath[DialogueIndex].RightChop(3)));
Cast<UQuestSystem>(GetWorld()->GetFirstPlayerController()->GetPawn()->GetComponentByClass(UQuestSystem::StaticClass()))->AddQuest(Quests[UKismetStringLibrary::Conv_StringToInt(CurrentDialogueStringPath[DialogueIndex].RightChop(3))]); Cast<UQuestSystem>(GetWorld()->GetFirstPlayerController()->GetPawn()->GetComponentByClass(UQuestSystem::StaticClass()))->AddQuest(Quests[UKismetStringLibrary::Conv_StringToInt(CurrentDialogueStringPath[DialogueIndex].RightChop(3))]);
DialogueIndex++; DialogueIndex++;
} }
@ -142,6 +143,9 @@ void UDialogueNPC::TickComponent(float DeltaTime, ELevelTick TickType, FActorCom
void UDialogueNPC::StartDialogue() void UDialogueNPC::StartDialogue()
{ {
Quests.Empty(); Quests.Empty();
BlueprintFunctions.Empty();
ItemIndexes.Empty();
QuestFlags.Empty();
FOutputDeviceNull AR; FOutputDeviceNull AR;
const FString Command = FString::Printf(TEXT("SetRootDialoguePath")); const FString Command = FString::Printf(TEXT("SetRootDialoguePath"));
GetOwner()->CallFunctionByNameWithArguments(*Command, AR, nullptr, true); GetOwner()->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
@ -216,7 +220,7 @@ void UDialogueNPC::AddChoices(UDialoguePath* ParentPath, FText ChoiceText1, FTex
UDialoguePath* UDialogueNPC::AddQuest(UDialoguePath* DialoguePath, UQuest* Quest) UDialoguePath* UDialogueNPC::AddQuest(UDialoguePath* DialoguePath, UQuest* Quest)
{ {
DialoguePath->Dialogue.Add(FText::FromString("## " + Quests.Num()).ToString()); DialoguePath->Dialogue.Add(FText::FromString("-- " + FString::FromInt(Quests.Num())).ToString());
Quests.Add(Quests.Num(), Quest); Quests.Add(Quests.Num(), Quest);
return DialoguePath; return DialoguePath;
} }