Create Your Own Menu (part5)

Engine : RPG Maker VX Ace

Click here for part 1
Click here for part 2
Click here for part 3
Click here for part 4

6. Assigning the Commands

6a. Set commands handler
An easy way to set what will happens when a command is activated is with a command handler that RGSS3 provided. This can only be applied to Window_Selectable, which is the superclass of our commands window. Insert this code in def create_window_menu_list under @menulist_window = Window_MenuList.new


    #window handler is basically assigning a method to the input symbol or
    #command symbol. When we select or press a symbol, the method will be called
    #window.set_handler(symbol, method)
    @menulist_window.set_handler(:item,      method(:command_item))
    @menulist_window.set_handler(:skill,     method(:command_personal))
    @menulist_window.set_handler(:equip,     method(:command_personal))
    @menulist_window.set_handler(:status,    method(:command_personal))
    @menulist_window.set_handler(:formation, method(:command_formation))
    @menulist_window.set_handler(:crafting,  method(:command_crafting))
    @menulist_window.set_handler(:save,      method(:command_save))
    @menulist_window.set_handler(:game_end,  method(:command_game_end))
    #return_scene method is from Scene_Base superclass. What this method
    #do is basically return to the previous scene.
    @menulist_window.set_handler(:cancel,    method(:return_scene))



The syntax is:
  • set_handler(command symbol, executed method)

Q. Why are these :equip, :status and :formation use the same method which is :command_personal?
A. Becase those commands need actor selection.
And then, we have to create the methods for the commands. Insert these methods to "Scene_Menu" script that we have created.
  def command_item
  end

  def command_personal
  end
  
  def command_skill
  end
  
  def command_equip
  end
  
  def command_status
  end
  
  def command_formation
  end
  
  def command_crafting
  end
  
  def command_end
  end

6b. Setting up command_item
Because we want the item command to call Scene_Item scene, we can just add this code to command_item method
  def command_item
    #Go to Scene_Item
    SceneManager.call(Scene_Item)
  end

6c. Setting up command_personal
This method is basically for activating actor selection. When the actor is selected, the actual method will be called depending on command symbol. First we need a flag variable to indicate whether actor selection is active or not.
Add this code in Scene_Menu start method, under super
    #Initialize actor selection flag.
    @actor_selection = false

And then for the command_personal method
  def command_personal
    #Set actor selection flag to true.
    @actor_selection = true
    #Variable for storing actor selection index.
    @actor_index = 0
    #Update status windows, activate or deactivate the windows depending on 
    #@actor_index
    update_status_window_selection
  end

You might've noticed that there's a new method which is update_status_window_selection that doesn't exist yet. Add this for updating actor status windows based on @actor_index variable.

  def update_status_window_selection
    #loop through @actor_status_windows, getting the individual window
    #and its index.
    @actor_status_windows.each_with_index do |window, i|
      #window will be activated if its index is the same as 
      #@actor_index variable
      if i == @actor_index
        window.activate
        #Select the first window item, causing the window cursor to appear.
        window.select(0)
      else
        window.deactivate
        #Deselect all window items, causing the window cursor to disappear.
        window.unselect
      end
    end
  end

In the Scene_Menu update method, add these codes
    #Update status windows, activate or deactivate the windows depending on 
    #@actor_index. Only when @actor_selection is true.
    update_actor_selection if @actor_selection
    #Because these status windows are inside an array, we have to update it
    #manually.
    update_actor_status_windows

And this

  def update_actor_selection
    #Store the current actor index in temporary variable
    temp_index = @actor_index
    #If left key is pressed
    if Input.repeat?(:LEFT)
      #Decrease the actor index
      @actor_index -= 1
      #If the actor index is less than 0, wrap it to the highest index.
      @actor_index = @actor_status_windows.size - 1 if @actor_index < 0
    end
    #If right key is pressed
    if Input.repeat?(:RIGHT)
      #Increase the actor index
      @actor_index += 1
      #If the actor index is higher than the highest index, wrap it to 0.
      @actor_index = 0 if @actor_index > @actor_status_windows.size - 1
    end
    #If the previous stored index is not the same as the current actor index
    if temp_index != @actor_index
      #Play cursor sound
      Sound.play_cursor
      #Update actor status windows
      update_status_window_selection
    end
    #If confirmation key is pressed
    if Input.trigger?(:C)
      #Update Input so that the trigger flag is set back to false.
      Input.update
      #Play confirmation sound
      Sound.play_ok
      #Set menu actor to currently selected actor.
      $game_party.menu_actor = $game_party.members[@actor_index]
      #Depending on the menulist current symbol, execute these codes.
      case @menulist_window.current_symbol
      when :skill
        command_skill
      when :equip
        command_equip
      when :status
        command_status
      end
    end
    if Input.trigger?(:B)
      #Update Input so that the trigger flag is set back to false.
      Input.update
      #Play cancel sound
      Sound.play_cancel
      #Set actor index to -1, causing all status windows deactivated.
      @actor_index = -1
      update_status_window_selection
      #Set actor selection to false
      @actor_selection = false
      #Activate menu command window
      @menulist_window.activate
    end
  end


  def update_actor_status_windows
    #Because these status windows are inside an array, we have to update it
    #manually.
    @actor_status_windows.each do |window|
      window.update
    end
  end 

