Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #======================================================================
- # A Custom Menu Script by mjshi
- #----------------------------------------------------------------------
- # Place images into Graphics/System.
- #----------------------------------------------------------------------
- module ACMenu
- #----------------------------------------------------------------------
- # Config
- ActorPictures = {
- "1" => "charactercardalice",
- "2" => "charactercardwraps",
- "3" => "charactercardscruffy",
- "4" => "charactercardjekyll",
- "5" => "charactercardbolt",
- "6" => "charactercardwebs",
- "7" => "charactercardbeatrice",
- "8" => "charactercardjackie",
- "9" => "charactercardkenneth",
- "10" => "charactercardmask",
- "11" => "charactercardbarnaby",
- "12" => "charactercardjack",
- "13" => "charactercardscotty",
- "14" => "charactercardrosette",
- "15" => "charactercardfluche",
- "16" => "charactercardmizure",
- "17" => "charactercardwendy",
- "18" => "charactercardkris",
- "19" => "charactercardflynt",
- "20" => "charactercardraven",
- "21" => "charactercardjuno",
- "22" => "charactercardplum",
- "23" => "charactercardbubbles",
- "24" => "charactercardbuckethead",
- "25" => "charactercardhenry",
- "26" => "charactercardskippy",
- "27" => "charactercardfig",
- "28" => "charactercardgwen",
- "29" => "charactercardeva",
- "30" => "charactercardmillie",
- "31" => "charactercardrojo",
- "32" => "charactercardhuntress",
- "33" => "charactercardgeorge",
- "34" => "charactercardmothman",
- "35" => "charactercardalice2",
- "36" => "charactercardludwig",
- }
- ActorIcons =[
- # Command Name => FileName (place file in Graphics/System
- ["Items", "IconItems"],
- ["Abilities", "IconAbilities"],
- ["Equip", "IconEquip"],
- ["Status", "IconStatus"],
- ["Exit", "IconEscape"],
- ]
- # Jekyll's actor id
- Jekyll = 4
- # turn on switch if jekyll's switched
- JekyllSwitch = 108
- # alternate image to use for jekyll when he's switched
- JekyllImage = "charactercardchad"
- #-How many columns to show
- Columns = 5
- #-Width
- WindowWidth = 300
- WindowHeight = 50
- ActorWindowHeight = 294
- #-Cursor Icon
- CursorIcon = "IconPointer"
- XOffset = 10
- YOffset = 10
- ## edit this if your cursor "jumps"
- InitialCursorLocation = [
- [123, 10],
- [183, 10],
- [243, 10],
- [303, 10],
- [363, 10],
- ]
- TextOffset = 35
- FontSize = 12
- CommandOffset = [-5, -3, -3, -2, 0]
- ItemSkillHeightAdjust = 194
- HPMPTopBuffer = 180
- # [x,y]
- StateIconLocation = [0, 240]
- LvLocation = [54, 148]
- GoldIconIndex = 304
- GoldIconOffset = -2
- TokenIconIndex = 431
- TokenSwitch = 1461
- # ** End Config **
- #----------------------------------------------------------------------
- end
- class Window_Base
- def draw_currency_value(value, unit, x, y, width)
- change_color(normal_color)
- draw_text(x, y + 2, width, line_height, value, 1)
- if $game_switches[ACMenu::TokenSwitch]
- icon = ACMenu::TokenIconIndex
- offset = 0
- else
- icon = ACMenu::GoldIconIndex
- offset = ACMenu::GoldIconOffset
- end
- draw_icon(icon, x, y + offset)
- end
- end
- #----------------------------------------------------------------------
- # Window_MenuCommand
- #
- class Window_MenuCommand
- def initialize
- super((Graphics.width - window_width)/2, 0)
- select_last
- end
- # def visible_line_number
- # return 1
- # end
- def col_max
- return ACMenu::Columns
- end
- def window_height
- return ACMenu::WindowHeight + standard_padding * 2
- end
- def window_width
- return ACMenu::WindowWidth + standard_padding * 1.5
- end
- def contents_height
- return ACMenu::WindowHeight
- end
- def item_width
- return ACMenu::WindowWidth / col_max
- end
- def item_height
- return ACMenu::WindowHeight
- end
- def contents_width
- return ACMenu::WindowWidth
- end
- def top_col
- ox / (item_width + spacing)
- end
- def top_col=(col)
- col = 0 if col < 0
- col = col_max - 1 if col > col_max - 1
- self.ox = col * (item_width + spacing)
- end
- def bottom_col
- top_col + col_max - 1
- end
- def bottom_col=(col)
- self.top_col = col - (col_max - 1)
- end
- def ensure_cursor_visible
- self.top_col = index if index < top_col
- self.bottom_col = index if index > bottom_col
- end
- def item_rect(index)
- rect = super
- rect.x = index * (item_width + spacing)
- rect.y = 0
- rect
- end
- def draw_image(file, index, enabled = true)
- bitmap = Cache.system(file)
- rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- contents.blt(contents.width / col_max * index, 0, bitmap, rect, enabled ? 255 : translucent_alpha)
- end
- def draw_item(index)
- draw_image(ACMenu::ActorIcons[index][1], index, command_enabled?(index))
- rect = item_rect(index)
- contents.font.size = ACMenu::FontSize
- draw_text(index * item_width + ACMenu::CommandOffset[index], rect.y + ACMenu::TextOffset, item_width, line_height, command_name(index), 1)
- end
- def make_command_list
- add_command(ACMenu::ActorIcons[0][0], :item)
- add_command(ACMenu::ActorIcons[1][0], :skill)
- add_command(ACMenu::ActorIcons[2][0], :equip)
- add_command(ACMenu::ActorIcons[3][0], :status)
- add_command(ACMenu::ActorIcons[4][0], :game_end)
- end
- def update_help
- @help_window.set_text(command_name(index))
- end
- def update_cursor
- end
- def process_ok
- @@last_command_symbol = current_symbol
- super
- end
- end
- class Scene_Menu
- def create_gold_window
- @gold_window = Window_Gold.new
- @gold_window.x = (Graphics.width - @gold_window.width) / 2
- @gold_window.y = Graphics.height - @gold_window.height
- end
- def create_command_window
- @command_window = Window_MenuCommand.new
- @command_window.set_handler(:item, method(:command_item))
- @command_window.set_handler(:skill, method(:command_personal))
- @command_window.set_handler(:equip, method(:command_personal))
- @command_window.set_handler(:status, method(:command_personal))
- @command_window.set_handler(:game_end, method(:command_game_end))
- @command_window.set_handler(:cancel, method(:return_scene))
- @command_window.arrows_visible = false
- bitmap = Cache.system(ACMenu::CursorIcon)
- rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- @pointer = Window_Base.new(0, 0, bitmap.width + @command_window.standard_padding * 2, bitmap.height + @command_window.standard_padding * 2)
- @pointer.opacity = 0
- @pointer.contents.blt(0, 0, bitmap, rect)
- @pointer.x = ACMenu::InitialCursorLocation[@command_window.index][0]
- @pointer.y = ACMenu::InitialCursorLocation[@command_window.index][1]
- @pointer.arrows_visible = false
- @pointer.visible = true
- end
- def create_status_window
- @status_window = Window_MenuStatus.new(0, @command_window.height)
- @status_window.height = Graphics.height - @command_window.height - @gold_window.height
- end
- alias acmenu_update_basic update_basic
- def update_basic(*args)
- acmenu_update_basic(*args)
- update_pointer
- end
- def update_pointer
- @lastindex = -1 if !defined? @lastindex
- @pointer.visible = @command_window.visible
- # uncomment below to find the cursor x, y position for initial setup
- # puts @pointer.x.to_s + " " + @pointer.y.to_s
- return if !@pointer.visible
- @lastindex = @command_window.index
- if @lastindex >= 0
- rect = Rect.new(@command_window.x + @command_window.contents.width / @command_window.col_max * @lastindex, @command_window.y, @command_window.contents.width, @command_window.contents.height)
- @pointer.x = rect.x + ACMenu::XOffset
- @pointer.y = rect.y + ACMenu::YOffset
- end
- end
- end
- class Window_MenuStatus
- def draw_item(idx)
- #TODO: draw slices instead of stuff
- actor = $game_party.members[idx]
- enabled = $game_party.battle_members.include?(actor)
- rect = item_rect(idx)
- if ACMenu::ActorPictures[actor.id.to_s]
- if actor.id == ACMenu::Jekyll && $game_switches[ACMenu::JekyllSwitch]
- acmenu_draw_image(ACMenu::JekyllImage, rect.x + 2, rect.y + 2)
- else
- acmenu_draw_image(ACMenu::ActorPictures[actor.id.to_s], rect.x + 2, rect.y + 2)
- end
- end
- draw_item_background(idx)
- rect.x += 2
- change_color(text_color(0))
- draw_text(rect.x + ACMenu::LvLocation[0], rect.y + ACMenu::LvLocation[1], rect.width, line_height, actor.level)
- reset_font_settings
- draw_actor_icons(actor, rect.x + ACMenu::StateIconLocation[0], rect.y + ACMenu::StateIconLocation[1])
- draw_actor_hp(actor, rect.x, rect.y + ACMenu::HPMPTopBuffer)
- draw_actor_mp(actor, rect.x, rect.y + ACMenu::HPMPTopBuffer + line_height)
- end
- def window_width
- Graphics.width
- end
- def window_height
- ACMenu::ActorWindowHeight
- end
- def item_height
- window_height - standard_padding * 2
- end
- def item_max
- $game_party.members.size
- end
- def visible_line_number
- return 1
- end
- def col_max
- return 4
- end
- def spacing
- return 8
- end
- def contents_width
- (item_width + spacing) * item_max - spacing
- end
- def contents_height
- item_height
- end
- def top_col
- ox / (item_width + spacing)
- end
- def top_col=(col)
- col = 0 if col < 0
- self.ox = (col - 3) * (item_width + spacing)
- end
- def bottom_col
- top_col + col_max - 1
- end
- def bottom_col=(col)
- self.top_col = col - (col_max - 1)
- end
- def ensure_cursor_visible
- self.top_col = index + 3 if index < top_col
- self.top_col = index if index > bottom_col
- end
- def item_rect(index)
- rect = super
- rect.x = index * (item_width + spacing)
- rect.y = 0
- rect
- end
- def cursor_down(wrap = false); end;
- def cursor_up(wrap = false); end;
- def cursor_pagedown; end;
- def cursor_pageup; end;
- def acmenu_draw_image(file, x, y)
- bitmap = Cache.system(file)
- rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- contents.blt(x, y, bitmap, rect)
- end
- def draw_item_background(index)
- if index == @pending_index
- contents.fill_rect(item_rect(index), pending_color)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement