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 »

Petrified State v1.3a

Engine : RPG Maker VX Ace
Version : 1.3a

What is This?

When this state is applied to enemies or actors, their can't be targetted by any skills and items (normal attack and defend is considered as skills) and give total immune to slip damage and effect area.

Features

  • Skills and Items can be set to ignore this state
  • Total immunity to the target based on Skill Type

Download

http://pastebin.com/raw.php?i=Ktw2ZKNc

Credit

DrDhoom



more »

Modern Algebra's Monster Catalogue Add-on v1.4

Engine : RPG Maker VX Ace
Version : 1.4

What is This?

This is an add-on for modern algebra's Monster Catalogue. This script will add 2 more pages for displaying element and state resistance, skills (my manipulated skill included), kill counts, dropable items, and stealable items from Yanfly script.

Required

modern algebra's Monster Catalogue, get it here : http://rmrk.net/index.php?topic=45009.0

Features

  • Like the original script, can be set to always show the contents, when encountered, or when analyzed.
  • Display element and state resistance, skills (my manipulated skill included), kill counts, dropable items (including Extra Drops from Yanfly), and stealable items from Yanfly script.
  • A lot of modification settings.
  • Auto hide the label when there's no content to show.

Screenshot




Download

http://pastebin.com/raw.php?i=XpixU3vW

Credit

modern algebra (original creator)
DrDhoom
more »

Create Your Own Menu (part 4)

Engine : RPG Maker VX Ace

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

5. Creating Scene Menu

5a. Setup
Like before, insert a new script and name it Scene_Menu. Then paste this code below.

class Scene_Menu < Scene_MenuBase
  def start
    super
    create_window_menu_list
    create_window_actor_status
    create_window_location_gold
  end
  
  def create_window_menu_list    
  end
  
  def create_window_actor_status    
  end
  
  def create_window_location_gold
  end
end
Unlike other class, when created scene class will run the start method instead of initialize (you can see it in Scene_Base main method, that it will run start > post_start > then looping update).

5b. Creating Menu List
Paste this in def create_window_menu_list.

    @menulist_window = Window_MenuList.new

5c. Creating Windows Status
Paste this in def create_window_actor_status.

    #create array container for windows status
    @actor_status_windows = []
    #spacing between each windows
    spacing = 16
    #loop through each index for i = index in 0 until total actor in the party
    (0...$game_party.members.size).each do |i|
      #create status window
      @actor_status_windows[i] = Window_MenuStatus.new(i)  
      #set window's x position
      @actor_status_windows[i].x = 16 + i*(@actor_status_windows[i].width+spacing)
      #set window's y position
      @actor_status_windows[i].y = 64
    end
5d. Creating Location Gold Window
Paste this in def create_window_location_gold.

    @locgold_window = Window_LocGold.new

Now you can open the menu, and it should look like this
 But it's kinda plain isn't it? How about we animate the windows so it will look more, attractive?

5e. Animating the Windows.
I want the menu list and locgold window closed first, then it's open. To do that, we have to close the windows after we created it. Change def create_window_menu_list and def create_window_location_gold to this.

  def create_window_menu_list
    @menulist_window = Window_MenuList.new
    #set the window's openness, 0 is the minimum and 255 is the max
    @menulist_window.openness = 0
    #open the window
    @menulist_window.open
  end

  def create_window_location_gold
    @locgold_window = Window_LocGold.new
    #set the window's openness, 0 is the minimum and 255 is the max
    @locgold_window.openness = 0
    #open the window
    @locgold_window.open
  end
Now the menu should look like this,
But it's, still not enough. How about we animate the status windows too? Yeah let's do it.

5f. Animating Status Windows
I want the windows to move from outside to inside the screen with different speed. To do that, have to set the window's x outside the screen. Change def create_window_actor_status to this.

    #create array container for windows status
    @actor_status_windows = []
    #loop through each index for i = index in 0 until total actor in the party
    (0...$game_party.members.size).each do |i|
      #create status window
      @actor_status_windows[i] = Window_MenuStatus.new(i)  
      #set window's x position
      @actor_status_windows[i].x = -@actor_status_windows[i].width
      #set window's y position
      @actor_status_windows[i].y = 64
    end
Then, add this new method below.

  def update
    super
    #animate the windows status unless we done animating it
    animate_windows_status unless @status_animated
  end
  
  def animate_windows_status
    #array for containing the speed of each window
    @mv_speed ||= []
    #spacing between each windows
    spacing = 16
    #for checking if every windows is already in target_x
    ani_done = 0
    #for each window and index in @actor_status_window
    @actor_status_windows.each_with_index do |window, i|
      #set @mv_speed[index] to 2.0 if it's nil
      @mv_speed[i] ||= 3
      #x position that windows will moved to
      target_x = 16+i*(window.width+spacing)
      #if window's x is less than target_x
      if window.x < target_x
        #increment the window's x
        window.x += @mv_speed[i]
        #if after incremented the window's x is greater than target_x
        if window.x > target_x
          #set the window's x to target_x
          window.x = target_x
        end      
      end
      #if window's x equal to target_x
      if window.x == target_x
        #increase ani_done
        ani_done += 1
      end
      #increase the moving speed
      @mv_speed[i] += 1
    end
    #if ani_done equal to total number of windows
    if ani_done == @actor_status_windows.size
      #animated is done
      @status_animated = true
    end
  end
