-
Notifications
You must be signed in to change notification settings - Fork 0
Programming Guide
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.
See [InsertPage] FlowPilot Architecture page for lifecycle reference.
// UFPNode
// One time setup at the start of the FlowPilot Execution.
virtual void Setup(FFlowContext* InContext);
//~UFPNode
This is called once at the start of FlowPilot execution, for all Tasks in the FlowPilot Asset.
// UFPTaskNode
// Called when starting this Node. Returns true on success
virtual bool Enter();
// Called on Tick. Will success automatically if not implemented by Child classes
virtual EFPNodeResult Tick(float DeltaTime);
// Called when Tick returns Succeeds
virtual void Exit();
// Called when FlowPilotComponent calls Abort.
virtual void Abort();
// !! Implement if Task has Child TaskNodes !!
// Returns true if has ChildNodes
virtual bool HasChildNodes() const { return false; }
// Returns the list of ChildNodes
virtual void GetChildNodes(TArray<TObjectPtr<UFPTaskNode>>& OutChildNodes) PURE_VIRTUAL(,)
// Returns the number of ChildNodes
virtual uint32 GetNumChildNodes() const { return 0; }
//~UFPTaskNode
// UFPInstantNode
// Called when FPTaskNode calls OnExit or OnEnter
virtual void Execute() {};
//~UFPInstantNode
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