Refresh Visibility¶
Prefix Blueprint variables with DEPRECATED_
Create the vairables in C++
UPROPERTY(EditAnywhere, BlueprintReadOnly)
FName QuestName;
UPROPERTY(EditAnywhere, BlueprintReadOnly)
int32 ShowAtProgress = 0;
In stage viewport find the quest markers, copy and paste Bp Quest Name to Quest Name
Do the same thing for Show at Progress
In QuestMarker:
add #include
#include "QuestManager.h"
Add UFUNCTION GetQuestManager
UFUNCTION(BlueprintPure, BlueprintImplementableEvent)
AQuestManager* GetQuestManager() const;
Override GetQuestManager in Blueprint by actually calling GetQuestManager from BP Library.
Implement GetQuest
QuestManager.h
UFUNCTION(BlueprintPure)
FQuestInfo GetQuest(FName Name) const;
QuestManager.cpp
FQuestInfo AQuestManager::GetQuest(FName Name) const
{
return QuestList[GetQuestIndex(Name)];
}
Note, because GetQuest is a const, we’ll need to make GetQuestIndex a const too
BP now compiles with error because GetQuest is const, but GetQuests is not. So let’s make GetQuests const.
Implement RefreshVisibility
QuestMarker.h
UFUNCTION(BlueprintCallable)
void RefreshVisibility();
QuestMarker.cpp
void AQuestMarker::RefreshVisibility()
{
FQuestInfo Quest = GetQuestManager()->GetQuest(QuestName);
bool Visibility = GetQuestManager()->IsActiveQuest(QuestName) && Quest.Progress == ShowAtProgress;
ParticleSystem->SetVisibility(Visibility);
}
Delete BP_QuestName and BP_ShowAtProgress