-
Notifications
You must be signed in to change notification settings - Fork 0
Programming Guide
Michael Adaixo edited this page Dec 28, 2023
·
14 revisions
Each TaskNode will finish when its Tick() method returns anything different than EFPNodeREsult::InProgress. If you don't override FPTaskNode::Tick(), the task will automatically Succeed after entering. If you need to wait, you have to override this method, and return your own value. See FPTask_Delay or other for reference.
UFPNode
// UFPNode
virtual void Setup(FFlowContext* InContext);
//~UFPNode
This is called once at the start of FlowPilot execution, for all Tasks in the FlowPilot Asset.
UFPTaskNode
// UFPTaskNode
virtual bool Enter();
virtual EFPNodeResult Tick(float DeltaTime);
virtual void Exit();
virtual void Abort();
virtual bool HasChildNodes() const { return false; }
virtual void GetChildNodes(TArray<TObjectPtr<UFPTaskNode>>& OutChildNodes) PURE_VIRTUAL(,)
virtual uint32 GetNumChildNodes() const { return 0; }
//~UFPTaskNode
Example "Open Door" interation
UCLASS(DisplayName="Interaction | Open Door")
class MYGAME_API UFPTask_OpenDoor : public UFPTaskNode
{
GENERATED_BODY()
public:
UFPTask_OpenDoor();
virtual void Setup(FFlowContext* InContext) override;
virtual bool Enter() override;
protected:
// First Actor Tag
UPROPERTY(EditAnywhere, Category = "Flow Pilot")
FFlowActorReference ActorReference;
private:
};
This Task doesn't tick and will return Success automatically after Enter() is called, on the next Tick frame.
Example Implementation:
bool UFPTask_OpenDoor::Enter()
{
AActor* Actor = FindActor(ActorReference);
if (!IsValid(Actor))
{
return false;
}
ASingleDoor* SingleDoor = Cast<ASingleDoor>(Actor);
if(!IsValid(SingleDoor))
{
return false;
}
return SingleDoor->OpenDoor(GetFlowOwningActor());
}
To make a new FlowPilot Class in Blueprint.
- Create new Blueprint.
- Select
FPTask_BlueprintBaseorFPInstant_BlueprintBase

- Implement needed virtual methods with implementation details.

- Add need variables. For example, you'll want to add
FFlowActorReferencesso that you can tap into the FlowPilot System, of finding actors on scene, track and finding them via GameplayTags.

Example implemetation of Turning an Array of Lights On/Off

- Setup and Profit

Discord Server : https://discord.gg/sF9KjZ9qqj