Dynamic Move List in GB Studio Tutorial
Dynamic Move List Using the Display Menu Event in GB Studio
This guide explains how to create a menu-based move list system similar to RPGs like Pokémon, using only event scripting in GB Studio. Each menu slot displays a move name and executes different scripts based on player selection.
Overview
Each move slot contains:
-
An ID variable determining which move it represents
-
5 letter variables to spell out the move’s name (e.g., Punch → P, u, n, c, h)
-
Dynamic display using
%c
syntax in a choice menu
When selected, the system looks up the move ID and executes the appropriate effect.
Step 1: Setting Up Variables
-
Create 4 ID variables for move slots:
-
Name them
menu_slot_x_id
(where x is 1, 2, 3, or 4) -
These IDs will represent different moves (e.g., 1 = Punch, 2 = Kick)
-
-
Create letter variables for each move slot:
-
Name them
move_slot_x_letter_y
(x = slot ID, y = letter position 1-5) -
Example:
move_slot_1_letter_1
tomove_slot_1_letter_5
for the first move
-
Step 2: Mapping Move Names to ASCII Codes
Create a script called “Change Letters in a Menu Slot”:
-
Add a switch statement checking the
move_slot_id
parameter -
For each case (move ID), add five “Set Variable to Value” events:
-
Set each
letter_y
parameter to the ASCII code for the corresponding letter -
Use online ASCII converters to find the correct codes
-
Example for “Punch”:
Case 1:
Set letter_1 to 80 (P)
Set letter_2 to 117 (u)
Set letter_3 to 110 (n)
Set etter_4 to 99 (c)
Set letter_5 to 104 (h)
Step 3: Setting All Menu Items
Create a script called “Set All Displayed Menu Items”:
-
Call “Change Letters in a Menu Slot” four times
-
For each call:
-
Pass the appropriate
move_slot_x_id
as the argument -
Pass the appropriate ‘move_slot_x_letter_y’ for each letter argument
-
Step 4: Creating Move Effects
Create a script called “Move Effects”:
-
Add a switch statement checking the
move_slot_x_id
parameter -
For each case (move ID), add the move’s logic:
-
Example for Kick (ID 2):
Case 2: Show Text: "The player kicks the enemy!" [Add damage calculation or other effects here]
-
Step 5: Pre-Menu Setup
-
In your scene’s “On Init” event:
- Set each
move_slot_x_id
to their initial values
- Set each
-
Call the “Set All Displayed Menu Items” script
- This ensures all letter variables are properly set before the menu appears
- This ensures all letter variables are properly set before the menu appears
Step 6: Displaying the Menu
-
Add a Display Menu event where you want the menu to appear
-
Use a global variable (e.g.,
menu_choice
) to store the player’s selection -
Set the number of options to 4
-
-
For each menu option:
-
In the “set to ‘x’ if” sections, format the letter variables with
%c
:%c$move_slot_1_letter_1%c$move_slot_1_letter_2%c$move_slot_1_letter_3...
-
This converts ASCII codes to displayable letters
-
Step 7: Handling Menu Selections
Below the Display Menu event:
-
Add a switch statement checking the
menu_choice
variable -
For each case (1-4):
-
Call the “Move Effects” script
-
Pass the corresponding
move_slot_x_id
as the argument -
Example for case 3:
Call Script: Move Effects Argument: move_slot_3_id
-
Final Notes
-
Test your menu to ensure all moves display correctly and trigger the proper effects
-
Consider adding a separate scene to manage move assignments in a full game
-
Document your move IDs and their corresponding effects for future reference
Get Dynamic Move List in GB studio
Dynamic Move List in GB studio
tutorial and resource for adding dynamic menus to gb studio
Status | Released |
Category | Assets |
Author | MoistAmerica |
Tags | Game Boy, gbstudio, sourcecode, Turn-Based Combat, Tutorial |
Languages | English |
Leave a comment
Log in with itch.io to leave a comment.