Updated Dialogue System to Call Custom Blueprint Functions
This commit is contained in:
parent
2ddb44d070
commit
fea2ccface
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.
@ -64,6 +64,13 @@ void UDialogueNPC::NextDialogue()
|
|||||||
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++;
|
||||||
}
|
}
|
||||||
|
else if (CurrentDialogueStringPath[FMath::Clamp(DialogueIndex + 1, 0, CurrentDialogueStringPath.Num() - 1)].Mid(0, 2) == "@@")
|
||||||
|
{
|
||||||
|
FOutputDeviceNull AR;
|
||||||
|
const FString Command = BlueprintFunctions[UKismetStringLibrary::Conv_StringToInt(CurrentDialogueStringPath[DialogueIndex].RightChop(3))];;
|
||||||
|
GetOwner()->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
|
||||||
|
DialogueIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
DialogueIndex++;
|
DialogueIndex++;
|
||||||
NextArrow->SetVisibility(ESlateVisibility::Hidden);
|
NextArrow->SetVisibility(ESlateVisibility::Hidden);
|
||||||
@ -201,6 +208,13 @@ UDialoguePath* UDialogueNPC::AddQuest(UDialoguePath* DialoguePath, UQuest* Quest
|
|||||||
return DialoguePath;
|
return DialoguePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UDialoguePath* UDialogueNPC::CallBlueprintFunction(UDialoguePath* DialoguePath, const FString FunctionName)
|
||||||
|
{
|
||||||
|
DialoguePath->Dialogue.Add(FText::FromString("@@ " + FunctionName).ToString());
|
||||||
|
BlueprintFunctions.Add(BlueprintFunctions.Num(), FunctionName);
|
||||||
|
return DialoguePath;
|
||||||
|
}
|
||||||
|
|
||||||
void UDialogueNPC::Choice1()
|
void UDialogueNPC::Choice1()
|
||||||
{
|
{
|
||||||
CurrentDialoguePath = CurrentDialoguePath->Choices[0];
|
CurrentDialoguePath = CurrentDialoguePath->Choices[0];
|
||||||
|
@ -94,6 +94,8 @@ private:
|
|||||||
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
TMap<int, UQuest*> Quests;
|
TMap<int, UQuest*> Quests;
|
||||||
|
UPROPERTY()
|
||||||
|
TMap<int, FString> BlueprintFunctions;
|
||||||
|
|
||||||
void ResetDialogueUI();
|
void ResetDialogueUI();
|
||||||
|
|
||||||
@ -118,6 +120,9 @@ public:
|
|||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
UDialoguePath* AddQuest(UDialoguePath* DialoguePath, UQuest* Quest);
|
UDialoguePath* AddQuest(UDialoguePath* DialoguePath, UQuest* Quest);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
UDialoguePath* CallBlueprintFunction(UDialoguePath* DialoguePath, FString FunctionName);
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void Choice1();
|
void Choice1();
|
||||||
|
Loading…
Reference in New Issue
Block a user