MF Story Driver
A seed that stays put and a step counter that moves — for multi-shot storytelling
- step_int
- step_str
- projectName
- saveFolder
- storySeed
Multi-shot storytelling has a contradiction at its heart: you want every shot in the story to share one seed (so the character and style stay consistent), but you also want a counter that ticks forward so each shot is numbered and distinct. MF Story Driver (MF_StoryDriver) packages both: a per-project seed that holds steady, and an auto-incrementing step counter that advances on every execution. It's the companion to MF Story Sequence (MF_ShotHelper) in the MF PipoNodes pack (pierreb-mf / Moment Factory), and it's the pack's most opinionated node.
How it works
Three inputs:
projectName- the project identifier, and the key your state lives under."My Story"gets sanitized toMy_Storyin outputs.storySeed- your seed, an INT up to 2^64−1. The frontend rolls a fresh one for you when you create the node, then it's just a normal input field you can type over.randomize_seed_on_reset- a boolean, on by default, controlling whether the seed changes when you hit reset.
Five outputs:
step_int/step_str- the current step, starting at 0, incremented after each execution.projectName- the sanitized name (spaces → underscores).saveFolder-MyStory_123456789- the project name plus seed. Built for wiring into your output path.storySeed- the seed, for wiring into a KSampler.
The canonical wiring is short and lives in the pack's README: storySeed → KSampler seed, step_int → filename, saveFolder → save path. Every render shares a seed, every render gets a unique number, and all of them land in one folder. Add a reset button (a 🔄 Reset Story button on the node, which posts to the pack's /story_driver/reset API) to start a new story - with randomize_seed_on_reset on, that also rolls a fresh seed, which is exactly what you want between stories rather than between steps.
The gotcha that matters
The README claims state is persisted to a story_driver_state.json file across sessions. The shipped code doesn't do that. The step counter is a plain in-memory dictionary keyed by project name - no file, no disk. Step back to zero the moment you restart ComfyUI. The seed survives (it's a normal widget value saved in your workflow), but step progression does not. It's a stale-docs case the source outranks, and it changes how you plan a long render: if a batch is going to outlive your uptime, the counter restarts at 0 and your filenames collide. Plan to finish a story in one session, or log step_int with MF Save Log File so you can rebuild it.
Install
cd ComfyUI/custom_nodes/
git clone https://github.com/pierreb-mf/ComfyUI-MF-PipoNodes
cd ComfyUI-MF-PipoNodes
pip install -r requirements.txt
Restart after (or ComfyUI Manager → "MF PipoNodes"). The reset button needs the pack's aiohttp server routes; without them the node still works, the button just does nothing.
Gotchas
- Step counter is in-memory. Restart = back to step 0. The seed and folder name survive; the count doesn't.
- Each project name is its own counter. Same node, two project names, two independent step sequences - handy for multi-project work, confusing if you typo the name and silently start a fresh count.
saveFolderembeds the seed, so changing the seed mid-story changes the output folder too. Set the seed first, then render.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| projectName | STRING | MyProject | — |
| storySeed | INT | 00–18446744073709550000 | — |
| randomize_seed_on_reset | BOOLEAN | true | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| step_int | INT | — |
| step_str | STRING | — |
| projectName | STRING | — |
| saveFolder | STRING | — |
| storySeed | INT | — |