This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
I edited Ring Menu(edited by Hypershadow180) for SDK2. Actually, it's rather rewrite than simple edit.
Changes:
- SDK2 compatible.
- Use SephirothSpawn's Ring Menu command window, so you can customize menu command easily.
- Eleiminate most of window setup variable, replace them by constants.
It requires SephirothSpawn's Ring Menu command window, instead of original Ring Menu command window(by XRXS).
#==============================================================================
# Class Window Ring Menu
#==============================================================================
class Window_RingMenu < Window_Base
MODE_START = 1 #
MODE_WAIT = 2 #
MODE_MOVER = 3 #
MODE_MOVEL = 4 #
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :index
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(commands, icons, radius = 64, center_x = nil, center_y = nil, width = 640, height = 480)
# Sets Up Window
super(0, 0, width, height)
# Sets Center Coordinates to player Center by Default
center_x = $game_player.screen_x - 30 if center_x == nil
center_y = $game_player.screen_y - 48 if center_y == nil
self.contents = Bitmap.new(width-32, height-32)
# Select Font Type, Size and Color
self.contents.font.name = ["Arial"]
self.contents.font.size = 22
self.contents.font.color = Color.new(255, 255, 255, 255)
# Sets up Window Border and Window Background Opacity
self.opacity, self.back_opacity = 0, 0
# Sets Up Commands & Icons
@commands = commands
@item_max = commands.size
@index = 0
@items = icons
# Sets Up Radius
@radius = radius
# Sets Up Disabled Items
@disabled = Array.new(@item_max, false)
# Sets Up Center of Ring
@cx = center_x
@cy = center_y
# Disabled Icon
@icon_disable = RPG::Cache.icon("")
# Frame Setup
@startup_frames = 20
@moving_frames = 5
setup_move_start
refresh
end
#--------------------------------------------------------------------------
# * Setup Move Start
#--------------------------------------------------------------------------
def setup_move_start
@mode = MODE_START
@steps = @startup_frames
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
case @mode
when MODE_START; refresh_start
when MODE_WAIT; refresh_wait
when MODE_MOVER; refresh_move(1)
when MODE_MOVEL; refresh_move(0)
end
rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32)
self.contents.draw_text(rect, @commands[@index], 1)
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
refresh
end
#--------------------------------------------------------------------------
# * Refresh Start
#--------------------------------------------------------------------------
def refresh_start
d1 = 2.0 * Math::PI / @item_max
d2 = 1.0 * Math::PI / @startup_frames
r = @radius - 1.0 * @radius * @steps / @startup_frames
for i in 0...@item_max
j = i - @index + 1
d = d1 * j + d2 * @steps
x = @cx + ( r * Math.sin( d ) ).to_i
y = @cy - ( r * Math.cos( d ) ).to_i
draw_item(x, y, i)
end
@steps -= 1
if @steps < 1
@mode = MODE_WAIT
end
end
#--------------------------------------------------------------------------
# * Refresh Wait
#--------------------------------------------------------------------------
def refresh_wait
d = 2.0 * Math::PI / @item_max
for i in 0...@item_max
j = i - @index + 1
x = @cx + ( @radius * Math.sin( d * j ) ).to_i
y = @cy - ( @radius * Math.cos( d * j ) ).to_i
draw_item(x, y, i)
end
end
#--------------------------------------------------------------------------
# * Refresh Move
#--------------------------------------------------------------------------
def refresh_move( mode )
d1 = 2.0 * Math::PI / @item_max
d2 = d1 / @moving_frames
d2 *= -1 if mode != 0
for i in 0...@item_max
j = i - @index + 1
d = d1 * j + d2 * @steps
x = @cx + ( @radius * Math.sin( d ) ).to_i
y = @cy - ( @radius * Math.cos( d ) ).to_i
draw_item(x, y, i)
end
@steps -= 1
if @steps < 1
@mode = MODE_WAIT
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(x, y, i)
rect = Rect.new(0, 0, @items[i].width, @items[i].height)
if @index == i
self.contents.blt( x, y, @items[i], rect )
if @disabled[@index]
self.contents.blt( x, y, @icon_disable, rect )
end
else
self.contents.blt( x, y, @items[i], rect, 128 )
if @disabled[@index]
self.contents.blt( x, y, @icon_disable, rect, 128 )
end
end
end
#--------------------------------------------------------------------------
# * Disable Item
#--------------------------------------------------------------------------
def disable_item(index)
@disabled[index] = true
end
#--------------------------------------------------------------------------
# * Setup Move Move
#--------------------------------------------------------------------------
def setup_move_move(mode)
if mode == MODE_MOVER
@index -= 1
@index = @items.size - 1 if @index < 0
elsif mode == MODE_MOVEL
@index += 1
@index = 0 if @index >= @items.size
else
return
end
@mode = mode
@steps = @moving_frames
end
#--------------------------------------------------------------------------
# * Animation
#--------------------------------------------------------------------------
def animation?
return @mode != MODE_WAIT
end
end
And, this is menu. Since I can't use 'command' method defined in SDK2 like regular command window, I used older way(which used in SDK 1.x) to check command.
Edited menu script(including submenu?
Code:
#------------------------------------------------------------------------------
# Ring_Menu
#------------------------------------------------------------------------------
# Original XRXS Ring Menu by 和希
# Edited by Dubealex, Hypershadow180
# Customizable Ring Menu Command by SephirothSpawn
# Edited by L
#------------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Begin SDK Log
#--------------------------------------------------------------------------
SDK.log('Ring Menu Edit', '???', '???', '????-??-??')
#--------------------------------------------------------------------------
# * Begin SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.0, [1])
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.enabled?('Ring Menu Edit')
#------------------------------------------------------------------------------
# Window_RingMenuStatus
#------------------------------------------------------------------------------
class Window_RingMenuStatus < Window_Selectable
include Menu_Setup
#------------------------------------------------------------------------------
# Initialize
#------------------------------------------------------------------------------
def initialize
super(204, 64, 232, 352)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = Menu_Window::MenuStatus_FontSize
refresh
self.active = false
self.index = -1
end
#------------------------------------------------------------------------------
# Refresh
#------------------------------------------------------------------------------
def refresh
self.contents.clear
self.windowskin = RPG::Cache.windowskin($menustatus_skin)
self.contents.font.name = $menustatus_fonttype
self.contents.font.color = Menu_Window::MenuStatus_FontColor
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 80
y = 80 * i
actor = $game_party.actors[i]
draw_actor_graphic(actor, x - 60, y + 65)
draw_actor_name(actor, x, y + 2)
draw_actor_hp(actor, x - 40, y + 26)
draw_actor_sp(actor, x - 40, y + 50)
end
end
#------------------------------------------------------------------------------
# Update Cursor Rect
#------------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
end
end
end
#------------------------------------------------------------------------------
# Game_Map
#------------------------------------------------------------------------------
class Game_Map
#------------------------------------------------------------------------------
# Name
#------------------------------------------------------------------------------
def name
$map_infos[@map_id]
end
end
#------------------------------------------------------------------------------
# Scene_Title
#------------------------------------------------------------------------------
class Scene_Title
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = Menu_Window::Gold_Color
self.contents.draw_text(4, 67, 120-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 67, cx, 32, $data_system.words.gold, 2)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu < SDK::Scene_Base
include Menu_Setup
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
party_order_init #Change Party Order by Yargovish
commands_set
var_init
end
#---------------------
def var_init
$location_fonttype = Font.default_name
#$location_fontsize = 22
$gold_fonttype = Font.default_name
#$gold_fontsize = 22
$window_location_skin = $game_system.windowskin_name # Location Windowskin
$window_gold_skin = $game_system.windowskin_name # Gold Windowskin
$menustatus_fonttype = Font.default_name
#$menustatus_fontsize = 22
$menustatus_skin = $game_system.windowskin_name
end
#--------------------------------------------------------------------------
# * Party Order Change Initiation
#--------------------------------------------------------------------------
def party_order_init
@changer = 0 #Change Party Order by Yargovish
@where = 0 #
@checker = 0 #
end
#--------------------------------------------------------------------------
# * Set Commands
#--------------------------------------------------------------------------
def commands_set
@commands = []
s1 = Menu_Commands::Item
s2 = Menu_Commands::Skill
s3 = Menu_Commands::Equip
s4 = Menu_Commands::Status
s5 = Menu_Commands::Quest
s6 = Menu_Commands::System
@commands.push(s1, s2, s3, s4, s5, s6).flatten!
@sys_command_icons = []
option_icon = RPG::Cache.icon(Menu_Icon::Option_Icon)
save_icon = RPG::Cache.icon(Menu_Icon::Save_Icon)
load_icon = RPG::Cache.icon(Menu_Icon::Load_Icon)
exit_icon = RPG::Cache.icon(Menu_Icon::End_Game_Icon)
@sys_command_icons.push(option_icon,save_icon,load_icon,exit_icon).flatten!
end
#--------------------------------------------------------------------------
# * Main Processing : Spriteset Initialization
#--------------------------------------------------------------------------
def main_spriteset
#Draw Background
@background = Spriteset_Map.new
end
#--------------------------------------------------------------------------
# * Main Processing : Window Initialization
#--------------------------------------------------------------------------
def main_window
super
main_command_window
sys_command_window
#Draw Map Name Window
@location_window = Window_Location.new
@location_window.x = Menu_Window::Window_Location_XPos
@location_window.y = Menu_Window::Window_Location_YPos
@location_window.opacity = Menu_Window::Window_Border_Opacity
@location_window.back_opacity = Menu_Window::Window_Back_Opacity
#Draw Gold Window
#@gold_window = Window_MenuGold.new
@gold_window = Window_Infos.new
@gold_window.x = Menu_Window::Window_Gold_XPos
@gold_window.y = Menu_Window::Window_Gold_YPos
@gold_window.opacity = Menu_Window::Window_Border_Opacity
@gold_window.back_opacity = Menu_Window::Window_Back_Opacity
#Draw Status Window
@status_window = Window_RingMenuStatus.new
@status_window.x = Menu_Window::MenuStatus_XPos
@status_window.y = Menu_Window::MenuStatus_YPos
@status_window.z = 200
@status_window.opacity=Menu_Window::MenuStatus_Border_Opacity
@status_window.back_opacity=Menu_Window::MenuStatus_Back_Opacity
@status_window.visible = false
end
#--------------------------------------------------------------------------
# * Main Command Window
#--------------------------------------------------------------------------
def main_command_window
@command_window = Window_RingMenu.new(@commands, @command_icons,64)
@command_window.index = @menu_index
#@command_window.height = 256
# 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
end
#--------------------------------------------------------------------------
# * System Command Window
#--------------------------------------------------------------------------
def sys_command_window
@sys_command_window = Window_RingMenu.new(@sys_commands, @sys_command_icons, 48)
@sys_command_window.visible = false
@sys_command_window.active = false
check_save_available
check_load_available
end
#-----------------
def check_save_available
if $game_system.save_disabled
@sys_command_window.disable_item(1)
end
end
#-----------------
def check_load_available
#Check if saved file exists
@load_enabled = false
for i in 0..3
if (FileTest.exist?("Save#{i+1}.rxdata"))
@load_enabled = true
end
end
if !@load_enabled
#Put your @command_window.disable_item(index)
@sys_command_window.disable_item(2)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If system window is active: call update_sys_command
if @sys_command_window.active
update_sys_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Return if Disabled Command
if disabled_main_command?
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Command Input
main_command_input
return
end
return if @command_window.animation?
if Input.press?(Input::UP) or Input.press?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@command_window.setup_move_move(Window_RingMenu::MODE_MOVEL)
return
end
if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@command_window.setup_move_move(Window_RingMenu::MODE_MOVER)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_sys_command
# If B button was pressed
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@command_window.visible = true
@sys_command_window.active = false
@sys_command_window.visible = false
@sys_command_window.index = 0
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Return if Disabled Command
if disabled_main_command?
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Command Input
sys_command_input
return
end
return if @sys_command_window.animation?
if Input.press?(Input::UP) or Input.press?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@sys_command_window.setup_move_move(Window_RingMenu::MODE_MOVEL)
return
end
if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@sys_command_window.setup_move_move(Window_RingMenu::MODE_MOVER)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.visible = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Return if Disabled Command
if disabled_main_command?
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Command Input
sub_command_input
return
end
end
#--------------------------------------------------------------------------
# * Disabled Main Command? Test
#--------------------------------------------------------------------------
def disabled_main_command?
command = @commands[@command_window.index]
sys_command = @sys_commands[@sys_command_window.index]
# Gets Scene_Menu Commands
c = Menu_Commands
# If 0 Party Size
if $game_party.actors.size == 0
# If Item, Skill, Equip or Status Selected
if [c::Item, c::Skill, c::Equip, c::Status].include?(command)
return true
end
end
if $game_party.actors.size <= 1
if [c::Order].include?(command)
return true
end
end
# If Save Disabled && Command is Save
return true if $game_system.save_disabled && sys_command == c::Save
# If Load Disabled && Command is Load
return true if !@load_enabled && sys_command == c::Load
return false
end
#--------------------------------------------------------------------------
# * Update Command Check
#--------------------------------------------------------------------------
def main_command_input
# Loads Current Command
command = @commands[@command_window.index]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Checks Commands
case command
when Menu_Commands::Item
command_item
when Menu_Commands::Skill
command_skill
when Menu_Commands::Equip
command_equip
when Menu_Commands::Status
command_status
when Menu_Commands::Quest
command_quest
when Menu_Commands::System
$game_system.se_play($data_system.decision_se)
@sys_command_window.active = true
@sys_command_window.visible = true
@command_window.active = false
@command_window.visible = false
end
end
#--------------------------------------------------------------------------
# * Update System Command Check
#--------------------------------------------------------------------------
def sys_command_input
# Loads Current Command
sys_command = @sys_commands[@sys_command_window.index]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Checks Commands
case sys_command
when Menu_Commands::Option
command_option
when Menu_Commands::Save
command_save
when Menu_Commands::Load
command_load
when Menu_Commands::End_Game
command_endgame
end
end
#--------------------------------------------------------------------------
# * Disabled Sub Command? Test
#--------------------------------------------------------------------------
def disabled_sub_command?
# Loads Current Command
command = @commands[@command_window.index]
# If Skill Selected
if command == Menu_Commands::Skill
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
return true
end
end
return false
end
#--------------------------------------------------------------------------
# * Update Status Check
#--------------------------------------------------------------------------
def sub_command_input
# Loads Current Command
command = @commands[@command_window.index]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Checks Command By Name
case command
when Menu_Commands::Skill
command_skill
when Menu_Commands::Equip
command_equip
when Menu_Commands::Status
command_status
when Menu_Commands::Order
command_order
end
end
#--------------------------------------------------------------------------
# * Command Item
#--------------------------------------------------------------------------
def command_item
# Switch to item screen
$scene = Scene_Item.new
end
#--------------------------------------------------------------------------
# * Command Skill
#--------------------------------------------------------------------------
def command_skill
# If Main Command Active
if @command_window.active
# Activate Status Window
active_status_window
return
end
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command Equip
#--------------------------------------------------------------------------
def command_equip
# If Main Command Active
if @command_window.active
# Activate Status Window
active_status_window
return
end
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command Status
#--------------------------------------------------------------------------
def command_status
# If Main Command Active
if @command_window.active
# Activate Status Window
active_status_window
return
end
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command Order
#--------------------------------------------------------------------------
def command_order
# If Main Command Active
if @command_window.active
# Activate Status Window
active_status_window
@checker = 0
return
end
#Change Party Order by Yargovish
if @checker == 0
@changer = $game_party.actors[@status_window.index]
@where = @status_window.index
@checker = 1
else
$game_party.actors[@where] = $game_party.actors[@status_window.index]
$game_party.actors[@status_window.index] = @changer
@checker = 0
@status_window.refresh
$game_player.refresh #
end
end
#--------------------------------------------------------------------------
# * Command Party
#--------------------------------------------------------------------------
def command_party
# Switch to party change screen
#Put your Party Change Scene here
end
#--------------------------------------------------------------------------
# * Command Option
#--------------------------------------------------------------------------
def command_option
# Switch to party change screen
#Put your Option Scene here
end
#--------------------------------------------------------------------------
# * Command Quest
#--------------------------------------------------------------------------
def command_quest
# Switch to party change screen
#Put your Quest Scene here
end
#--------------------------------------------------------------------------
# * Command Save
#--------------------------------------------------------------------------
def command_save
# Switch to save screen
$scene = Scene_Save.new
end
#--------------------------------------------------------------------------
# * Command Load
#--------------------------------------------------------------------------
def command_load
# Switch to load screen
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
# * Command End Game
#--------------------------------------------------------------------------
def command_endgame
# Switch to end game screen
$scene = Scene_End.new
end
#--------------------------------------------------------------------------
# * Activate Status Window
#--------------------------------------------------------------------------
def active_status_window
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.visible = true
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end
Credits
- XRXS for Ring Menu
- Dubealex & Hypershadow180 for editing, useful menu windows and more
- SephirothSpawn for customizable ring menu command window