It should look like this.


But there's nothing happen if you select any command, because we didn't create the method for that yet.

more »

Create Your Own Menu (part 3)

Engine : RPG Maker VX Ace

Click here for part 1
Click here for part 2

4. Creating Location and Gold Window

4a. Setup
Insert a new script and name it Window_LocGold.


Then, paste this code below in Window_LocGold.


class Window_LocGold < Window_Base
  def initialize
    #super(x, y, width, height)
    super(16,360,512,40)
    refresh
  end
  
  def line_height
    #Auto calculate the line height for text
    40 - standard_padding * 2
  end
  
  def refresh
    #Change contents font size
    contents.font.size = 16
    #Clear contents
    contents.clear
    draw_location
    draw_gold
  end
  
  def draw_location    
  end
  
  def draw_gold
  end
end
This will create Window_LocGold class, with X 16 and Y 360, and width 512 height 40.

4b. Draw Location Name
To draw the location name, insert this code below in def draw_location.

    #Unless map display name isn't empty
    unless $game_map.display_name.empty?
      draw_text(4, 0, 320, line_height, "Location : #{$game_map.display_name}")
    end

4c. Draw Gold
Now to draw the total amount of gold, insert this code in def draw_gold.

    #change font color to system color
    change_color(system_color)
    draw_text(320, 0, 168, line_height, Vocab::currency_unit, 2)
    #change font color to normal color
    change_color(normal_color)
    #calculate the width for drawing gold amount
    #text_size is for getting the rect of the text when drawed in contents
    #rect has 4 properties : x, y, width, and height
    size = 164 - text_size(Vocab::currency_unit).width
    draw_text(320, 0, size, line_height, $game_party.gold, 2)

Now that everything is ready, test it with script call like before and you should see the window popped out.
Click here for part 4
more »

Create Your Own Menu (part 2)

Engine : RPG Maker VX Ace

Click here for part 1

3. Creating Actor Status Window

3a. Setup
Insert a new script under Window_MenuList, change the name to Window_MenuStatus.

3b. Create Window_MenuStatus class
Paste this code below in Window_MenuStatus

class Window_MenuStatus < Window_Selectable
  #Index is actor index, used for determining the actor and
  #window's position
  def initialize(index)
    #Window properties
    #super(x, y, width, height)
    super(0, 0, 116, 288)
    #save index to local variable
    @index = index
    #make a pointer to the actor
    @actor = $game_party.members[@index]
    #refresh the window contents
    refresh
  end
  
  def item_max
    1
  end

  def item_height
    height - standard_padding * 2
  end
  
  def refresh
    #clear the contents
    contents.clear
    #return unless actor isn't nil
    return unless @actor
    draw_actor_name
    draw_actor_level
    draw_actor_sprite
    draw_actor_face    
    draw_actor_parameter
  end
  
  def draw_actor_name
    #draw_text(x, y, width, height, text, align (default value is 0))
    #align :
    # 0 = Left
    # 1 = Center
    # 2 = Right
    #set the text height to font size, which is 24 for default
    draw_text(0, 0, contents.width, 24, @actor.name, 1)
  end
  
  def draw_actor_level
    #change the font size of contents to 16
    contents.font.size = 16
    
    #change the font color
    #change_color(color, enabled? (default value is true))
    
    #text_color(n) is to get the color of n index in window graphic
    #the same as \C[n] in Event message
    change_color(text_color(16))
    
    #Vocab::level_a is the term for level (short) that can be changed in 
    #database.
    #If there is #{} in double string (""), it will run the command in that 
    #bracket and combine the result.
    #"#{Vocab::level_a} : #{@actor.level}" is the same thing as :
    #   Vocab::level_a + " : " + @actor.level.to_s
    draw_text(0, 24, contents.width, 16, "#{Vocab::level_a} : #{@actor.level}", 1)
  end
  
  def draw_actor_sprite
    #draw_character(character name, character index, x, y)
    draw_character(@actor.character_name, @actor.character_index, contents.width/2, 76)
  end
  
  def draw_actor_face
    #draw_face(face_name, face_index, x, y, enabled? (default value is true))           
    draw_face(@actor.face_name, @actor.face_index, (contents.width-96)/2, 82, true)
    #(contents.width-96)/2 is for calculating the center point. 96 is the width of face graphic.
  end
  
  def draw_actor_parameter    
    contents.font.size = 16
    change_color(text_color(0))
    
    #draw hp text
    draw_text(0, 182, contents.width, 16, "#{@actor.hp} / #{@actor.mhp}")    
    #draw hp gauge
    #draw_gauge(x, y, width, rate, color1, color2)
    draw_gauge(0, 182, contents.width, @actor.hp_rate, text_color(20), text_color(21))
    
    #draw mp text
    draw_text(0, 208, contents.width, 16, "#{@actor.mp} / #{@actor.mmp}") 
    #draw mp gauge
    draw_gauge(0, 208, contents.width, @actor.mp_rate, text_color(22), text_color(23))
    
    #for calculating the percentage of experience. One variable has to be
    #converted to float(.to_f).
    exp_rate = @actor.exp / (@actor.next_level_exp - @actor.exp).to_f
    #draw exp text
    draw_text(0, 238, contents.width, 16, "#{@actor.exp} / #{@actor.next_level_exp - @actor.exp}")
    #draw exp gauge
    draw_gauge(0, 238, contents.width, exp_rate, text_color(28), text_color(29))
  end
