[RGSS][Ring Menu]

Fórum para a postagem de tutoriais e dúvidas de Rpg Maker XP, VX e VX Ace.
Responder
helivelton
Membro (Marechal)
Mensagens: 1350
Registrado em: Qua Fev 28, 2007 4:04 pm
Maker Preferido: Rpg Maker 2003

[RGSS][Ring Menu]

Mensagem por helivelton » Qui Mar 29, 2007 4:07 pm

Abra o seu editor de scripts, e crie 2 scripts acima da classe Arrow_Base, e coloque os 2 sequintes scripts nele:
#==============================================================================
# Window_RingMenu
#==============================================================================
#==============================================================================
# Editado por MakirouAru e modificado por boushy
#==============================================================================
class Window_RingMenu < Window_Base
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
STARTUP_FRAMES = 20 #
MOVING_FRAMES = 5 #
RING_R = 64 #
ICON_ITEM = RPG::Cache.icon("034-Item03") #
ICON_SKILL = RPG::Cache.icon("044-Skill01") #
ICON_EQUIP = RPG::Cache.icon("001-Weapon01") #
ICON_STATUS = RPG::Cache.icon("050-Skill07") #
ICON_SAVE = RPG::Cache.icon("038-Item07") #
ICON_EXIT = RPG::Cache.icon("046-Skill03") #
ICON_DISABLE= RPG::Cache.icon("") #
SE_STARTUP = "056-Right02" #
MODE_START = 1 #
MODE_WAIT = 2 #
MODE_MOVER = 3 #
MODE_MOVEL = 4 #
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
attr_accessor :index
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def initialize( center_x, center_y )
super(0, 0, 640, 480)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = "Arial"
self.opacity = 0
self.back_opacity = 0
s1 = "Itens"
s2 = "Magias"
s3 = "Equipamento"
s4 = "Status"
s5 = "Salvar"
s6 = "Sair"
@commands = [ s1, s2, s3, s4, s5, s6 ]
@item_max = 6
@index = 0
@items = [ ICON_ITEM, ICON_SKILL, ICON_EQUIP, ICON_STATUS, ICON_SAVE, ICON_EXIT ]
@disabled = [ false, false, false, false, false, false ]
@cx = center_x - 16
@cy = center_y - 16
setup_move_start
refresh
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def update
super
refresh
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
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
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def refresh_start
d1 = 2.0 * Math::PI / @item_max
d2 = 1.0 * Math::PI / STARTUP_FRAMES
r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES
for i in 0...@item_max
j = i - @index
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
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
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
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
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 = MODE_WAIT
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def draw_item(x, y, i)
#p "x=" + x.to_s + " y=" + y.to_s + " i=" + @items[i].to_s
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
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def disable_item(index)
@disabled[index] = true
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def setup_move_start
@mode = MODE_START
@steps = STARTUP_FRAMES
if SE_STARTUP != nil and SE_STARTUP != ""
Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100)
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def setup_move_move(mode)
if mode == MODE_MOVER
@index -= 1
@index = @items.size - 1 if @index <0>= @items.size
else
return
end
@mode = mode
@steps = MOVING_FRAMES
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def animation?
return @mode != MODE_WAIT
end
end Aqui está o outro script:

#==============================================================================
# Window_MenuStatus
#==============================================================================

class Window_RingMenuStatus < Window_Base
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
STARTUP_FRAMES = 20 #
MOVING_FRAMES = 5 #
RING_R = 64 #
ICON_SKILL = RPG::Cache.icon("044-Skill01") #
ICON_EQUIP = RPG::Cache.icon("001-Weapon01") #
ICON_STATUS = RPG::Cache.icon("050-Skill07") #
ICON_SAVE = RPG::Cache.icon("038-Item07") #
ICON_EXIT = RPG::Cache.icon("046-Skill03") #
ICON_DISABLE= RPG::Cache.icon("") #
SE_STARTUP = "056-Right02" #
MODE_START = 1 #
MODE_WAIT = 2 #
MODE_MOVER = 3 #
MODE_MOVEL = 4 #
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
attr_accessor :index
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def initialize( center_x, center_y )

