# Lesson Notes — Random Events and Return Visits

- Link: https://doss.academy/course-2-game-design-development-principles/unit-5-game-design-storytelling-nonlinear-narratives/lesson-13-random-events-and-return-visits-c2u5l13/lesson-notes-c2u5l13/
- Published: 2026-11-03T15:49:49-05:00
- Author: matthew.leffler@jefferson.kyschools.us

Course 2: Game Design & Development Principles / Unit 5: Game Design Storytelling&
Nonlinear Narratives / Lesson 13: Random Events and Return Visits

**Save your work every day:** Export your story and save it to Google Drive at the
end of every class. Twine only saves your story in the browser on the laptop you
are using, and you may not get the same laptop next time.

## Lesson overview

Right now your game plays the same way every time the player makes the same choices.
Today you add **random events** so things can change from one playthrough to the
next, and you make passages react when the player **comes back** to them. Both give
your game **replay value**.

## Pick a random word or phrase with (either:)

    ```
    The clerk behind the counter is (either: "smiling", "yawning", "on the phone").
    ```

Each time the passage shows, Twine picks one of the choices.

## Pick a random number with (random:)

    ```
    (set: $wait to (random: 5, 60))
    You wait $wait minutes for your number to be called.
    ```

## Make a random event change the story

    ```
    (set: $roll to (random: 1, 6))
    (if: $roll is 6)[The computer system crashes. Everyone has to wait.]
    (else:)[Your number is called.]
    ```

## React when the player comes back with visits

`visits` counts how many times the player has been in the current passage.

    ```
    (if: visits is 1)[You step into the waiting room for the first time.]
    (else:)[You are back in the waiting room. Nothing has changed.]
    ```

## Check where the player has been with (history:)

`(history:)` is the list of passages the player has already visited.

    ```
    (if: (history:) contains "Check if anyone had made an appointment")[You already know there is no appointment.]
    ```

## Tips

 * Use randomness for flavor and surprises. Keep big outcomes tied to the player’s
   choices so the game feels fair.
 * Play your game several times to see the random events change.

## Your turn

 1. Add at least one `(either:)` to make a passage read differently each time.
 2. Add one random event that changes what happens next.
 3. Use `visits` or `(history:)` so at least one passage changes when the player returns
    or has been somewhere before.
 4. Play your game at least 3 times and note what changed.
 5. Export your story and save it to Google Drive at the end of every class.

## Check your understanding

 1. What is the difference between `(either:)` and `(random:)`?
 2. What does `visits is 1` check?
 3. How does randomness add replay value to your game?

Use this lesson’s Key Terms page to build your glossary.
