Storyfall

Branch Choices

Branch choices let a single choice route to different scenes based on the player’s state — a skill check, a dice roll, a random chance, or a formula. Instead of stacking multiple conditional “continue” choices, you define one choice with several branches, each with its own target scene and its own rules.

When to Use Branch Choices

  • Skill checks: Pick the lock if lockpicking > 10, otherwise trigger an alarm.
  • Dice rolls: Roll a d20 into a variable, then branch to “critical hit”, “hit”, or “miss” scenes.
  • Probability: 30% chance of finding treasure, 70% chance of finding nothing.
  • Stat-based chance: 0.5 + charisma * 0.02 — smoother stat scaling than a hard threshold.
  • N-way splits: Route a single “Investigate” choice to four or five different outcomes without cluttering the scene with conditionals.

How Branches Work

A branch choice has a list of branches, evaluated in order from top to bottom. Each branch has:

  • A target scene — where the player goes if this branch is picked.
  • Optional conditions — the branch is skipped if they don’t pass.
  • Optional probability — the branch fires a percentage of the time (or uses a formula).

The last branch is always “Otherwise” — no conditions, no probability. It’s the mandatory fallback, so exactly one branch always matches. You can’t delete the Otherwise branch, but you can change its target.

At play time, Storyfall walks the branches top to bottom and picks the first one whose conditions pass and (if probability is set) wins its roll. Everything below it is ignored.

Creating a Branch Choice

  1. Add a new choice on your scene.
  2. Open the choice type dropdown and pick Branch.
  3. The editor replaces the single target scene with a Branches section and auto-creates an empty branch plus an Otherwise branch.
  4. Configure each branch:
    • Click its scene picker to set the target.
    • Click Conditions to add condition checks (e.g. strength > 10).
    • Use the probability widget to set “Always”, a percentage (e.g. 30%), or a formula.
  5. Click Add branch to add more branches. The Otherwise branch stays at the bottom.

Probability Modes

The probability widget supports three modes:

ModeExampleBehavior
Always(no probability)Branch always fires if its conditions pass.
Percent30%Branch has a flat 30% chance when reached.
Formula0.5 + charisma * 0.02Branch chance scales with a variable.

Formulas may reference story variables directly by name and support +, -, *, /.

Dice Rolls

Dice rolls are done with a regular effect on the choice (not a branch-native feature):

  1. On the branch choice, add an effect that sets a number variable to a random roll (e.g. rollResult = 1 + floor(random * 20) for a d20).
  2. On each branch, add a condition that checks the variable:
    • Branch 1: IF rollResult >= 18 → Critical hit
    • Branch 2: IF rollResult >= 10 → Normal hit
    • Otherwise → Miss

The roll effect fires when the player picks the choice; branches then use its result to route.

What Players See

  • Condition-only routing is silent — the player just lands in a scene, with no indication that a branch was evaluated. This is ideal for skill checks where you don’t want to break immersion.
  • Probability-based routing briefly flashes a dice roll indicator (🎲 Chance roll...) before the next scene loads, so the random element is visible.
  • Effects and their toasts (e.g. +5 reputation) show as they normally would.

Tips

  • You don’t have to use probability. A branch choice with pure condition branches is a great way to express skill checks cleanly.
  • The Otherwise branch can route back to the current scene (using the scene picker) for “nothing happens” outcomes.
  • Branches can be reordered — the order matters because evaluation is top-down.
  • Combine conditions and probability on the same branch — for example, only fire the critical-hit branch when the player has the “sharp blade” item AND a 20% chance hits.

Story Tree View

In the Story Tree, a branch choice renders one edge per branch, each labeled with its criteria:

  • Conditions: IF lockpicking > 10 (amber)
  • Probability: 30% (blue)
  • Otherwise: Otherwise (muted)

This makes it easy to see at a glance how a branch choice fans out.

Next Steps