A Flow node that waits for a story condition—and knows when to stop
How my WaitNarrativeFact node handles immediate completion, change notifications, cancellation, and cleanup without a polling loop.
A story sequence often needs to pause until some state changes. In NarrativeFramework, WaitNarrativeFact connects that requirement to the fact subsystem through a Flow node.
The interesting part is not just continuing when a condition becomes true. It is handling all the ways waiting can begin and end.
Check before subscribing
StartWaiting first clears any previous bindings. It then resolves the fact subsystem and validates the condition.
If either is unavailable or invalid, the node takes its Error output. If the condition is already satisfied, it takes Satisfied immediately. It only subscribes when there is something left to wait for.
That immediate check matters when a sequence starts after the relevant state has already changed.
Listen to the relevant changes
While waiting, the node binds to the selected fact’s value and definition delegates. Either callback re-evaluates the current condition.
Both notifications matter because a condition can depend on the integer value or on whether the fact exists. The implementation waits for these events rather than repeatedly checking the fact every frame.
Three explicit outcomes
The node exposes Satisfied, Stopped, and Error outputs. A Stop input ends the wait deliberately, which lets the graph distinguish cancellation from successful progression.
Completion goes through one helper: it removes subscriptions before triggering the output. Cleanup also calls the same unbinding routine. Delegate handles are reset and the stored subsystem reference is cleared.
Rebuild the wait after loading
OnLoad_Implementation calls StartWaiting again. The wait is reconstructed by checking the current state and establishing fresh subscriptions, rather than treating old runtime delegate bindings as persistent state.
Make the editor explain the runtime
The node’s editor description shows its condition. Its inspection status can report waiting, immediate satisfaction, or an error. Editor validation checks that the condition uses a registered child tag of Narrative.Fact.
For this node, a useful design boundary is the complete lifecycle: begin, check, subscribe, stop, and clean up. Those steps make the graph’s behavior easier to follow than a single “wait until true” label.
The fact-store design explains the state this node observes.