actor=$game_party.actors[0]
if actor !=nil
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
end
actor1=$game_party.actors[1]
if actor1 !=nil
bitmap1 = RPG::Cache.character(actor1.character_name, actor.character_hue)
end
actor2=$game_party.actors[2]
if actor2 !=nil
bitmap2 = RPG::Cache.character(actor2.character_name, actor.character_hue)
end
actor3=$game_party.actors[3]
if actor3 !=nil
bitmap3 = RPG::Cache.character(actor3.character_name, actor.character_hue)
end
super(0, 0, 640, 480)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = "Arial"
self.opacity = 0
self.back_opacity = 0
if $game_party.actors.size==4

s1 = actor.name
s2 = actor1.name
s3 = actor2.name
s4 = actor3.name
@commands = [ s1, s2, s3, s4]
else
if $game_party.actors.size==3

s1 = actor.name
s2 = actor1.name
s3 = actor2.name

@commands = [ s1, s2, s3]
else
if $game_party.actors.size==2

s1 = actor.name
s2 = actor1.name

@commands = [ s1, s2]
else
if $game_party.actors.size==1

s1 = actor.name

@commands = [ s1]
else
if $game_party.actors.size==0


@commands = [ ]
end
end
end
end
end
@item_max = 4

if actor3 ==nil
@item_max = 3
end
if actor2 ==nil and actor3 ==nil
@item_max = 2
end
if actor1 ==nil and actor2 ==nil and actor3 ==nil
@item_max = 1
end
if actor ==nil and actor1 ==nil and actor2 ==nil and actor3 ==nil
@item_max = 0
end

@index = 0
if $game_party.actors.size==4
@items = [ bitmap,bitmap1,bitmap2,bitmap3]
end
if $game_party.actors.size==3
@items = [ bitmap, bitmap1, bitmap2]
end
if $game_party.actors.size==2
@items = [ bitmap, bitmap1]
end
if $game_party.actors.size==1
@items = [ bitmap]
end
if $game_party.actors.size==0
@items = [ ]
end

@disabled = [ false, false, false, false, false, false ]
@cx = center_x - 16
@cy = center_y - 16
setup_move_start
refresh
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def update
super
refresh
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
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
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def refresh_start
d1 = 2.0 * Math::PI / @item_max
d2 = 1.0 * Math::PI / STARTUP_FRAMES
r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES
for i in 0...@item_max
j = i - @index
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
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
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
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
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 = MODE_WAIT
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def draw_item(x, y, i)
#p "x=" + x.to_s + " y=" + y.to_s + " i=" + @items[i].to_s
cw = @items[i].width / 4
ch = @items[i].height / 9#4 pour taille normal


rect = Rect.new(0, 0, cw, ch)
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
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def disable_item(index)
@disabled[index] = true
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def setup_move_start
@mode = MODE_START
@steps = STARTUP_FRAMES
if SE_STARTUP != nil and SE_STARTUP != ""
Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100)
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def setup_move_move(mode)
if mode == MODE_MOVER
@index -= 1
@index = @items.size - 1 if @index <0>= @items.size
else
return
end
@mode = mode
@steps = MOVING_FRAMES
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def animation2?
return @mode != MODE_WAIT
end
end Agora você deve criar um novo script acima do Main, e colocar todo o código abaixo dentro dele:

#==============================================================================
# Scene_RingMenu
# Scene_Menu
#==============================================================================

#class Scene_RingMenu
class Scene_Menu
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def main
#
@spriteset = Spriteset_Map.new
#
px = $game_player.screen_x - 15
py = $game_player.screen_y - 24
@command_window = Window_RingMenu.new(px,py)
@command_window.index = @menu_index
#
if $game_party.actors.size == 0
#
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
@command_window.z = 100
#
if $game_system.save_disabled
#
@command_window.disable_item(4)
end
#
px2 = $game_player.screen_x - 15
py2 = $game_player.screen_y - 24
@status_window = Window_RingMenuStatus.new(px2,py2)

