Refresh Visibility

  1. Prefix Blueprint variables with DEPRECATED_

  2. Create the vairables in C++

UPROPERTY(EditAnywhere, BlueprintReadOnly)
FName QuestName;

UPROPERTY(EditAnywhere, BlueprintReadOnly)
int32 ShowAtProgress = 0;
  1. In stage viewport find the quest markers, copy and paste Bp Quest Name to Quest Name

../../_images/find_quest_markers.PNG ../../_images/copy_paste_quest_name.PNG
  1. Do the same thing for Show at Progress

  2. In QuestMarker:

add #include

#include "QuestManager.h"

Add UFUNCTION GetQuestManager

UFUNCTION(BlueprintPure, BlueprintImplementableEvent)
AQuestManager* GetQuestManager() const;
  1. Override GetQuestManager in Blueprint by actually calling GetQuestManager from BP Library.

../../_images/get_quest_manager.PNG
  1. 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

  1. BP now compiles with error because GetQuest is const, but GetQuests is not. So let’s make GetQuests const.

../../_images/make_get_quests_const.PNG
  1. 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);
}
  1. Delete BP_QuestName and BP_ShowAtProgress