|
| 1 | +--- |
| 2 | +title: GMC Tilt Slides |
| 3 | +--- |
| 4 | + |
| 5 | +# Tilt Slides in GMC |
| 6 | + |
| 7 | +GMC provides a default slide for handling warnings and tilt, and the standard [tilt mode](../../game_logic/modes/tilt.md) |
| 8 | +in the MPF configuration provides a set of automatic hooks to display the slide with different messages. |
| 9 | + |
| 10 | +The previous guide, [Bonus Slides in GMC](bonus_mode.md), walks through creating your own slide |
| 11 | +to override the default provided by MPF. Regarding the GMC slide files, Tilt slide customization works in just the same way. |
| 12 | + |
| 13 | +## Configure Tilt Settings |
| 14 | + |
| 15 | +If you don't have a tilt mode already, follow the general [tilt guide](../../game_logic/tilt/index.md). |
| 16 | +The [configuration settings](../../config/tilt.md#optional-settings) have not been changed between MPF 0.57 and 0.80. |
| 17 | + |
| 18 | +The default tilt mode includes three hooks for automatically displaying the slide `tilt.tscn`. |
| 19 | +The slide expects a [token](../reference/slide_player.md#tokens) called `text`. |
| 20 | +The first tilt warning sends the text "WARNING", the second sends "DANGER", and tilting out sends "TILT". |
| 21 | + |
| 22 | +If you use a number larger than three for your [tilt:warnings_to_tilt setting](../../config/tilt.md#warnings_to_tilt), |
| 23 | +these further warning events do not have default slides provided, nor slide_player hooks. |
| 24 | + |
| 25 | +For example, if you change the setting to 4 and wanted to use the text "UH OH" for the third warning, |
| 26 | +you could declare the `slide_player` extension in your overriding tilt mode file: |
| 27 | + |
| 28 | +``` yaml |
| 29 | +##! mode: modes/tilt/config/tilt.yaml |
| 30 | +slide_player: |
| 31 | + tilt_warning_3: # event |
| 32 | + tilt: # slide |
| 33 | + expire: 1s |
| 34 | + tokens: |
| 35 | + text: UH OH |
| 36 | +``` |
| 37 | +
|
| 38 | +## Creating a custom Tilt Slide |
| 39 | +
|
| 40 | +There are two basic approaches to customizing the tilt slide. |
| 41 | +If you only want the standard warning and tilt text (and any custom further warning texts per the previous section), |
| 42 | +but want to add various display elements, you can provide a custom slide with an event variable for `text`. |
| 43 | + |
| 44 | +The if you want further complexity or different behaviors around the slides, but still want to use the |
| 45 | +default tilt mode, you can override the `slide_player` from the default tilt mode and use slides in |
| 46 | +any way you want. |
| 47 | + |
| 48 | +## Approach 1: Replace the default slide `tscn` file |
| 49 | + |
| 50 | +To replace the default tilt slide, you need to create a new slide named `tilt.tscn` whereever you |
| 51 | +create your GMC slides. The only event token provided by the default config is `text`, so |
| 52 | +you can create a [MPFVariable](../reference/mpf-variable.md) with the `variable_type` of *"Event Arg"* |
| 53 | +and `variable_name` of "text" to display this. |
| 54 | + |
| 55 | +## Approach 2: Replace the default `slide_player` |
| 56 | + |
| 57 | +If the first approach does not offer enough flexibility, you can build upon it by also extending the default tilt |
| 58 | +mode's `slide_player`. First, make your custom slide or slides, we'll call them `tilt_warning.tscn` and `tilt_splash.tscn`. |
| 59 | +Populate them with whatever display and dynamic elements you want -- you will need to provide any event variables yourself |
| 60 | +later on. |
| 61 | + |
| 62 | +In your custom tilt mode config (`/modes/tilt/config/tilt.yaml`) you need to overwrite the default slide_player. |
| 63 | +This will replace ALL behaviors from the default tilt slide_player, so you will need to recreate any if there |
| 64 | +are some you want to keep. |
| 65 | + |
| 66 | +Every tilt infraction by a player will post a warning event, [tilt_warning_(number)](../../events/tilt_warning_number.md), |
| 67 | +with appropriate number. The final infraction will instead post the event [tilt](../../events/tilt.md) and end the current ball. |
| 68 | +You will want to create a `slide_player` hook for each warning and the final tilt event, using your custom slide names instead |
| 69 | +of `tilt` as the slide name. Finally, you need to either include [expire](../reference/slide_player.md#expire) values or |
| 70 | +custom hooks for when to hide the slides. MPF will automatically post the event [tilt_clear](../../events/tilt_clear.md) |
| 71 | +when the machine has successfully cleared and collected all active balls to finish the ball end process, so this |
| 72 | +is a good one to put your tilt slide removal on. |
| 73 | + |
| 74 | +For instance, with our example custom slides `tilt_warning`, and `tilt_splash`, we might write: |
| 75 | + |
| 76 | +``` yaml |
| 77 | +##! mode: modes/tilt/config/tilt.yaml |
| 78 | +slide_player: |
| 79 | + _overwrite: True # overwrite the default slide_player from tilt mode |
| 80 | +
|
| 81 | + tilt_warning_1: # event name |
| 82 | + tilt_warning: # slide name |
| 83 | + expire: 1s |
| 84 | + tokens: |
| 85 | + warning_number: 1 |
| 86 | +
|
| 87 | + tilt_warning_2: |
| 88 | + tilt_warning: |
| 89 | + expire: 1s |
| 90 | + tokens: |
| 91 | + warning_number: 2 |
| 92 | +
|
| 93 | + tilt: |
| 94 | + tilt_splash: |
| 95 | + action: play |
| 96 | +
|
| 97 | + tilt_clear: |
| 98 | + tilt_splash: |
| 99 | + action: remove |
| 100 | +
|
| 101 | +``` |
0 commit comments