@status_window.visible = false
#
Graphics.transition
#
loop do
#
Graphics.update
#
Input.update
#
update
#
if $scene != self
break
end
end
#
Graphics.freeze
#
@spriteset.dispose
#
@command_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def update
#
@command_window.update
@status_window.update
#
if @command_window.active
update_command
return
end
#
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def update_command
#
if Input.trigger?(Input::B)
#
$game_system.se_play($data_system.cancel_se)
#
$scene = Scene_Map.new
return
end
#
if Input.trigger?(Input::C)
#
if $game_party.actors.size == 0 and @command_window.index <4>= 2
#
$game_system.se_play($data_system.buzzer_se)
return
end
#
$game_system.se_play($data_system.decision_se)
#
$scene = Scene_Skill.new(@status_window.index)
when 2 #
#
$game_system.se_play($data_system.decision_se)
#
$scene = Scene_Equip.new(@status_window.index)
when 3 #
#
$game_system.se_play($data_system.decision_se)
#
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
def update_status
@command_window.visible=false
#
if Input.trigger?(Input::B)
#
$game_system.se_play($data_system.cancel_se)
#
$scene = Scene_Menu.new
return
end
#
if Input.trigger?(Input::C)
#
if $game_party.actors.size == 0 and @command_window.index < 4
#
$game_system.se_play($data_system.buzzer_se)
return
end
#
case @command_window.index
when 0 #
#
$game_system.se_play($data_system.decision_se)
#
$scene = Scene_Item.new
when 1 #
#
$game_system.se_play($data_system.decision_se)
#

$scene = Scene_Skill.new(@status_window.index)
when 2 #
#
$game_system.se_play($data_system.decision_se)
#
$scene = Scene_Equip.new(@status_window.index)
when 3 #
#
$game_system.se_play($data_system.decision_se)
#
$scene = Scene_Status.new(@status_window.index)
when 4 #
#
if $game_system.save_disabled
#
$game_system.se_play($data_system.buzzer_se)
return
end
#
$game_system.se_play($data_system.decision_se)
#
$scene = Scene_Save.new
when 5 #
#
$game_system.se_play($data_system.decision_se)
#
$scene = Scene_End.new
end
return
end
#
return if @status_window.animation2?
#
if Input.press?(Input::UP) or Input.press?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@status_window.setup_move_move(Window_RingMenuStatus::MODE_MOVEL)
return
end
#
if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@status_window.setup_move_move(Window_RingMenuStatus::MODE_MOVER)
return
end
end

end E so seu menu esta pronto!!!qualquer duvida e so apertar F1 quando abrir o rpg maker xp!!! e la tem esse e outros script's!!!falow!!

Decon
Moderador Global
Mensagens: 5470
Registrado em: Qua Ago 30, 2006 6:55 pm
Contato:

Mensagem por Decon » Qui Mar 29, 2007 9:53 pm

Interessante principalmente as :P aí no meio, mas é util para o pessoal novo no XP. :byebye:

helivelton
Membro (Marechal)
Mensagens: 1350
Registrado em: Qua Fev 28, 2007 4:04 pm
Maker Preferido: Rpg Maker 2003

Mensagem por helivelton » Sex Mar 30, 2007 12:12 pm

naum decon!!essas carinhas saum q o codigo do script e o msm da carinha entaum e so achar o codigo da carinha e substituir!!!!!

Decon
Moderador Global
Mensagens: 5470
Registrado em: Qua Ago 30, 2006 6:55 pm
Contato:

Mensagem por Decon » Sex Mar 30, 2007 7:17 pm

Sim logico era só brincadeira, mas só para fim de curiosidade, vamos ver se quando eu copio o codigo aparece a carinha o codigo é esse: d2 = 1.0 * Math:RazzI / STARTUP_FRAMES

Surpresa. :burn_joss_stick:

Responder