19 October 2010

Customizing Menus - Part 3: Nuts and Bolts

In Part 1, we dealt with the basic menu structure and how the the commands are displayed and called. Part 2 detailed how to execute the routines when the menu item is selected. And Part 3 will continue with some of the other elements in the menu.

Immediately below the menu index (line 28 in RMXP and line 62 in RMVX) is the part to check if the party members (actors in RMXP or members in RMVX) are alive which sections can be displayed and if save is enabled display it in the menu options.

The code structure is as follows:

RMXP

# If number of party members is 0
if $game_party.actors.size == 0
   # Disable items, skills, equipment, and status
   @command_window.disable_item(0)
   @command_window.disable_item(1)
   @command_window.disable_item(2)
   @command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
   # Disable save
   @command_window.disable_item(4)
end

RMVX

if $game_party.members.size == 0 # If number of party members is 0
   @command_window.draw_item(0, false) # Disable item
   @command_window.draw_item(1, false) # Disable skill
   @command_window.draw_item(2, false) # Disable equipment
   @command_window.draw_item(3, false) # Disable status
end
if $game_system.save_disabled # If save is forbidden
   @command_window.draw_item(4, false) # Disable save
end

This queries whether any or all of the party members are incapacitated or dead, and disables the corresponding sections for them so that they are inaccessible through the menu. And if the save option is disabled (by setting @save_disabled to "true" in Game_System) then it will be grayed out in the menu.
Related Posts with Thumbnails
Template Design "Perfect World" by SkinCorner