じ☆ve冰风 发表于 2026-8-2 19:23:30

Dark Paladin Single Character Menu v1.2

 

Dark Paladin Single Character Menu v1.2

By: Dark Paladin

Introduction
Just a custom single player menu. Made for a request from Tetsune.

Features
Right now you can adjust window opacitys. Defaults are 0.

You can also change the background.

Item selection is on the main menu.

Built in word wrapper for longer item descriptions.

Future Plans

I plan to add the ability to change the text colors and possibly add the ability to show text in the status ailments area 

instead of icons.

How to Use
Check the script for instructions.

Demo
Not Needed 

Screenshot


http://s15.postimg.org/u98pbkdln/Capture.png


Image for the background if you need it:

Spoiler
http://s17.postimg.org/fc68yawlr/Background2.png





Script
Spoiler################################################################################ Dark Paladin Single Character Menu v1.2#   Platform: VX Ace#       Author: Dark Paladin#Description: A menu system for a single Character.# Terms of use: You MAY use this script for your Non-commercial Projects.#    You MAY use this script for Commercial projects without my permission.#    Credit is appreciated but not needed.# This script requires: N/A Cachext Included################################################################################==============================================================================# CONFIG AREA#==============================================================================module DKP_Menu_Config    Enable_Background = true         # true/false Use Background?      Menu_Background = "Background2"# Set the name of the background pic                                       # Place Image in "Graphics/DPmenu/Main/" Or change it in the cachext module.       Status_Opacity = 0            # Status Window Opacity         Help_Opacity = 0            # Item Help Window Opacity         Item_Opacity = 0            # Item Window Opacity       Command_Opacity = 0            # Command Window Opacity    CategoryW_Opacity = 0            # Category Window Opacityendmodule Cachext#--------------------------------------------------------------------------# DKP Cachext# Do not edit unless you really know what your doing!# Platform: VX Ace# Author: Dark paladin# Description: Module for menu background.# -------------------------------------------------------------------------#--------------------------------------------------------------------------# *Graphics#--------------------------------------------------------------------------    #You can edit the stuff in purple between the "" to change folder location.    #--------------------------------------------------------------------------# *Menu Graphics Folder#--------------------------------------------------------------------------def self.dpmenu(filename)# You can change the Folder names here for background image.    load_bitmap("Graphics/DPmenu/Main/", filename)   end#==============================================================================# END CONFIG AREA#==============================================================================    #--------------------------------------------------------------------------# * Load Bitmap#--------------------------------------------------------------------------def self.load_bitmap(folder_name, filename, hue = 0)    @cachext ||= {}    if filename.empty?      empty_bitmap    elsif hue == 0      normal_bitmap(folder_name + filename)    else      hue_changed_bitmap(folder_name + filename, hue)    endend#--------------------------------------------------------------------------# * Create Empty Bitmap#--------------------------------------------------------------------------def self.empty_bitmap    Bitmap.new(32, 32)end#--------------------------------------------------------------------------# * Create/Get Normal Bitmap#--------------------------------------------------------------------------def self.normal_bitmap(path)    @cachext = Bitmap.new(path) unless include?(path)    @cachextend#--------------------------------------------------------------------------# * Create/Get Hue-Changed Bitmap#--------------------------------------------------------------------------def self.hue_changed_bitmap(path, hue)    key =     unless include?(key)      @cachext = normal_bitmap(path).clone      @cachext.hue_change(hue)    end    @cachextend#--------------------------------------------------------------------------# * Check Cache Existence#--------------------------------------------------------------------------def self.include?(key)    @cachext && !@cachext.disposed?end#--------------------------------------------------------------------------# * Clear Cache#--------------------------------------------------------------------------def self.clear    @cachext ||= {}    @cachext.clear    GC.startendend#==============================================================================# ** Window_ItemCategory#------------------------------------------------------------------------------#This window is for selecting a category of normal items and equipment# on the item screen or shop screen.#==============================================================================class Window_ItemCategory < Window_HorzCommandinclude DKP_Menu_Config#--------------------------------------------------------------------------# * Public Instance Variables#--------------------------------------------------------------------------attr_reader   :item_window#--------------------------------------------------------------------------# * Object Initialization#--------------------------------------------------------------------------def initialize    super(0, 0)end#--------------------------------------------------------------------------# * Get Window Width#--------------------------------------------------------------------------def window_width    244end#--------------------------------------------------------------------------# * Get Digit Count#--------------------------------------------------------------------------def col_max    return 2end#--------------------------------------------------------------------------# * Frame Update#--------------------------------------------------------------------------def update    super    @item_window.category = current_symbol if @item_windowend#--------------------------------------------------------------------------# * Create Command List#--------------------------------------------------------------------------def make_command_list    add_command(Vocab::item,   :item)    add_command(Vocab::key_item, :key_item)end#--------------------------------------------------------------------------# * Set Item Window#--------------------------------------------------------------------------def item_window=(item_window)    @item_window = item_window    updateendend#==============================================================================# ** Window_MenuStatus#------------------------------------------------------------------------------#This window displays party member status on the menu screen.#==============================================================================class Window_MenuStatus < Window_Selectableinclude DKP_Menu_Config#--------------------------------------------------------------------------# * Public Instance Variables#--------------------------------------------------------------------------attr_reader   
ending_index            # Pending position (for formation)#--------------------------------------------------------------------------# * Object Initialization#--------------------------------------------------------------------------def initialize(x, y)    super(x, y, window_width, window_height)    @pending_index = -1    self.opacity = Status_Opacity    refreshend#--------------------------------------------------------------------------# * Get Window Width#--------------------------------------------------------------------------def window_width    return 300end#--------------------------------------------------------------------------# * Get Window Height#--------------------------------------------------------------------------def window_height    return 370end#--------------------------------------------------------------------------# * Get Number of Items#--------------------------------------------------------------------------def item_max   return 1end#--------------------------------------------------------------------------# * Get Item Height#--------------------------------------------------------------------------def item_height    (height - standard_padding * 2) / 4end#--------------------------------------------------------------------------# Simple Status#--------------------------------------------------------------------------def draw_actor_hp(actor, x, y, width = 200)    draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)    change_color(system_color)    draw_text(x, y, 30, line_height, Vocab::hp_a)    draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,    hp_color(actor), normal_color)end    def draw_actor_name(actor, x, y, width = 112)    change_color(hp_color(actor))    draw_text(x, y, width / 2, line_height, actor.name)end    def draw_actor_simple_status(actor, x, y)    draw_actor_name(actor, 187, 25)    draw_actor_icons(actor, 0, y + line_height * 8)    draw_actor_hp(actor, 40, 100 + line_height * 1)end#--------------------------------------------------------------------------# * Draw Item#--------------------------------------------------------------------------def draw_item(index)    actor = $game_party.members    enabled = $game_party.battle_members.include?(actor)    rect = item_rect(index)    draw_item_background(index)    draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)    draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)end#--------------------------------------------------------------------------# * Draw Background for Item#--------------------------------------------------------------------------def draw_item_background(index)    if index == @pending_index      contents.fill_rect(item_rect(index), pending_color)    endend#--------------------------------------------------------------------------# * Processing When OK Button Is Pressed#--------------------------------------------------------------------------def process_ok    super    $game_party.menu_actor = $game_party.membersend#--------------------------------------------------------------------------# * Restore Previous Selection Position#--------------------------------------------------------------------------def select_last    select($game_party.menu_actor.index || 0)end#--------------------------------------------------------------------------# * Set Pending Position (for Formation)#--------------------------------------------------------------------------def pending_index=(index)    last_pending_index = @pending_index    @pending_index = index    redraw_item(@pending_index)    redraw_item(last_pending_index)endend#==============================================================================# ** Window_Help#------------------------------------------------------------------------------#This window shows skill and item explanations along with actor status.#==============================================================================class DKPWindow_Help < Window_Baseinclude DKP_Menu_Config#--------------------------------------------------------------------------# * Object Initialization#--------------------------------------------------------------------------def initialize(line_number = 4)    super(0, 0, 244, fitting_height(line_number))    self.opacity = Help_Opacityend#--------------------------------------------------------------------------# * Set Text#--------------------------------------------------------------------------def set_text(text)    if text != @text      @text = text      refresh    endend#--------------------------------------------------------------------------# * Clear#--------------------------------------------------------------------------def clear    set_text("")end#--------------------------------------------------------------------------# * Set Item#   item : Skills and items etc.#--------------------------------------------------------------------------def set_item(item)    set_text(item ? item.description : "")end#--------------------------------------------------------------------------# * Refresh#--------------------------------------------------------------------------def refresh    contents.clear    draw_text_ex(0, 0, word_wrapping(@text))end#--------------------------------------------------------------------------# * Word Wrap#--------------------------------------------------------------------------def word_wrapping(text, pos = 0)    current_text_position = 0      for i in 0..(text.length - 1)      if text == "\n"      current_text_position = 0      next      end      current_text_position += contents.text_size(text).width      if (pos + current_text_position) >= (contents.width)      current_element = i      while(text != " ")          break if current_element == 0          current_element -= 1      end      temp_text = ""      for j in 0..(text.length - 1)          temp_text += text          temp_text += "\n" if j == current_element      end      text = temp_text      i = current_element      current_text_position = 0      end    end    return textendend#==============================================================================# ** Window_Gold#------------------------------------------------------------------------------#This window displays the party's gold.#==============================================================================class Window_Gold < Window_Baseinclude DKP_Menu_Config#--------------------------------------------------------------------------# * Object Initialization#--------------------------------------------------------------------------def initialize    super(0, 0, window_width, fitting_height(1))    self.opacity = 0    self.z = 1000    refreshend#--------------------------------------------------------------------------# * Get Window Width#--------------------------------------------------------------------------def window_width    return 160end#--------------------------------------------------------------------------# * Refresh#--------------------------------------------------------------------------def refresh    contents.clear    draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)end#--------------------------------------------------------------------------# * Get Party Gold#--------------------------------------------------------------------------def value    $game_party.goldend#--------------------------------------------------------------------------# Get Currency Unit#--------------------------------------------------------------------------def currency_unit    Vocab::currency_unitend#--------------------------------------------------------------------------# * Open Window#--------------------------------------------------------------------------def open    refresh    superendendclass Window_ItemList < Window_Selectableinclude DKP_Menu_Config#--------------------------------------------------------------------------# * Object Initialization#--------------------------------------------------------------------------def initialize(x, y, width, height)    super    @category = :none    @data = []    self.opacity = Item_Opacityend#--------------------------------------------------------------------------# * Set Category#--------------------------------------------------------------------------def category=(category)    return if @category == category    @category = category    refresh    self.oy = 0end#--------------------------------------------------------------------------# * Get Digit Count#--------------------------------------------------------------------------def col_max    return 1end#--------------------------------------------------------------------------# * Get Number of Items#--------------------------------------------------------------------------def item_max    @data ? @data.size : 1end#--------------------------------------------------------------------------# * Get Item#--------------------------------------------------------------------------def item    @data && index >= 0 ? @data : nilend#--------------------------------------------------------------------------# * Get Activation State of Selection Item#--------------------------------------------------------------------------def current_item_enabled?    enable?(@data)end#--------------------------------------------------------------------------# * Include in Item List?#--------------------------------------------------------------------------def include?(item)    case @category    when :item      item.is_a?(RPG::Item) && !item.key_item?    when :key_item      item.is_a?(RPG::Item) && item.key_item?    else      false    endend#--------------------------------------------------------------------------# * Display in Enabled State?#--------------------------------------------------------------------------def enable?(item)    $game_party.usable?(item)end#--------------------------------------------------------------------------# * Create Item List#--------------------------------------------------------------------------def make_item_list    @data = $game_party.all_items.select {|item| include?(item) }    @data.push(nil) if include?(nil)end#--------------------------------------------------------------------------# * Restore Previous Selection Position#--------------------------------------------------------------------------def select_last    select(@data.index($game_party.last_item.object) || 0)end#--------------------------------------------------------------------------# * Draw Item#--------------------------------------------------------------------------def draw_item(index)    item = @data    if item      rect = item_rect(index)      rect.width -= 4      draw_item_name(item, rect.x, rect.y, enable?(item))      draw_item_number(rect, item)    endend#--------------------------------------------------------------------------# * Draw Number of Items#--------------------------------------------------------------------------def draw_item_number(rect, item)    draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)end#--------------------------------------------------------------------------# * Update Help Text#--------------------------------------------------------------------------def update_help    @help_window.set_item(item)end#--------------------------------------------------------------------------# * Refresh#--------------------------------------------------------------------------def refresh    make_item_list    create_contents    draw_all_itemsendend#==============================================================================# ** Window_MenuCommand#------------------------------------------------------------------------------#This command window appears on the menu screen.#==============================================================================class Window_MenuCommand < Window_Commandinclude DKP_Menu_Config#--------------------------------------------------------------------------# * Initialize Command Selection Position (Class Method)#--------------------------------------------------------------------------def self.init_command_position    @@last_command_symbol = nilend#--------------------------------------------------------------------------# * Get Digit Count#--------------------------------------------------------------------------def col_max    return 3end#--------------------------------------------------------------------------# * Get Spacing for Items Arranged Side by Side#--------------------------------------------------------------------------def spacing    return 100end#--------------------------------------------------------------------------# * Object Initialization#--------------------------------------------------------------------------def initialize    super(0, Graphics.height- 47)    activate    select_lastend#--------------------------------------------------------------------------# * Get Window Width#--------------------------------------------------------------------------def window_width    return 544end#--------------------------------------------------------------------------# * Get Number of Lines to Show#--------------------------------------------------------------------------def visible_line_number    return 1end#--------------------------------------------------------------------------# * Create Command List#--------------------------------------------------------------------------def make_command_list    add_main_commands    add_save_command    add_game_end_commandend#--------------------------------------------------------------------------# * Add Main Commands to List#--------------------------------------------------------------------------def add_main_commands    add_command(Vocab::item,   :item,   main_commands_enabled)end#--------------------------------------------------------------------------# * Add Save to Command List#--------------------------------------------------------------------------def add_save_command    add_command(Vocab::save, :save, save_enabled)end#--------------------------------------------------------------------------# * Add Exit Game to Command List#--------------------------------------------------------------------------def add_game_end_command    add_command(Vocab::game_end, :game_end)end#--------------------------------------------------------------------------# * Get Activation State of Main Commands#--------------------------------------------------------------------------def main_commands_enabled    $game_party.existsend#--------------------------------------------------------------------------# * Get Activation State of Save#--------------------------------------------------------------------------def save_enabled    !$game_system.save_disabledend#--------------------------------------------------------------------------# * Processing When OK Button Is Pressed#--------------------------------------------------------------------------def process_ok    @@last_command_symbol = current_symbol    superend#--------------------------------------------------------------------------# * Restore Previous Selection Position#--------------------------------------------------------------------------def select_last    select_symbol(@@last_command_symbol)endendclass Game_Interpreterdef command_351    return if $game_party.in_battle    SceneManager.call(Scene_Item)    Window_MenuCommand::init_command_position    Fiber.yieldendendclass Scene_Map < Scene_Basedef call_menu    SceneManager.call(Scene_Item)    Window_MenuCommand::init_command_positionendend#==============================================================================# ** Scene_Item#------------------------------------------------------------------------------#This class performs the item screen processing.#==============================================================================class Scene_Item < Scene_ItemBaseinclude DKP_Menu_Config#--------------------------------------------------------------------------# * Start Processing#--------------------------------------------------------------------------def start    super    create_help_window    create_status_window    if Enable_Background != false then create_Image_Background end    create_gold_window    create_command_window    create_category_window    create_item_window    #@category_window.deactivateend#--------------------------------------------------------------------------# * Create Category Window#--------------------------------------------------------------------------def create_category_window    @category_window = Window_ItemCategory.new    @category_window.viewport = @viewport    @category_window.help_window = @help_window    @category_window.y = 120    @category_window.opacity = CategoryW_Opacity    @category_window.set_handler
ok,   method
on_category_ok))    @category_window.set_handler
cancel, method
return_item))end#--------------------------------------------------------------------------# * Create Item Window#--------------------------------------------------------------------------def create_item_window    @item_window = Window_ItemList.new(0, 170, 244, 200)    @item_window.viewport = @viewport    @item_window.help_window = @help_window    @item_window.set_handler
ok,   method
on_item_ok))    @item_window.set_handler
cancel, method
on_item_cancel))    @category_window.item_window = @item_windowend#--------------------------------------------------------------------------# * Create Command Window#--------------------------------------------------------------------------def create_command_window    @command_window = Window_MenuCommand.new    @command_window.opacity = Command_Opacity    @command_window.set_handler
item,      method
command_item))    @command_window.set_handler
save,      method
command_save))    @command_window.set_handler
game_end,method
command_game_end))    @command_window.set_handler
cancel,    method
return_scene))end#--------------------------------------------------------------------------# * Deactivate category#--------------------------------------------------------------------------def return_item    @category_window.deactivate    @command_window.activate    @command_window.select_lastend#--------------------------------------------------------------------------# * Command#--------------------------------------------------------------------------def command_save    SceneManager.call(Scene_Save)end#--------------------------------------------------------------------------# * Command#--------------------------------------------------------------------------def command_game_end    SceneManager.call(Scene_End)end#--------------------------------------------------------------------------# * Command#--------------------------------------------------------------------------def command_item    @category_window.activate    @command_window.deactivateend#--------------------------------------------------------------------------# * Create Gold Window#--------------------------------------------------------------------------def create_gold_window    @gold_window = Window_Gold.new    @gold_window.x = Graphics.width - @gold_window.width   @gold_window.y = Graphics.height - 100end#--------------------------------------------------------------------------# * Create Background Image#--------------------------------------------------------------------------def create_Image_Background                 bitmap = Cachext.dpmenu(Menu_Background)                @background_sprite.bitmap = bitmap        end   #--------------------------------------------------------------------------# * Create Status Window#--------------------------------------------------------------------------def create_status_window    @status_window = Window_MenuStatus.new(244, 0)end#--------------------------------------------------------------------------# * Create Help Window#--------------------------------------------------------------------------def create_help_window    @help_window = DKPWindow_Help.new    @help_window.viewport = @viewportend    #--------------------------------------------------------------------------# * Category #--------------------------------------------------------------------------def on_category_ok    @item_window.activate    @item_window.select_lastend#--------------------------------------------------------------------------# * Item #--------------------------------------------------------------------------def on_item_ok    $game_party.last_item.object = item    determine_itemend    def determine_item    if item.for_friend?      show_sub_window(@actor_window)      @actor_window.select_for_item(item)    else      use_item      activate_item_window    endend    def cursor_left?    @item_window.index % 1 == 0end    def show_sub_window(window)    width_remain = Graphics.width - window.width    window.x = cursor_left? ? width_remain : 0    @viewport.rect.x = @viewport.ox = cursor_left? ? 0 : window.width    @viewport.rect.width = width_remain    window.show.activateend#--------------------------------------------------------------------------# * Item #--------------------------------------------------------------------------def on_item_cancel    @item_window.unselect    @category_window.activateend#--------------------------------------------------------------------------# * Play SE When Using Item#--------------------------------------------------------------------------def play_se_for_item    Sound.play_use_itemend#--------------------------------------------------------------------------# * Use Item#--------------------------------------------------------------------------def use_item    super    @item_window.redraw_current_itemendend



FAQ

Q: Can you change this and make it look like this?
A: I have a few more features I want to add to make it more customizable. I will do this when time allows. For now the script is as is.

I will not take requests to change anything. If you wan this done feel free to change it yourself or ask for help on the forums.

Credit and Thanks
Dark Paladin


本贴来自国际rpgmaker官方论坛作者:Dark Paladin处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/dark-paladin-single-character-menu-v1-2.16080/
页: [1]
查看完整版本: Dark Paladin Single Character Menu v1.2