Skip to content

Programming Guide

Michael Adaixo edited this page Dec 28, 2023 · 14 revisions

FlowPilot Task Node

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.

New FlowPilot Task Node Class

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());
}

New BluePrint based FP Class

Clone this wiki locally