Simple Custom Menu for Horror-style games

Discussion in 'RGSS3 Script Requests' started by Tetsune, Jul 13, 2013.

  1. Tetsune

    Tetsune Professional Procrastinator™ Veteran

    Messages:
    51
    Likes Received:
    10
    First Language:
    English
    Primarily Uses:
    RMVXA
    So I kind of wanted to get rid of all the stuff I'm not using in my game when it comes to the menu.
    It was a bit irritating in "The Mansion", which I recall was made in RPG Maker, and I felt like it would take away some of the atmosphere.


    This is something I'd like for the game I'm currently working on, which has some horror/psychological elements in it, and I thought it'd be good for anyone else who's making a game around that area as well, so it's not really a one time use or anything.

    Anyway.
    I drew up a diagram, at the very least, of what I thought would be cool.
     
    [​IMG]
     


    As you can see, there isn't much too it in terms of erm... Style? It's not something I've seen before in games.

    Current/Max reffering to HP, of course.

    If possible, I'd love for it to be able to be customized with window skins like usual.
    If Key Items can't be desplayed in the same window, that's okay. I just thought it'd be helpful.


    The way I'd figure it would work is you can click "Items" and it'd bring you up to the Items area, and you can shift the cursor sideways to access the Key Items, which, naturally, can't be consumed.
     
    Since it's going to have some horror elements in it, I figured a "Status" section was needed, because I want to inflict the character with a status if certain events occur, so I can make things happen around him, like if it were "insanity", it could trigger some sort of event.
    Think "Amnesia: The Dark Decent" when it comes to this.


    Someone mentioned this script for the bottom part of the menu: http://pastebin.com/nitsDFvA

    It fits, but it's not the part I absolutely want c':

    I believe everything else is self explanitory. but anyway, if anyone can help me with this, it would help me a lot!

    I've been wanting this thing for months D:

     
    Thanks ahead of time!
     
    #1
  2. Tetsune

    Tetsune Professional Procrastinator™ Veteran

    Messages:
    51
    Likes Received:
    10
    First Language:
    English
    Primarily Uses:
    RMVXA
    Bump? ;u;
     
    #2
  3. Dark Paladin

    Dark Paladin Game Designer Veteran

    Messages:
    165
    Likes Received:
    10
    Location:
    St Louis Missouri
    First Language:
    English
    Primarily Uses:
    RMMV
    [​IMG]

    Is a work in progress.

    I'll finish it in a few days just hang tight :)
     
    Last edited by a moderator: Jul 16, 2013
    #3
  4. Tetsune

    Tetsune Professional Procrastinator™ Veteran

    Messages:
    51
    Likes Received:
    10
    First Language:
    English
    Primarily Uses:
    RMVXA
    Oh gosh! That's fantastic! Thank you VERY much for picking this up!

    Oh, just one thing though! Is there any way you could make the status text-based instead of icons?

    Like, for example, If you're poisoned, it saying something like "You're not feeling too hot..." or something customizable?

    Probably something editable in the "Notes" section of the status?
     
    #4
  5. Dark Paladin

    Dark Paladin Game Designer Veteran

    Messages:
    165
    Likes Received:
    10
    Location:
    St Louis Missouri
    First Language:
    English
    Primarily Uses:
    RMMV
    Here is the script and background image. 

    Make a new folder in your Graphics folder called DPmenu, then another folder in that one called Main.

    Or you can edit the folder names in the Cachext module to whatever you want them to be. Place the background image in that folder.

    If you use another image just make sure its dimensions are 544 x 416

    As for the Text for status request you had I may eventually do that but I don't have a lot of time for the moment. You could always request someone to edit it if I don't get around to it soon.

    Also I still need to make a text wrapper for the Item description box. Any long descriptions will get cut off for the moment till I fix it.

    You can press enter in the database to start a new line. Each Line will hold 21 Characters including spaces before getting cut off.

    Update: Added word wrap to Item description.

    Update: Fixed a bug with the actor select window not displaying properly

    ################################################################################ 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 Opacity end module 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) end end #-------------------------------------------------------------------------- # * Create Empty Bitmap #-------------------------------------------------------------------------- def self.empty_bitmap Bitmap.new(32, 32) end #-------------------------------------------------------------------------- # * Create/Get Normal Bitmap #-------------------------------------------------------------------------- def self.normal_bitmap(path) @cachext[path] = Bitmap.new(path) unless include?(path) @cachext[path] end #-------------------------------------------------------------------------- # * Create/Get Hue-Changed Bitmap #-------------------------------------------------------------------------- def self.hue_changed_bitmap(path, hue) key = [path, hue] unless include?(key) @cachext[key] = normal_bitmap(path).clone @cachext[key].hue_change(hue) end @cachext[key] end #-------------------------------------------------------------------------- # * Check Cache Existence #-------------------------------------------------------------------------- def self.include?(key) @cachext[key] && !@cachext[key].disposed? end #-------------------------------------------------------------------------- # * Clear Cache #-------------------------------------------------------------------------- def self.clear @cachext ||= {} @cachext.clear GC.start endend#==============================================================================# ** 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_HorzCommand include DKP_Menu_Config #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :item_window #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0) end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width 244 end #-------------------------------------------------------------------------- # * Get Digit Count #-------------------------------------------------------------------------- def col_max return 2 end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super @item_window.category = current_symbol if @item_window end #-------------------------------------------------------------------------- # * 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 update endend#==============================================================================# ** Window_MenuStatus#------------------------------------------------------------------------------# This window displays party member status on the menu screen.#==============================================================================class Window_MenuStatus < Window_Selectable include DKP_Menu_Config #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :pending_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 refresh end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 300 end #-------------------------------------------------------------------------- # * Get Window Height #-------------------------------------------------------------------------- def window_height return 370 end #-------------------------------------------------------------------------- # * Get Number of Items #-------------------------------------------------------------------------- def item_max return 1 end #-------------------------------------------------------------------------- # * Get Item Height #-------------------------------------------------------------------------- def item_height (height - standard_padding * 2) / 4 end #-------------------------------------------------------------------------- # 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[0] 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) end end #-------------------------------------------------------------------------- # * Processing When OK Button Is Pressed #-------------------------------------------------------------------------- def process_ok super $game_party.menu_actor = $game_party.members[index] end #-------------------------------------------------------------------------- # * 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_Base include DKP_Menu_Config #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(line_number = 4) super(0, 0, 244, fitting_height(line_number)) self.opacity = Help_Opacity end #-------------------------------------------------------------------------- # * Set Text #-------------------------------------------------------------------------- def set_text(text) if text != @text @text = text refresh end end #-------------------------------------------------------------------------- # * 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[current_element] != " ") break if current_element == 0 current_element -= 1 end temp_text = "" for j in 0..(text.length - 1) temp_text += text[j] temp_text += "\n" if j == current_element end text = temp_text i = current_element current_text_position = 0 end end return text endend#==============================================================================# ** Window_Gold#------------------------------------------------------------------------------# This window displays the party's gold.#==============================================================================class Window_Gold < Window_Base include DKP_Menu_Config #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, window_width, fitting_height(1)) self.opacity = 0 self.z = 1000 refresh end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 160 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear draw_currency_value(value, currency_unit, 4, 0, contents.width - 8) end #-------------------------------------------------------------------------- # * Get Party Gold #-------------------------------------------------------------------------- def value $game_party.gold end #-------------------------------------------------------------------------- # Get Currency Unit #-------------------------------------------------------------------------- def currency_unit Vocab::currency_unit end #-------------------------------------------------------------------------- # * Open Window #-------------------------------------------------------------------------- def open refresh super endendclass Window_ItemList < Window_Selectable include DKP_Menu_Config #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(x, y, width, height) super @category = :none @data = [] self.opacity = Item_Opacity end #-------------------------------------------------------------------------- # * Set Category #-------------------------------------------------------------------------- def category=(category) return if @category == category @category = category refresh self.oy = 0 end #-------------------------------------------------------------------------- # * Get Digit Count #-------------------------------------------------------------------------- def col_max return 1 end #-------------------------------------------------------------------------- # * Get Number of Items #-------------------------------------------------------------------------- def item_max @data ? @data.size : 1 end #-------------------------------------------------------------------------- # * Get Item #-------------------------------------------------------------------------- def item @data && index >= 0 ? @data[index] : nil end #-------------------------------------------------------------------------- # * Get Activation State of Selection Item #-------------------------------------------------------------------------- def current_item_enabled? enable?(@data[index]) 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 end end #-------------------------------------------------------------------------- # * 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[index] if item rect = item_rect(index) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enable?(item)) draw_item_number(rect, item) end end #-------------------------------------------------------------------------- # * 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_items endend#==============================================================================# ** Window_MenuCommand#------------------------------------------------------------------------------# This command window appears on the menu screen.#==============================================================================class Window_MenuCommand < Window_Command include DKP_Menu_Config #-------------------------------------------------------------------------- # * Initialize Command Selection Position (Class Method) #-------------------------------------------------------------------------- def self.init_command_position @@last_command_symbol = nil end #-------------------------------------------------------------------------- # * Get Digit Count #-------------------------------------------------------------------------- def col_max return 3 end #-------------------------------------------------------------------------- # * Get Spacing for Items Arranged Side by Side #-------------------------------------------------------------------------- def spacing return 100 end #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, Graphics.height- 47) activate select_last end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 544 end #-------------------------------------------------------------------------- # * Get Number of Lines to Show #-------------------------------------------------------------------------- def visible_line_number return 1 end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list add_main_commands add_save_command add_game_end_command end #-------------------------------------------------------------------------- # * 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.exists end #-------------------------------------------------------------------------- # * Get Activation State of Save #-------------------------------------------------------------------------- def save_enabled !$game_system.save_disabled end #-------------------------------------------------------------------------- # * Processing When OK Button Is Pressed #-------------------------------------------------------------------------- def process_ok @@last_command_symbol = current_symbol super end #-------------------------------------------------------------------------- # * Restore Previous Selection Position #-------------------------------------------------------------------------- def select_last select_symbol(@@last_command_symbol) endendclass Game_Interpreter def command_351 return if $game_party.in_battle SceneManager.call(Scene_Item) Window_MenuCommand::init_command_position Fiber.yield endendclass Scene_Map < Scene_Base def call_menu SceneManager.call(Scene_Item) Window_MenuCommand::init_command_position endend#==============================================================================# ** Scene_Item#------------------------------------------------------------------------------# This class performs the item screen processing.#==============================================================================class Scene_Item < Scene_ItemBase include 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.deactivate end #-------------------------------------------------------------------------- # * 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_window end #-------------------------------------------------------------------------- # * 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_last end #-------------------------------------------------------------------------- # * [Save] Command #-------------------------------------------------------------------------- def command_save SceneManager.call(Scene_Save) end #-------------------------------------------------------------------------- # * [Exit Game] Command #-------------------------------------------------------------------------- def command_game_end SceneManager.call(Scene_End) end #-------------------------------------------------------------------------- # * [Item] Command #-------------------------------------------------------------------------- def command_item @category_window.activate @command_window.deactivate end #-------------------------------------------------------------------------- # * 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 - 100 end #-------------------------------------------------------------------------- # * 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 = @viewport end #-------------------------------------------------------------------------- # * Category [OK] #-------------------------------------------------------------------------- def on_category_ok @item_window.activate @item_window.select_last end #-------------------------------------------------------------------------- # * Item [OK] #-------------------------------------------------------------------------- def on_item_ok $game_party.last_item.object = item determine_item end def determine_item if item.for_friend? show_sub_window(@actor_window) @actor_window.select_for_item(item) else use_item activate_item_window end end def cursor_left? @item_window.index % 1 == 0 end 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.activate end #-------------------------------------------------------------------------- # * Item [Cancel] #-------------------------------------------------------------------------- def on_item_cancel @item_window.unselect @category_window.activate end #-------------------------------------------------------------------------- # * Play SE When Using Item #-------------------------------------------------------------------------- def play_se_for_item Sound.play_use_item end #-------------------------------------------------------------------------- # * Use Item #-------------------------------------------------------------------------- def use_item super @item_window.redraw_current_item endend 

    Image for the background if you need it:

    [​IMG]
     
    Last edited by a moderator: Jul 29, 2013
    #5
  6. Tetsune

    Tetsune Professional Procrastinator™ Veteran

    Messages:
    51
    Likes Received:
    10
    First Language:
    English
    Primarily Uses:
    RMVXA
    Gosh, thank you so much for this! I really appreciate your help c:
     
    #6
  7. Dark Paladin

    Dark Paladin Game Designer Veteran

    Messages:
    165
    Likes Received:
    10
    Location:
    St Louis Missouri
    First Language:
    English
    Primarily Uses:
    RMMV
    Updated with Word wrap for the Item description.

    still need to fix the item use issue. 
     
    Last edited by a moderator: Jul 21, 2013
    #7
  8. exodus1386

    exodus1386 Villager Member

    Messages:
    20
    Likes Received:
    0
    actually nevermind i switched systems
     
    Last edited by a moderator: Jul 27, 2013
    #8
  9. Tetsune

    Tetsune Professional Procrastinator™ Veteran

    Messages:
    51
    Likes Received:
    10
    First Language:
    English
    Primarily Uses:
    RMVXA
    Thanks again! It's working great. c:

    By item use, were you refering to the ststus thing?
     
    #9
  10. Dark Paladin

    Dark Paladin Game Designer Veteran

    Messages:
    165
    Likes Received:
    10
    Location:
    St Louis Missouri
    First Language:
    English
    Primarily Uses:
    RMMV
    No. Every other item in the list displayed a seperate actor window when using an Item. Its fixed now. Check the script post for the updated version.
     
    #10
  11. Tetsune

    Tetsune Professional Procrastinator™ Veteran

    Messages:
    51
    Likes Received:
    10
    First Language:
    English
    Primarily Uses:
    RMVXA
    Oh, alright. c:
     
    #11

Share This Page