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))]);
|
||||
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++;
|
||||
NextArrow->SetVisibility(ESlateVisibility::Hidden);
|
||||
@ -201,6 +208,13 @@ UDialoguePath* UDialogueNPC::AddQuest(UDialoguePath* DialoguePath, UQuest* Quest
|
||||
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()
|
||||
{
|
||||
CurrentDialoguePath = CurrentDialoguePath->Choices[0];
|
||||
|
@ -94,6 +94,8 @@ private:
|
||||
|
||||
UPROPERTY()
|
||||
TMap<int, UQuest*> Quests;
|
||||
UPROPERTY()
|
||||
TMap<int, FString> BlueprintFunctions;
|
||||
|
||||
void ResetDialogueUI();
|
||||
|
||||
@ -118,6 +120,9 @@ public:
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
UDialoguePath* AddQuest(UDialoguePath* DialoguePath, UQuest* Quest);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
UDialoguePath* CallBlueprintFunction(UDialoguePath* DialoguePath, FString FunctionName);
|
||||
|
||||
UFUNCTION()
|
||||
void Choice1();
|
||||
|
Loading…
Reference in New Issue
Block a user