end
Everything is explained in the code.
Now, let's test it. The step is like the previous part, but change the script call to:
You should see the window status of actor 1

Click here for part 3
more »

Create Your Own Menu (part 1)

Engine : RPG Maker VX Ace

What is this?

Do you want to make your own Menu but don't know how? Follow this tutorial, and I'm sure you can make it.

1. Figure Out the Layout

Before we go to coding action, we have to make the design first. It'll make the coding easier. For this tutorial, I want to make a menu that look like this,
The actor windows is separated so I can animate it later.

2. Creating Menu List Window

 

2a. Setup
Now, create a new project, so we won't be distracted with other script, then open the script editor. Select under ( insert here ), then change the name to "Window_MenuList". 


Q : Why we have to create a new window? Why can't we just use Window_MenuCommand instead?
A : Because I want the menu list to be horizontal, not vertical.

2b. Setup Position and Size
Paste this code below in Window_MenuList,

class Window_MenuList < Window_HorzCommand  
  def initialize  
    #Call superclass method with (x, y)  
    super(16, 16)  
    select_last  
  end    
  
  def window_width  
    512  
  end  
  
  def window_height  
    40  
  end  
  
  def line_height
    #Auto calculate the line height for text
    #Standard padding is a distance between window and it's contents,
    #default value is 12 
    window_height - standard_padding * 2
  end
  
  def select_last
    #Initialize @@last_command_symbol if it's nil
    @@last_command_symbol ||= nil
    #Change cursor index to the last position 
    select_symbol(@@last_command_symbol)  
  end
end

Other explanation:
  • "super" is for calling the superclass method. In this window for example, we call super(16, 16) in initialize, and it's the same thing as Window_HorzCommand.initialize(x, y).

For setting up position and size, you can use Photoshop or other graphics editor to do that. In Photoshop, press Ctrl+T or Edit>Free Transform, then change the anchor point to top-left.


2c. Creating the commands
The commands that we'll make is the same as default one plus new command called Crafting, but without Save. So the list commands is Items, Skills,  Equipment, Status, Formation, Crafting and Game End.

Now, insert this code below, above the very bottom of "end" in Window_MenuList.

#Make Command list
  def make_command_list    
    add_commands_list
  end

  def add_commands_list
    #add_command(Command Name, Command Symbol, Enabled?(true or false))
    add_command(Vocab::item,      :item,      main_commands_enabled)
    add_command(Vocab::skill,     :skill,     main_commands_enabled)
    add_command(Vocab::equip,     :equip,     main_commands_enabled)
    add_command(Vocab::status,    :status,    main_commands_enabled)
    add_command(Vocab::formation, :formation, formation_enabled)
    add_command(Vocab::game_end,  :game_end)
  end

  def main_commands_enabled
    #There's actor in the party?
    $game_party.exists
  end

  def formation_enabled
    #If actors in the party is 2 or more and formation not disabled
    $game_party.members.size >= 2 && !$game_system.formation_disabled
  end

  def process_ok
    #Save command position
    @@last_command_symbol = current_symbol
    super
  end

  def draw_item(index)
    #Change contents font size
    contents.font.size = 16
    super(index)
  end

If you want to add more command, insert add_command in add_command_list. Ouch, I forgot to add the Crafting command. So after we insert the Crafting command, the add_command_list would be like this,

  def add_commands_list
    #add_command(Command Name, Command Symbol, Enabled?(true or false))
    add_command(Vocab::item,      :item,      main_commands_enabled)
    add_command(Vocab::skill,     :skill,     main_commands_enabled)
    add_command(Vocab::equip,     :equip,     main_commands_enabled)
    add_command(Vocab::status,    :status,    main_commands_enabled)
    add_command(Vocab::formation, :formation, formation_enabled)
    add_command("Crafting",       :crafting)
    add_command(Vocab::game_end,  :game_end)
  end
Q : Why is there no true or false after command symbol?
A : If you leave it empty, it will use the default value,  which is true.
Q : What is the symbol for?
A : To distinguish the command with others, it will be used for creating the handler too.

Now, let's see if everything is correct. To test this window, we will create the window with Script Call in Event.
Save, then run the game. Activate the event, and you should see the window popped out.
Click here for part 2

more »