Mode Selection

In most machines there are multiple modes which can start but you need to shoot and/or select them first. This usually serves multiple purposes: First, it gives the player options and allows different play styles. Second, it prevents all modes from starting at once. We will create a selection/qualification mode which then starts a game mode (or sometimes two). This selection mode usually runs all the time and provides the following functionality:

  • Track whether a mode can be qualified/selected or not. Usually you cannot qualify for a mode while a game mode is running.
  • When modes can be qualified:
    • Indicate the progress on qualification of modes
    • or: Indicate the current selection which would be started
  • Start a mode and wait until it is done (no more selection/qualification possible in the meantime)
  • Indicate which modes are already completed (often also active during game modes)

If you got multiple modes which can be selected AND started independently you probably need two selection modes which run independently.

We assume that you already defined your switches of your shots. Additionally, we assume that you defined sequence_shots in case your shots require multiple shots to be hit in order. You should be famililar with the events posted by a successful hit of your playfield shots (those do not have to be defined as shots in your config). Usually you will use either my_switch_active for a single switch called my_switch (e.g. a standup target) or my_sequence_shot_hit for a sequence_shots called my_sequence_shot.

There are generally two types of mode selection:

  • Selection by making a shot. This ususally happens during the game.
  • Selection using flipper/action/start buttons after hitting a scoop or on ball start. In those cases you have to delay the eject of the ball (see below for an example how to do that).

Please let us know if you got a snippet which might be useful for other users and is missing here. We would be very happy to include it.

Common types of selection modes:

Select by hitting shot X times

A very common style to qualify and select modes is to light a few shots and once a player has made them a few times start the mode which belongs to the shot. This selection style is used in machines such as Stern Batman DK (2008) or Stern Starwars (2017).

This is an example:

# mode: left_ramp
mode:
  start_events: start_mode_left_ramp
  stop_events: stop_mode_left_ramp

event_player:
  left_ramp_complete: stop_mode_left_ramp, enable_qualify

# mode: right_ramp
mode:
  start_events: start_mode_right_ramp
  stop_events: stop_mode_right_ramp

event_player:
  right_ramp_complete: stop_mode_right_ramp, enable_qualify

# mode: qualify
mode:
  start_events: ball_started

counters:
  left_ramp_qualify_counter:
    starting_count: 0
    count_complete_value: 3
    events_when_complete: disable_qualify, start_mode_left_ramp
    enable_events: enable_qualify
    disable_events: disable_qualify
    start_enabled: True
    persist_state: True
    reset_on_complete: False
    restart_events: reset_qualify_modes
    count_events: left_ramp_hit
  right_ramp_qualify_counter:
    starting_count: 0
    count_complete_value: 3
    events_when_complete: disable_qualify, start_mode_right_ramp
    enable_events: enable_qualify
    disable_events: disable_qualify
    start_enabled: True
    persist_state: True
    reset_on_complete: False
    restart_events: reset_qualify_modes
    count_events: right_ramp_hit

This very basic example should be sufficient for a lot of machines. Another option here is to add achievments and have those enable/disable the counters. The advantage of that is that you can use achievement_groups: to track completion of combinations modes (e.g. completions of rows in Stern Starwars). You can also do that with condition events or accruals:.

You probably want to integrate shows with the logic blocks next.

Select mode and start by shot

There are multiple options to implement a selection carousel.

Using Achivement Groups

You can define multiple groups of achievements and rotate them:

# mode: left_ramp
mode:
  start_events: start_mode_left_ramp
  stop_events: stop_mode_left_ramp

event_player:
  left_ramp_complete: stop_mode_left_ramp, enable_qualify

# mode: right_ramp
mode:
  start_events: start_mode_right_ramp
  stop_events: stop_mode_right_ramp

event_player:
  right_ramp_complete: stop_mode_right_ramp, enable_qualify

# mode: qualify
mode:
  start_events: ball_started

achievements:
    left_ramp:
        show_tokens:
            leds: l_left_ramp
        show_when_enabled: off
        show_when_selected: flash
        show_when_completed: on
        complete_events: stop_mode_left_ramp
        events_when_started: start_mode_left_ramp

    right_ramp:
        show_tokens:
            leds: l_right_ramp
        show_when_enabled: off
        show_when_selected: flash
        show_when_completed: off
        complete_events: stop_mode_right_ramp
        events_when_started: start_mode_right_ramp

achievement_groups:
    all_achievements:
        achievements:
            left_ramp
            right_ramp
        auto_select: yes
        start_selected_events: hit_scoop
        rotate_right_events: s_action_button_active
        enable_events: enable_qualify, ball_started
        debug: True

This is a very flexible way to achieve this.

Select a mode at the start of ball 1

Use this to delay the start of a player’s first ball until they select a mode:

#config_version=5
mode:
  start_events: ball_ended
  stop_events: ball_started
  priority: 100
  game_mode: false   # this is needed to interfere with game start

queue_relay_player:
  player_turn_starting{player.ball==0}:
    post: show_mode_selection       # use this event to enable selection
    wait_for: selection_mode_ended  # make sure you post this event is posted when a selection was made

You can replace player_turn_starting{player.ball==0} with just player_turn_starting to have the selection on every ball (but not on extra balls). If you also want to trigger it on extra balls use ball_starting.

Using the start button to select modes

Normally, pressing the start button will cause MPF to add another player. To suppress this during mode selection you can do the following:

# Add the following to the game section of your machine's config.yaml
# This will disable the start button for adding players
game:
   add_player_switch_tag: add_player

# Add this to your attract.yaml
event_player:
   s_start_active: sw_add_player

# Have something in your base mode to trigger another mode (e.g. the carousel above)
# and in that mode have the following (to reenable the start button):
event_player:
   s_start_active: sw_add_player