One Knight Stand
Member
I am trying to merge Syvkal's Ring Menu with Vlad's SBABS to make a game with a Secret of Mana-like feel. Here's the scripts I have in my game thus far:
Vlad's SBABS version 3.0 Basic
I replace the Requiem HUD script in Vlad's demo with this HUD script I've been working on:
I then add this version of Syvkal's Ring Menu script that I've been working on:
I've also replaced lines 46 - 61 of the default Game_Party script with the following code:
Below is a link to a zipped demo of what I'm working on. It includes all the scripts above, plus the necessary art work for what I'm doing (the demo is Vlad's demo with the modifications I made specfically for my game).
http://www.mediafire.com/?huyhtjmjtmt
Here's what I am trying to get the Ring Menu to do:
First, when you click on the Item option in the ring menu, you should be taken to a ring menu of all your items. When you press 1, 2, or 3 when on an item, that item should be set to its corresponding spot on the HUD and be available for use in the game when you press 1, 2, or 3. Also, I would like a little 1, 2, or 3 icon to show by the corner of items when they are "equipped" for use in the game.
Second, when you click on the Weapons option in the ring menu, you should be taken to a ring menu of all your weapons. When you press A (the attack button in the game), that item should become the equipped item. Also, like the item menu, I would like a little glove icon to show by the corner of the weapon that is currently equipped.
My system works exactly how I want it to right now save 3 problems:
1. Whenever I move on to a new map, the Items box of my HUD disappears, though it comes back if I push escape to go to the menu then exit out. I'd like that Items box to be up permanently.
2. Every item in my item menu has a little 1 by it. I need that fixed so that the 1 only shows by the item that is actually set to be used by the 1 button in the game, and 2 by the item set to be used by the 2 button in the game, and the same for 3.
3. Every item in my weapon menu has a glove by it. I only want it to show by the weapon that is actually equipped.
These three items are what I need help with. Item 1 should be fixable in my replacement HUD script, and items 2 and 3 should be fixable around lines 595 - 612 of my Ring Menu script. Any help I can get on these items would be most appreciated.
Vlad's SBABS version 3.0 Basic
I replace the Requiem HUD script in Vlad's demo with this HUD script I've been working on:
#==============================================================================
# Crissaegrim HUD
#==============================================================================
module Crissaegrim_Hud
# HUD Background Image
Background = "HUD-Background"
end
#==============================================================================
class Requiem_HUD < Window_Base
def initialize
super(0,0,544,416)
self.opacity = 0
end
def update
@actor = $game_party.members[0]
self.contents.font.size = 16
self.contents.clear
refresh
end
def refresh
actor = $game_party.members[0]
draw_actor_hp(@actor, 5, 0)
draw_actor_mp(@actor, 135, 0)
draw_items(460,388)
end
def show_icon(item, x, y)
if item != nil
draw_icon(item.icon_index, x, y)
end
end
def draw_hp(actor, x, y)
back = Cache.system(Crissaegrim_Hud::Base)
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x, y-ch+24, back, src_rect)
meter = Cache.system(Crissaegrim_Hud::HP_Bar)
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x+5, y-ch+17, meter, src_rect)
end
def draw_mp(actor, x, y)
back = Cache.system(Crissaegrim_Hud::Base)
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x, y-ch+24, back, src_rect)
meter = Cache.system(Crissaegrim_Hud::MP_Bar)
cw = meter.width * actor.mp / actor.maxmp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x+5, y-ch+17, meter, src_rect)
end
def draw_items(x,y)
item_count = 0
for btn in @actor.item_hotkeys.keys
next if btn == nil
item = $data_items[@actor.item_hotkeys[btn]]
next if item == nil
x = 432
show_icon(item, (29 * item_count) + x, 0)
item_count += 1
self.contents.font.size = 16
self.contents.font.color = text_color(0)
self.contents.draw_text((29 * item_count) + x-28, 9, 32, 28, $game_party.item_number(item),1)
end
end
end
#------------------------------------------------------------------------------
class Scene_Map < Scene_Base
alias crissaegrim_abs_hud_start start
alias crissaegrim_abs_hud_update update
alias crissaegrim_abs_hud_terminate terminate
def start
crissaegrim_abs_hud_start
@bg = Sprite.new
@bg.bitmap = Cache.system(Crissaegrim_Hud::Background)
@hud = Requiem_HUD.new
end
def update
crissaegrim_abs_hud_update
@bg.update
@hud.update
end
def terminate
crissaegrim_abs_hud_terminate
@bg.dispose
@hud.dispose
end
end
# Crissaegrim HUD
#==============================================================================
module Crissaegrim_Hud
# HUD Background Image
Background = "HUD-Background"
end
#==============================================================================
class Requiem_HUD < Window_Base
def initialize
super(0,0,544,416)
self.opacity = 0
end
def update
@actor = $game_party.members[0]
self.contents.font.size = 16
self.contents.clear
refresh
end
def refresh
actor = $game_party.members[0]
draw_actor_hp(@actor, 5, 0)
draw_actor_mp(@actor, 135, 0)
draw_items(460,388)
end
def show_icon(item, x, y)
if item != nil
draw_icon(item.icon_index, x, y)
end
end
def draw_hp(actor, x, y)
back = Cache.system(Crissaegrim_Hud::Base)
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x, y-ch+24, back, src_rect)
meter = Cache.system(Crissaegrim_Hud::HP_Bar)
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x+5, y-ch+17, meter, src_rect)
end
def draw_mp(actor, x, y)
back = Cache.system(Crissaegrim_Hud::Base)
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x, y-ch+24, back, src_rect)
meter = Cache.system(Crissaegrim_Hud::MP_Bar)
cw = meter.width * actor.mp / actor.maxmp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x+5, y-ch+17, meter, src_rect)
end
def draw_items(x,y)
item_count = 0
for btn in @actor.item_hotkeys.keys
next if btn == nil
item = $data_items[@actor.item_hotkeys[btn]]
next if item == nil
x = 432
show_icon(item, (29 * item_count) + x, 0)
item_count += 1
self.contents.font.size = 16
self.contents.font.color = text_color(0)
self.contents.draw_text((29 * item_count) + x-28, 9, 32, 28, $game_party.item_number(item),1)
end
end
end
#------------------------------------------------------------------------------
class Scene_Map < Scene_Base
alias crissaegrim_abs_hud_start start
alias crissaegrim_abs_hud_update update
alias crissaegrim_abs_hud_terminate terminate
def start
crissaegrim_abs_hud_start
@bg = Sprite.new
@bg.bitmap = Cache.system(Crissaegrim_Hud::Background)
@hud = Requiem_HUD.new
end
def update
crissaegrim_abs_hud_update
@bg.update
@hud.update
end
def terminate
crissaegrim_abs_hud_terminate
@bg.dispose
@hud.dispose
end
end
I then add this version of Syvkal's Ring Menu script that I've been working on:
#==============================================================================
# ** Ring Menu
#-------------------------------------------------------------------------------
# by Syvkal
# Version 1.1
# 06-23-08
#==============================================================================
#===================================================#
# ** C O N F I G U R A T I O N S Y S T E M ** #
#===================================================#
# Amount of frames for Startup Animation
STARTUP_FRAMES = 20
# Amount of frames for Movement Animation
MOVING_FRAMES = 15
# Radius of the Menu Ring
RING_R = 75
#-------------D-O---N-O-T---T-O-U-C-H---------------#
class Scene_Title < Scene_Base
alias game_objects_original create_game_objects
def create_game_objects
game_objects_original
#-------------D-O---N-O-T---T-O-U-C-H---------------#
# As this script allows you to make a custom Menu I thought to make it easier
# I would make it possible to add extra Menu Options from here
# All you need to do is specify the Text to display, the icon and the command
# The command must be in a STRING
# Simply add to the array below :
$game_ring_menu = [
# Menu Option 0 eg. Item
[Vocab::item, Cache::picture('Icon_Items'), "$scene = Scene_Itemequip.new"],
# Menu Option 1 eg. Skill
["Weapons", Cache::picture('Icon_Skills'), "$scene = Scene_Weaponequip.new"],
# Menu Option 3 eg. Status
[Vocab::status, Cache::picture('Icon_Status'), "$scene = Scene_Status.new"],
#---------------------------------------------------#
# ** I N S E R T M O R E H E R E ** #
#---------------------------------------------------#
# Preferably Insert your custom Menu Options Here
# Otherwise the existing Menu Options will return to wrong point on the Menu
# Menu Option 6 eg. End Game
[Vocab::game_end, Cache::picture('Icon_End'), "$scene = Scene_Endmenu.new"]
] # <--- Do no Delete This
#===================================================#
# ** E N D C O N F I G U R A T I O N ** #
#===================================================#
$game_end_menu = [
["To Title", Cache::picture('Icon_Items'), "$scene = Scene_Title.new"],
["Exit", Cache::picture('Icon_Skills'), "$scene = nil"]
]
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# Edited to add Ring Menu
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias initialize_original initialize
alias start_selection_original start_actor_selection
alias end_selection_original end_actor_selection
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(menu_index = 0, move = true)
@move = move
initialize_original(menu_index)
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@command_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
if @command_window.active
update_command_selection
end
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
commands = []
for i in 0...$game_ring_menu.size
commands.push($game_ring_menu[0])
end
icons = []
for i in 0...$game_ring_menu.size
icons.push($game_ring_menu[1])
end
@command_window = Window_RingMenu.new(232, 164, commands, icons, nil, @move, @menu_index)
if $game_party.items.size == 0
@command_window.disable_item(0)
end
if $game_party.weapons.size == 0
@command_window.disable_item(1)
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.items.size == 0 and @command_window.index == 0
Sound.play_buzzer
return
elsif $game_party.weapons.size == 0 and @command_window.index == 1
Sound.play_buzzer
return
end
Sound.play_decision
eval($game_ring_menu[@command_window.index][2])
end
end
end
#----------------------------------------------------------------------------
# Scene End Menu
#----------------------------------------------------------------------------
class Scene_Endmenu < Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(menu_index = 0, move = true)
@move = move
initialize_original(menu_index)
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
create_menu_background
create_end_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
dispose_menu_background
@end_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_menu_background
@end_window.update
if @end_window.active
update_command_selection
end
end
#--------------------------------------------------------------------------
# * Create End Window
#--------------------------------------------------------------------------
def create_end_window
commands = []
for i in 0...$game_end_menu.size
commands.push($game_end_menu[0])
end
icons = []
for i in 0...$game_end_menu.size
icons.push($game_end_menu[1])
end
@end_window = Window_RingMenu.new(232, 164, commands, icons, nil, @move, @menu_index)
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Menu.new
elsif Input.trigger?(Input::C)
Sound.play_decision
RPG::BGM.fade(800)
RPG::BGS.fade(800)
RPG::ME.fade(800)
Graphics.fadeout(60)
eval($game_end_menu[@end_window.index][2])
end
end
end
#----------------------------------------------------------------------------
# Scene Item Equip
#----------------------------------------------------------------------------
class Scene_Itemequip < Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(move = true)
@move = move
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
create_menu_background
create_itemequip_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
dispose_menu_background
@itemequip_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_menu_background
@itemequip_window.update
if @itemequip_window.active
update_choice_selection
end
end
#--------------------------------------------------------------------------
# * Create Item Equip Window
#--------------------------------------------------------------------------
def create_itemequip_window
commands = []
for i in 0...$game_party.items.size
commands = $game_party.items.name
end
icons = []
for i in 0...$game_party.items.size
icons = $game_party.items.icon_index
end
@itemid = []
for i in 0...$game_party.items.size
@itemid = $game_party.items.id
end
@itemequip_window = Window_RingMenu.new(232, 164, commands, icons, @itemid, @move,
$game_party.last_item_id, false, true)
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_choice_selection
@actor = $game_party.members[0]
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Menu.new
elsif Input.trigger?(Input::Numberkeys[1])
Sound.play_equip
@actor.item_hotkeys[Input::Numberkeys[1]] = @itemid[@itemequip_window.index]
elsif Input.trigger?(Input::Numberkeys[2])
Sound.play_equip
@actor.item_hotkeys[Input::Numberkeys[2]] = @itemid[@itemequip_window.index]
elsif Input.trigger?(Input::Numberkeys[3])
Sound.play_equip
@actor.item_hotkeys[Input::Numberkeys[3]] = @itemid[@itemequip_window.index]
end
end
end
#----------------------------------------------------------------------------
# Scene Weapon Equip
#----------------------------------------------------------------------------
class Scene_Weaponequip < Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(move = true)
@move = move
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
create_menu_background
create_weaponequip_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
dispose_menu_background
@weaponequip_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_menu_background
@weaponequip_window.update
if @weaponequip_window.active
update_choice_selection
end
end
#--------------------------------------------------------------------------
# * Create Weapon Equip Window
#--------------------------------------------------------------------------
def create_weaponequip_window
commands = []
for i in 0...$game_party.weapons.size
commands = $game_party.weapons.name
end
icons = []
for i in 0...$game_party.weapons.size
icons = $game_party.weapons.icon_index
end
@itemid = []
for i in 0...$game_party.weapons.size
@itemid = $game_party.weapons.id
end
@weaponequip_window = Window_RingMenu.new(232, 164, commands, icons, @itemid, @move,
$game_party.last_item_id, true)
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_choice_selection
actor = $game_party.members[0]
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Menu.new
elsif Input.trigger?(Input::Letters["A"])
Sound.play_equip
actor.change_equip_by_id(0, @itemid[@weaponequip_window.index])
end
end
end
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
# Edited to return to the menu properly when loading
#==============================================================================
class Scene_File
alias return_scene_original return_scene
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
if @saving
$scene = Scene_Menu.new($game_ring_menu.size - 3)
else
$scene = Scene_Menu.new($game_ring_menu.size - 2)
end
end
end
end
#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
# Edited to return to the menu properly due to loading being added
#==============================================================================
class Scene_End
alias return_scene_original return_scene
def return_scene
$scene = Scene_Menu.new($game_ring_menu.size - 1)
end
end
#==============================================================================
# ** Window_RingMenu
#------------------------------------------------------------------------------
# This Window creates a Ring Menu system
#==============================================================================
class Window_RingMenu < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :index
attr_reader :item_max
attr_reader :weapon_id
#--------------------------------------------------------------------------
# * Refresh Setup
#--------------------------------------------------------------------------
START = 1
WAIT = 2
MOVER = 3
MOVEL = 4
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(center_x, center_y, commands, items, itemid, move = true, index = 0, weapons = false, equipitem = false)
super(0, 0, 544, 416)
self.contents = Bitmap.new(width-32, height-32)
self.opacity = 0
@move = move
@startup = STARTUP_FRAMES
@commands = commands
@item_max = commands.size
@index = index
@items = items
@weapons = weapons
@itemid = itemid
@equipitem = equipitem
@disabled = []
for i in 0...commands.size-1
@disabled = false
end
@cx = center_x
@cy = center_y
start_setup
refresh
end
#--------------------------------------------------------------------------
# * Start Setup
#--------------------------------------------------------------------------
def start_setup
@mode = START
@steps = @startup
end
#--------------------------------------------------------------------------
# * Disable index
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
@disabled[index] = true
end
#--------------------------------------------------------------------------
# * Determines if is moving
#--------------------------------------------------------------------------
def animation?
return @mode != WAIT
end
#--------------------------------------------------------------------------
# * Determine if cursor is moveable
#--------------------------------------------------------------------------
def cursor_movable?
return false if (not visible or not active)
return false if (@opening or @closing)
return false if animation?
return true
end
#--------------------------------------------------------------------------
# * Move cursor right
#--------------------------------------------------------------------------
def cursor_right
@index -= 1
@index = @items.size - 1 if @index < 0
@mode = MOVER
@steps = MOVING_FRAMES
end
#--------------------------------------------------------------------------
# * Move cursor left
#--------------------------------------------------------------------------
def cursor_left
@index += 1
@index = 0 if @index >= @items.size
@mode = MOVEL
@steps = MOVING_FRAMES
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if self.active
if cursor_movable?
last_index = @index
if Input.repeat?(Input::RIGHT)
cursor_right
end
if Input.repeat?(Input::LEFT)
cursor_left
end
if @index != last_index
Sound.play_cursor
end
end
refresh
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
case @mode
when START
refresh_start
when WAIT
refresh_wait
when MOVER
refresh_move(1)
when MOVEL
refresh_move(0)
end
rect = Rect.new(18, 196, self.contents.width-32, 32)
self.contents.draw_text(rect, @commands[@index], 1)
end
#--------------------------------------------------------------------------
# * Refresh Start Period
#--------------------------------------------------------------------------
def refresh_start
d1 = 2.0 * Math::PI / @item_max
d2 = 1.0 * Math::PI / @startup
for i in 0...@item_max
j = i - @index
if @move
r = RING_R - 1.0 * RING_R * @steps / @startup
d = d1 * j + d2 * @steps
else
r = RING_R
d = d1 * j
end
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 = WAIT
end
end
#--------------------------------------------------------------------------
# * Refresh Wait Period
#--------------------------------------------------------------------------
def refresh_wait
d = 2.0 * Math::PI / @item_max
for i in 0...@item_max
j = i - @index
x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
draw_item(x, y, i)
end
end
#--------------------------------------------------------------------------
# * Refresh Movement Period
#--------------------------------------------------------------------------
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
d = d1 * j + d2 * @steps
x = @cx + ( RING_R * Math.sin( d ) ).to_i
y = @cy - ( RING_R * Math.cos( d ) ).to_i
draw_item(x, y, i)
end
@steps -= 1
if @steps < 1
@mode = WAIT
end
end
#--------------------------------------------------------------------------
# * Draw Item
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# index : item number
#--------------------------------------------------------------------------
def draw_item(x, y, index)
if @weapons
actor = $data_actors[1]
rect = Rect.new(0, 0, 48, 48)
draw_icon(@items[index], x + 12, y + 12)
if actor.weapon_id = @itemid[index]
self.contents.blt( x, y, Cache::picture('Icon_Glove'), rect )
end
elsif @equipitem
@actor = $game_party.members[0]
rect = Rect.new(0, 0, 48, 48)
draw_icon(@items[index], x + 12, y + 12)
if @actor.item_hotkeys[Input::Numberkeys[1]] = @itemid[index]
self.contents.blt( x, y, Cache::picture('Icon_One'), rect )
elsif @actor.item_hotkeys[Input::Numberkeys[2]] = @itemid[index]
self.contents.blt( x, y, Cache::picture('Icon_Two'), rect )
elsif @actor.item_hotkeys[Input::Numberkeys[3]] = @itemid[index]
self.contents.blt( x, y, Cache::picture('Icon_Three'), rect )
end
else
rect = Rect.new(0, 0, @items[index].width, @items[index].height)
if @index == index
self.contents.blt( x, y, @items[index], rect )
if @disabled[@index]
self.contents.blt( x, y, Cache::picture('Icon_Disable'), rect )
end
else
self.contents.blt( x, y, @items[index], rect, 128 )
end
end
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# Edited to allow disabled character icons
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Character Graphic
#--------------------------------------------------------------------------
def draw_character(character_name, character_index, x, y, enabled = true)
return if character_name == nil
bitmap = Cache.character(character_name)
sign = character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, enabled ? 255 : 128)
end
end
# ** Ring Menu
#-------------------------------------------------------------------------------
# by Syvkal
# Version 1.1
# 06-23-08
#==============================================================================
#===================================================#
# ** C O N F I G U R A T I O N S Y S T E M ** #
#===================================================#
# Amount of frames for Startup Animation
STARTUP_FRAMES = 20
# Amount of frames for Movement Animation
MOVING_FRAMES = 15
# Radius of the Menu Ring
RING_R = 75
#-------------D-O---N-O-T---T-O-U-C-H---------------#
class Scene_Title < Scene_Base
alias game_objects_original create_game_objects
def create_game_objects
game_objects_original
#-------------D-O---N-O-T---T-O-U-C-H---------------#
# As this script allows you to make a custom Menu I thought to make it easier
# I would make it possible to add extra Menu Options from here
# All you need to do is specify the Text to display, the icon and the command
# The command must be in a STRING
# Simply add to the array below :
$game_ring_menu = [
# Menu Option 0 eg. Item
[Vocab::item, Cache::picture('Icon_Items'), "$scene = Scene_Itemequip.new"],
# Menu Option 1 eg. Skill
["Weapons", Cache::picture('Icon_Skills'), "$scene = Scene_Weaponequip.new"],
# Menu Option 3 eg. Status
[Vocab::status, Cache::picture('Icon_Status'), "$scene = Scene_Status.new"],
#---------------------------------------------------#
# ** I N S E R T M O R E H E R E ** #
#---------------------------------------------------#
# Preferably Insert your custom Menu Options Here
# Otherwise the existing Menu Options will return to wrong point on the Menu
# Menu Option 6 eg. End Game
[Vocab::game_end, Cache::picture('Icon_End'), "$scene = Scene_Endmenu.new"]
] # <--- Do no Delete This
#===================================================#
# ** E N D C O N F I G U R A T I O N ** #
#===================================================#
$game_end_menu = [
["To Title", Cache::picture('Icon_Items'), "$scene = Scene_Title.new"],
["Exit", Cache::picture('Icon_Skills'), "$scene = nil"]
]
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# Edited to add Ring Menu
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias initialize_original initialize
alias start_selection_original start_actor_selection
alias end_selection_original end_actor_selection
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(menu_index = 0, move = true)
@move = move
initialize_original(menu_index)
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@command_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
if @command_window.active
update_command_selection
end
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
commands = []
for i in 0...$game_ring_menu.size
commands.push($game_ring_menu[0])
end
icons = []
for i in 0...$game_ring_menu.size
icons.push($game_ring_menu[1])
end
@command_window = Window_RingMenu.new(232, 164, commands, icons, nil, @move, @menu_index)
if $game_party.items.size == 0
@command_window.disable_item(0)
end
if $game_party.weapons.size == 0
@command_window.disable_item(1)
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.items.size == 0 and @command_window.index == 0
Sound.play_buzzer
return
elsif $game_party.weapons.size == 0 and @command_window.index == 1
Sound.play_buzzer
return
end
Sound.play_decision
eval($game_ring_menu[@command_window.index][2])
end
end
end
#----------------------------------------------------------------------------
# Scene End Menu
#----------------------------------------------------------------------------
class Scene_Endmenu < Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(menu_index = 0, move = true)
@move = move
initialize_original(menu_index)
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
create_menu_background
create_end_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
dispose_menu_background
@end_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_menu_background
@end_window.update
if @end_window.active
update_command_selection
end
end
#--------------------------------------------------------------------------
# * Create End Window
#--------------------------------------------------------------------------
def create_end_window
commands = []
for i in 0...$game_end_menu.size
commands.push($game_end_menu[0])
end
icons = []
for i in 0...$game_end_menu.size
icons.push($game_end_menu[1])
end
@end_window = Window_RingMenu.new(232, 164, commands, icons, nil, @move, @menu_index)
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Menu.new
elsif Input.trigger?(Input::C)
Sound.play_decision
RPG::BGM.fade(800)
RPG::BGS.fade(800)
RPG::ME.fade(800)
Graphics.fadeout(60)
eval($game_end_menu[@end_window.index][2])
end
end
end
#----------------------------------------------------------------------------
# Scene Item Equip
#----------------------------------------------------------------------------
class Scene_Itemequip < Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(move = true)
@move = move
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
create_menu_background
create_itemequip_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
dispose_menu_background
@itemequip_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_menu_background
@itemequip_window.update
if @itemequip_window.active
update_choice_selection
end
end
#--------------------------------------------------------------------------
# * Create Item Equip Window
#--------------------------------------------------------------------------
def create_itemequip_window
commands = []
for i in 0...$game_party.items.size
commands = $game_party.items.name
end
icons = []
for i in 0...$game_party.items.size
icons = $game_party.items.icon_index
end
@itemid = []
for i in 0...$game_party.items.size
@itemid = $game_party.items.id
end
@itemequip_window = Window_RingMenu.new(232, 164, commands, icons, @itemid, @move,
$game_party.last_item_id, false, true)
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_choice_selection
@actor = $game_party.members[0]
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Menu.new
elsif Input.trigger?(Input::Numberkeys[1])
Sound.play_equip
@actor.item_hotkeys[Input::Numberkeys[1]] = @itemid[@itemequip_window.index]
elsif Input.trigger?(Input::Numberkeys[2])
Sound.play_equip
@actor.item_hotkeys[Input::Numberkeys[2]] = @itemid[@itemequip_window.index]
elsif Input.trigger?(Input::Numberkeys[3])
Sound.play_equip
@actor.item_hotkeys[Input::Numberkeys[3]] = @itemid[@itemequip_window.index]
end
end
end
#----------------------------------------------------------------------------
# Scene Weapon Equip
#----------------------------------------------------------------------------
class Scene_Weaponequip < Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(move = true)
@move = move
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
create_menu_background
create_weaponequip_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
dispose_menu_background
@weaponequip_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_menu_background
@weaponequip_window.update
if @weaponequip_window.active
update_choice_selection
end
end
#--------------------------------------------------------------------------
# * Create Weapon Equip Window
#--------------------------------------------------------------------------
def create_weaponequip_window
commands = []
for i in 0...$game_party.weapons.size
commands = $game_party.weapons.name
end
icons = []
for i in 0...$game_party.weapons.size
icons = $game_party.weapons.icon_index
end
@itemid = []
for i in 0...$game_party.weapons.size
@itemid = $game_party.weapons.id
end
@weaponequip_window = Window_RingMenu.new(232, 164, commands, icons, @itemid, @move,
$game_party.last_item_id, true)
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_choice_selection
actor = $game_party.members[0]
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Menu.new
elsif Input.trigger?(Input::Letters["A"])
Sound.play_equip
actor.change_equip_by_id(0, @itemid[@weaponequip_window.index])
end
end
end
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
# Edited to return to the menu properly when loading
#==============================================================================
class Scene_File
alias return_scene_original return_scene
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
if @saving
$scene = Scene_Menu.new($game_ring_menu.size - 3)
else
$scene = Scene_Menu.new($game_ring_menu.size - 2)
end
end
end
end
#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
# Edited to return to the menu properly due to loading being added
#==============================================================================
class Scene_End
alias return_scene_original return_scene
def return_scene
$scene = Scene_Menu.new($game_ring_menu.size - 1)
end
end
#==============================================================================
# ** Window_RingMenu
#------------------------------------------------------------------------------
# This Window creates a Ring Menu system
#==============================================================================
class Window_RingMenu < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :index
attr_reader :item_max
attr_reader :weapon_id
#--------------------------------------------------------------------------
# * Refresh Setup
#--------------------------------------------------------------------------
START = 1
WAIT = 2
MOVER = 3
MOVEL = 4
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(center_x, center_y, commands, items, itemid, move = true, index = 0, weapons = false, equipitem = false)
super(0, 0, 544, 416)
self.contents = Bitmap.new(width-32, height-32)
self.opacity = 0
@move = move
@startup = STARTUP_FRAMES
@commands = commands
@item_max = commands.size
@index = index
@items = items
@weapons = weapons
@itemid = itemid
@equipitem = equipitem
@disabled = []
for i in 0...commands.size-1
@disabled = false
end
@cx = center_x
@cy = center_y
start_setup
refresh
end
#--------------------------------------------------------------------------
# * Start Setup
#--------------------------------------------------------------------------
def start_setup
@mode = START
@steps = @startup
end
#--------------------------------------------------------------------------
# * Disable index
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
@disabled[index] = true
end
#--------------------------------------------------------------------------
# * Determines if is moving
#--------------------------------------------------------------------------
def animation?
return @mode != WAIT
end
#--------------------------------------------------------------------------
# * Determine if cursor is moveable
#--------------------------------------------------------------------------
def cursor_movable?
return false if (not visible or not active)
return false if (@opening or @closing)
return false if animation?
return true
end
#--------------------------------------------------------------------------
# * Move cursor right
#--------------------------------------------------------------------------
def cursor_right
@index -= 1
@index = @items.size - 1 if @index < 0
@mode = MOVER
@steps = MOVING_FRAMES
end
#--------------------------------------------------------------------------
# * Move cursor left
#--------------------------------------------------------------------------
def cursor_left
@index += 1
@index = 0 if @index >= @items.size
@mode = MOVEL
@steps = MOVING_FRAMES
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if self.active
if cursor_movable?
last_index = @index
if Input.repeat?(Input::RIGHT)
cursor_right
end
if Input.repeat?(Input::LEFT)
cursor_left
end
if @index != last_index
Sound.play_cursor
end
end
refresh
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
case @mode
when START
refresh_start
when WAIT
refresh_wait
when MOVER
refresh_move(1)
when MOVEL
refresh_move(0)
end
rect = Rect.new(18, 196, self.contents.width-32, 32)
self.contents.draw_text(rect, @commands[@index], 1)
end
#--------------------------------------------------------------------------
# * Refresh Start Period
#--------------------------------------------------------------------------
def refresh_start
d1 = 2.0 * Math::PI / @item_max
d2 = 1.0 * Math::PI / @startup
for i in 0...@item_max
j = i - @index
if @move
r = RING_R - 1.0 * RING_R * @steps / @startup
d = d1 * j + d2 * @steps
else
r = RING_R
d = d1 * j
end
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 = WAIT
end
end
#--------------------------------------------------------------------------
# * Refresh Wait Period
#--------------------------------------------------------------------------
def refresh_wait
d = 2.0 * Math::PI / @item_max
for i in 0...@item_max
j = i - @index
x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
draw_item(x, y, i)
end
end
#--------------------------------------------------------------------------
# * Refresh Movement Period
#--------------------------------------------------------------------------
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
d = d1 * j + d2 * @steps
x = @cx + ( RING_R * Math.sin( d ) ).to_i
y = @cy - ( RING_R * Math.cos( d ) ).to_i
draw_item(x, y, i)
end
@steps -= 1
if @steps < 1
@mode = WAIT
end
end
#--------------------------------------------------------------------------
# * Draw Item
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# index : item number
#--------------------------------------------------------------------------
def draw_item(x, y, index)
if @weapons
actor = $data_actors[1]
rect = Rect.new(0, 0, 48, 48)
draw_icon(@items[index], x + 12, y + 12)
if actor.weapon_id = @itemid[index]
self.contents.blt( x, y, Cache::picture('Icon_Glove'), rect )
end
elsif @equipitem
@actor = $game_party.members[0]
rect = Rect.new(0, 0, 48, 48)
draw_icon(@items[index], x + 12, y + 12)
if @actor.item_hotkeys[Input::Numberkeys[1]] = @itemid[index]
self.contents.blt( x, y, Cache::picture('Icon_One'), rect )
elsif @actor.item_hotkeys[Input::Numberkeys[2]] = @itemid[index]
self.contents.blt( x, y, Cache::picture('Icon_Two'), rect )
elsif @actor.item_hotkeys[Input::Numberkeys[3]] = @itemid[index]
self.contents.blt( x, y, Cache::picture('Icon_Three'), rect )
end
else
rect = Rect.new(0, 0, @items[index].width, @items[index].height)
if @index == index
self.contents.blt( x, y, @items[index], rect )
if @disabled[@index]
self.contents.blt( x, y, Cache::picture('Icon_Disable'), rect )
end
else
self.contents.blt( x, y, @items[index], rect, 128 )
end
end
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# Edited to allow disabled character icons
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Character Graphic
#--------------------------------------------------------------------------
def draw_character(character_name, character_index, x, y, enabled = true)
return if character_name == nil
bitmap = Cache.character(character_name)
sign = character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, enabled ? 255 : 128)
end
end
I've also replaced lines 46 - 61 of the default Game_Party script with the following code:
#--------------------------------------------------------------------------
# * Get Item Object Array
#--------------------------------------------------------------------------
def items
result = []
for i in @items.keys.sort
result.push($data_items) if @items > 0
end
return result
end
#--------------------------------------------------------------------------
# * Get Weapon Object Array
#--------------------------------------------------------------------------
def weapons
result = []
for i in @weapons.keys.sort
result.push($data_weapons) if @weapons > -1
end
return result
end
# * Get Item Object Array
#--------------------------------------------------------------------------
def items
result = []
for i in @items.keys.sort
result.push($data_items) if @items > 0
end
return result
end
#--------------------------------------------------------------------------
# * Get Weapon Object Array
#--------------------------------------------------------------------------
def weapons
result = []
for i in @weapons.keys.sort
result.push($data_weapons) if @weapons > -1
end
return result
end
Below is a link to a zipped demo of what I'm working on. It includes all the scripts above, plus the necessary art work for what I'm doing (the demo is Vlad's demo with the modifications I made specfically for my game).
http://www.mediafire.com/?huyhtjmjtmt
Here's what I am trying to get the Ring Menu to do:
First, when you click on the Item option in the ring menu, you should be taken to a ring menu of all your items. When you press 1, 2, or 3 when on an item, that item should be set to its corresponding spot on the HUD and be available for use in the game when you press 1, 2, or 3. Also, I would like a little 1, 2, or 3 icon to show by the corner of items when they are "equipped" for use in the game.
Second, when you click on the Weapons option in the ring menu, you should be taken to a ring menu of all your weapons. When you press A (the attack button in the game), that item should become the equipped item. Also, like the item menu, I would like a little glove icon to show by the corner of the weapon that is currently equipped.
My system works exactly how I want it to right now save 3 problems:
1. Whenever I move on to a new map, the Items box of my HUD disappears, though it comes back if I push escape to go to the menu then exit out. I'd like that Items box to be up permanently.
2. Every item in my item menu has a little 1 by it. I need that fixed so that the 1 only shows by the item that is actually set to be used by the 1 button in the game, and 2 by the item set to be used by the 2 button in the game, and the same for 3.
3. Every item in my weapon menu has a glove by it. I only want it to show by the weapon that is actually equipped.
These three items are what I need help with. Item 1 should be fixable in my replacement HUD script, and items 2 and 3 should be fixable around lines 595 - 612 of my Ring Menu script. Any help I can get on these items would be most appreciated.