DEV Community

HALO
HALO

Posted on

Expanding Gameplay with GOKI2 [Introduction to ModSelect] Implementing Branching Scenarios and Choices with ModSelect

Download

Avalanches & GOKI2 can download the latest environment from the Assets link of Avalanches-GOKI2-Release2.x.y.y.zip based on the release tag on the following site (written as Avalanches (GOKI2) release version 2.x.y.y).

https://github.com/halo1234/Avalanches/releases

Choices

In the previous "Introduction to ModADV" series, we completed the basic screen settings that make up a game. From this point on, we will start a new series that dives deeper into the "gaming experience"!

The first installment explains the choice function (ModSelect), which allows you to implement "scenario branching," the core appeal of ADV (adventure games).

There is a module called ModSelect that manages choices. First, load the module.

; Choices
@load_module name=ModSelect
Enter fullscreen mode Exit fullscreen mode

Now you can use choices.

Choice Settings

You can preset various sound effects and button sizes for choices. As an example, we will use the following settings:

@select_option base_left=10 base_top=10 base_left_step=80 button_width=70 button_height=40
Enter fullscreen mode Exit fullscreen mode

Let's go through them one by one. base_left=10 base_top=10 specifies where the choices will start. Here, the first button is placed at position (10, 10).

base_left_step=80 specifies that the next choice will be displayed 80 pixels away from base_left. Although not specified here, there is also a base_top_step attribute. Set it if necessary.

Finally, button_width=70 button_height=40 specifies the size of the buttons.

This completes the choice settings. If necessary, you can also specify sound effects, so please refer to the manual.

By the way, to specify sound effects, you will need to separately load ModSound.

Creating Choices

You can write choices at any point in the scenario script. Choices are placed on the background layer rather than the message layer (more precisely, on a choice-specific layer with the primary as the parent).

You can create choices at any point in the scenario as follows:

@select caption="Choice 1" target=*choice1
@select caption="Choice 2" target=*choice2
@select show
@s
Enter fullscreen mode Exit fullscreen mode

You will write the select tag for the number of choices you have. Specify the caption of the choice in caption. Specify the label name to execute when selected in target. You can also specify the scenario storage in storage.

Once you have created the choices, they will be displayed and paused. Use select show to display the choices and s to pause.

Finally, define the labels that will be executed when a choice is selected.

*choice1
You chose Choice 1.
@s

*choice2
You chose Choice 2.
@s
Enter fullscreen mode Exit fullscreen mode

Currently, when a choice is executed, it will show the execution content and then pause, but in practice, you will likely write some other tags.

Now you can use choices.

Was that too simple this time? Choices are an important feature for implementing gameplay. Please make sure you can use them proficiently.

Top comments (0)