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

  1. 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)

  2. 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 to move_slot_1_letter_5 for the first move

image.png


Step 2: Mapping Move Names to ASCII Codes

Create a script called “Change Letters in a Menu Slot”:

  1. Add a switch statement checking the move_slot_id parameter

  2. 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)

image.png image.png

Step 3: Setting All Menu Items

Create a script called “Set All Displayed Menu Items”:

  1. Call “Change Letters in a Menu Slot” four times

  2. 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

image.png


Step 4: Creating Move Effects

Create a script called “Move Effects”:

  1. Add a switch statement checking the move_slot_x_id parameter

  2. 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]
      
      

image.png

Step 5: Pre-Menu Setup

  1. In your scene’s “On Init” event:

    • Set each move_slot_x_id to their initial values
  2. Call the “Set All Displayed Menu Items” script

    • This ensures all letter variables are properly set before the menu appears image.png

Step 6: Displaying the Menu

  1. 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

  2. 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 image.png


Step 7: Handling Menu Selections

Below the Display Menu event:

  1. Add a switch statement checking the menu_choice variable

  2. 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
      
      

image.png

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

image.png

Get Dynamic Move List in GB studio

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.