Now when you select command that use command_personal method, it'll look like this


Complete script for this tutorial part

more »

Parallax Utils v1.2

Engine : RPG Maker MV
Version : 1.2



What is This?

Create multipurpose parallaxes to beautify your maps.


Features

- Unlimited parallaxes.
- Can be used as fog or weather.
- Each parallax can be disabled via switch.
- Easier setup with presets.
- Animated parallax with adjustable frame duration and max frame.
- Fading effect.
- v1.1 Parallax can be locked to Map, Event and Player.

Screenshots





Download

Demo
Github


Changelog 

v1.2 - 09/04/2019
- Changed: Allow lock position for looped layer.
- Changed: Auto Scroll X and Y has decimal numbers for slower scroll speed.
- Added: "change" plugin command.

v1.1a - 06/01/2019:
- Fixed: Blinking issue with animated layer that is caused by bitmap that is not yet loaded.

v1.1 - 04/01/2019:
- Removed: Lock X to Map parameter.
- Removed: Lock Y to Map parameter.
- Changed: Layer Order parameter.
- Added: Global Switch parameter.
- Added: Layer Z parameter.
- Added: Lock Position parameter.
- Added: Layer Loop parameter.
- Added: setEvent plugin command.
- Added: setOpacity plugin command.
- Added: setEvent plugin command.

Credit

DrDhoom










more »

Message Sound Effects

Engine : RPG Maker MV
Version : 1.0


What is This?

Enable sound effects for Message window with added delay between characters.


Features

- You'll be able to play SE for each characters, words, sentences and pages.
- Delay can be set for each characters, words and sentences.
- SE pitch can be varied.
- Easily change message SE with presets.
- Can be enabled or disabled by a switch or text codes.

Video





Download

https://github.com/DrDhoom/RMMV-Plugins/blob/master/DhoomMessageSE.js

Credit

DrDhoom










more »

Text To Icon v1.1

Engine : RPG Maker MV
Version : 1.1


Changelog:

v1.1 (01/11/2016):
  • Apply TextToIcon to Window_Base.drawTextEx
  • Text and Icon parameter format is changed
  • Could add more than 1 icon

What is This?

Change any text in a window to icons. Can be applied to a specific scene only.

Screenshot



Download


https://github.com/DrDhoom/RMMV-Plugins/blob/master/DhoomTextToIcon.js

Credit

DrDhoom







more »

Title Exit Command v1.0

Engine : RPG Maker MV
Version : 1.0

What is This?

Just a little snippet to add exit command on title screen.

Download


https://github.com/DrDhoom/RMMV-Plugins/blob/master/DhoomTitleExitCommand.js

Credit

DrDhoom


more »

Text to Icon v1.0a

Engine : RPG Maker VX Ace
Version : 1.0a

What is This?

Convert any specified text into icon. You can set conditions for specific icon to be displayed. Works with every script that use draw_text method in Window_Base.

Features

  • Possibly works with every script
  • Can set a condition for specific icon to showed up

Screenshot




Changelog

• 27.07.2015 v1.0a
   - Adding ways to disable text to icon convertion

Download

http://pastebin.com/nrG6VVZG

Credit

DrDhoom


more »

Suggestions and Reports

Have any suggestion for this site? Or is there an error in this site? Feel free to comment about it here.

Also if there's any bugs in my script, please report it here with the following rules:
1. Please tell me the detail as much as possible.
2. Try to use it in a fresh project, it might be incompatible with other scripts.
3. Please tell me step by step how to recreate the bugs.

Thanks.


more »

Dungeon Match 3 : Devlog #1

Devlog time!!!

Man, a long time since I've posted a new post. And I'm stuck with the tutorial, sorry about that :(

Anyway, this time I'll talk about my current solo project, which is Dungeon Match 3 (could be changed later). The game is about a fallen hero that has been resurrected to fight the evils and save the world (pretty cliche right? well... ).

The genre is Puzzle RPG, which is a fusion of match 3 mechanic (Candy Crush, Bejeweled) with RPG elements. You have to match 3 objects or more to gain powers, that will be used to perform an action.

Here's the stage editor screenshot:

And here's the ingame screenshot:


And here's the gameplay video:



There's a few placeholder that I've to change. But the interface pretty much final.
Give some thoughts or ideas below, I appreciate it :)
more »