ArcherBanish

Warrior of Light Main Menu v1.0.1

Nov 13th, 2014
9
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================#
  2. # ■■ ■■ Warrior of Light Menu ■■ ■■                                            #
  3. #==============================================================================#
  4. # Author: Archer Banish
  5. # Version: 1.0.1
  6. # Last Update: 25/11/2014
  7. #==============================================================================#
  8. # ■ Update History                                                             #
  9. #==============================================================================#
  10. # 25/11/2014 (V1.0.1) Small upgrade to the code, added note regarding the map
  11. # Display Name
  12. # 13/11/2014 (V1.0) Initial Launch
  13. #==============================================================================#
  14. # ■ Introduction                                                               #
  15. #==============================================================================#
  16. # A simple main menu script to atempt to emulate the menu from the game
  17. # Final Fantasy I.
  18. # This menu adds a shared Gold/Time Window, a Location window and a new feature
  19. # present in the Final Fantasy I menu which is the Cystal Window, these "Crystals
  20. # can be turned on or off by a switch.
  21. #==============================================================================#
  22. # ■ Instructions                                                               #
  23. #==============================================================================#
  24. # To Install this script just place it under "▼ Materials" and above "Main" in
  25. # your RPG Maker VX Ace Script Editor
  26. # You are also required to have the images in your "Graphics/System" folder.
  27. #==============================================================================#
  28. # ■ Compatibility                                                              #
  29. #==============================================================================#
  30. # This script is made for RPG Maker VX Ace and will most likely no work correctly
  31. # in RPG Maker VX.
  32. # Any script that changes the Main Menu, Actor Status Display and (slightly) with
  33. # scripts that change the Gauge display.
  34. #==============================================================================#
  35.  
  36. module ARCHER
  37.   module FFIM
  38.    
  39.     #==========================================================================
  40.     # ■ Script Settings ■
  41.     #==========================================================================
  42.     # Edit these variables to edit the script at your liking,
  43.     #==========================================================================
  44.     SHOWGAUGE = false     # This variable toggles if the HP/MP Gauges are shown
  45.                           # DEFAULT SETTING: false
  46.     COMMANDSIZE = 160     # This variable defines the size of the non-status
  47.                           #windows (Command, Gold/Time, Location, Crystal
  48.                           # Default: 160
  49.                           # Default(For Yanfly Engine Ace): 200
  50.     #==========================================================================
  51.     # ■ Crystal Settings ■
  52.     #==========================================================================
  53.     # The variables are used to select the images that are displayed on the
  54.     # Crystal Window.
  55.     # NOTE: These Images must be located in your "Graphics/System/" folder.
  56.     # INPORTANT: Currently there is no check on the images size, any too large
  57.     #   image might have problems with the presentation on the window. I recomend
  58.     #   images not larger than 60x30 (height x width) for the best results
  59.     #   currently there is also an issue regarding the amount of images that
  60.     #   can be displayed correclty, with this size at 7+ there is already an
  61.     #   overlay of images. I do not recomend more than 6 images however, if you
  62.     #   don't mind some overlay I would recomend a max of 8.
  63.     #==========================================================================
  64.     EMPTYFILENAME = "Empty" #The image name that will be shown if the switch for
  65.                             #the "Crystal" is not set as ON.
  66.     #--------------------#
  67.     # CRYSTALFILES Array |
  68.     #--------------------#
  69.     # This array takes 2 values per line.
  70.     # Switch: This is the switch that will toggle the Crystal On causing it to be
  71.     #         drawn as such.
  72.     # Filename: The name of the image that will be shown if the designated switch
  73.     #           is on.
  74.     #
  75.     # Default:
  76.     #   CRYSTALFILES = [
  77.     #     #Switch     #Filename
  78.     #     [1,         "Fire"],
  79.     #     [2,         "Earth"],
  80.     #     [3,         "Wind"],
  81.     #     [4,         "Water"]
  82.     #   ]
  83.    
  84.     CRYSTALFILES = [
  85.       #Switch     #Filename
  86.       [1,         "Fire"],
  87.       [2,         "Earth"],
  88.       [3,         "Wind"],
  89.       [4,         "Water"]
  90.     ]
  91.    
  92.    
  93.     #--------------#
  94.     # Mapname Note #
  95.     #--------------#
  96.     # To have the menu display the map name you will have to set the
  97.     # Display Name proprieties in the Map Proprieties of every map.
  98.     # Any map without this propriety will apear as Unknown.
  99.    
  100.   #============================================================================#
  101.   # ■ ■ Customization Ends Here ■ ■                                            #
  102.   #============================================================================#
  103.      
  104.   end #FFIM
  105. end #ARCHER
  106.  
  107.  
  108. #==============================================================================#
  109. # ■ ■ ■ Menu Scenes ■ ■ ■                                                      #
  110. #==============================================================================#
  111. class Scene_Menu < Scene_MenuBase
  112.   def start
  113.     super
  114.     create_status_window
  115.     create_command_window
  116.     create_crystal_window
  117.     create_location_window
  118.     create_time_gold_window
  119.   end
  120.  
  121.   #--------------------------------------------------------------------------
  122.   # ■ Create Command Window
  123.   #--------------------------------------------------------------------------
  124.   alias kab_sm_ccw create_command_window
  125.   def create_command_window
  126.     kab_sm_ccw
  127.     @command_window.x = Graphics.width - @command_window.width - 5
  128.     @command_window.y = 5
  129.   end
  130.  
  131.   #--------------------------------------------------------------------------
  132.   # ■ Create TimeGold Window
  133.   #--------------------------------------------------------------------------
  134.   def create_time_gold_window
  135.     @time_gold_window = Window_Time_Gold.new
  136.     @time_gold_window.x = Graphics.width - @time_gold_window.window_width - 5
  137.     @time_gold_window.y = Graphics.height - @time_gold_window.window_height - 5
  138.   end
  139.  
  140.   #--------------------------------------------------------------------------
  141.   # ■ Create Lacation Window
  142.   #--------------------------------------------------------------------------
  143.   def create_location_window
  144.     @location_window = Window_Location.new
  145.     @location_window.x = Graphics.width - @location_window.window_width - 5
  146.     @location_window.y = Graphics.height - line_height*3 - @location_window.window_height - 5
  147.   end
  148.  
  149.   #--------------------------------------------------------------------------
  150.   # ■ Create Crystal Window
  151.   #--------------------------------------------------------------------------
  152.   def create_crystal_window
  153.     @crystal_window = Window_Crystal.new
  154.     @crystal_window.x = Graphics.width - @crystal_window.window_width - 5
  155.     @crystal_window.y = Graphics.height - line_height*5 - @crystal_window.window_height - 5
  156.   end
  157.  
  158.   #--------------------------------------------------------------------------
  159.   # ■ Create Status Window
  160.   #--------------------------------------------------------------------------
  161.   def create_status_window
  162.     @status_window = Window_MenuStatus.new(5, 5)
  163.   end
  164.  
  165.   #--------------------------------------------------------------------------
  166.   # ■ Get Line Height
  167.   #--------------------------------------------------------------------------
  168.   def line_height
  169.     return 24
  170.   end
  171. end
  172.  
  173. #==============================================================================#
  174. # ■ ■ ■ Menu Windows ■ ■ ■                                                     #
  175. #==============================================================================#
  176.  
  177. class Window_MenuCommand < Window_Command
  178.     def window_width
  179.       return ARCHER::FFIM::COMMANDSIZE
  180.     end
  181. end
  182.  
  183. #========================================
  184. # ■ Window_Base ■
  185. #=======================================
  186. class Window_Base  < Window
  187.   #--------------------------------------------------------------------------
  188.   # ■ Draw Actor Simple Status - Override
  189.   # > Edited the location where the data is displayed slightly
  190.   #--------------------------------------------------------------------------
  191.   def draw_actor_simple_status(actor, x, y)
  192.     draw_actor_name(actor, x, y)
  193.     draw_actor_level(actor, x, y + line_height * 1)
  194.     draw_actor_icons(actor, x + 120, y)
  195.     draw_actor_class(actor, x + 120, y + line_height * 1)
  196.     draw_actor_hp(actor, x, y + line_height * 2)
  197.     draw_actor_mp(actor, x + 120, y + line_height * 2)
  198.   end
  199.  
  200.   #--------------------------------------------------------------------------
  201.   # ■ Draw Gauge Status - Override
  202.   # > Added a little border to the gauges
  203.   #--------------------------------------------------------------------------
  204.    def draw_gauge(x, y, width, rate, color1, color2)
  205.     width = width-10
  206.     fill_w = (width * rate).to_i
  207.     gauge_y = y + line_height - 8
  208.     contents.fill_rect(x, gauge_y, width, 6, gauge_back_color)
  209.     contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2)
  210.    
  211.     border = Bitmap.new(width, 6)
  212.     border.fill_rect(border.rect, Color.new(255, 255, 255, 255))
  213.     border.clear_rect(1, 1, width-2, 4)
  214.     contents.blt(x, gauge_y, border, border.rect, 255)
  215.     border.dispose
  216.   end
  217.  
  218.   #--------------------------------------------------------------------------
  219.   # ■ Draw HP - Override
  220.   # > added check to hide gauge or not
  221.   #--------------------------------------------------------------------------
  222.   def draw_actor_hp(actor, x, y, width = 124)
  223.     if ARCHER::FFIM::SHOWGAUGE
  224.       draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  225.     end
  226.     change_color(system_color)
  227.     draw_text(x, y, 30, line_height, Vocab::hp_a)
  228.     draw_current_and_max_values(x, y, width - 5, actor.hp, actor.mhp,
  229.       hp_color(actor), normal_color)
  230.     end
  231.    
  232.   #--------------------------------------------------------------------------
  233.   # ■ Draw MP
  234.   # > added check to hide gauge or not
  235.   #--------------------------------------------------------------------------
  236.   def draw_actor_mp(actor, x, y, width = 124)
  237.     if ARCHER::FFIM::SHOWGAUGE
  238.       draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  239.     end
  240.     change_color(system_color)
  241.     draw_text(x, y, 30, line_height, Vocab::mp_a)
  242.     draw_current_and_max_values(x, y, width-5, actor.mp, actor.mmp,
  243.       mp_color(actor), normal_color)
  244.   end  
  245. end
  246.  
  247.  
  248.  
  249. #========================================
  250. # ■ Window_Gold ■
  251. #=======================================
  252. class Window_Gold < Window_Base
  253.   #--------------------------------------------------------------------------
  254.   # ■ Object Initialization
  255.   #--------------------------------------------------------------------------
  256.   def initialize
  257.     super(Graphics.width-window_width, Graphics.height-fitting_height(1), window_width, fitting_height(1))
  258.     refresh
  259.   end
  260.  
  261.   #--------------------------------------------------------------------------
  262.   # ■ Get Window Width
  263.   #--------------------------------------------------------------------------
  264.   def window_width
  265.     return ARCHER::FFIM::COMMANDSIZE
  266.   end
  267. end
  268.  
  269. #========================================
  270. # ■ Window_MenuStatus ■
  271. #=======================================
  272. class Window_MenuStatus < Window_Selectable
  273.   #--------------------------------------------------------------------------
  274.   # ■ Get Window Width
  275.   #--------------------------------------------------------------------------
  276.   def window_width
  277.     x = Graphics.width - 10
  278.     x
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # ■ Get Window Height
  282.   #--------------------------------------------------------------------------
  283.   def window_height
  284.     x = Graphics.height - 10
  285.     x
  286.   end
  287. end
  288.  
  289. #==============================================================================
  290. # ■ Window_Location ■
  291. #------------------------------------------------------------------------------
  292. #  This window displays the party's location.
  293. #==============================================================================
  294.  
  295. class Window_Location < Window_Base
  296.   #--------------------------------------------------------------------------
  297.   # * Object Initialization
  298.   #--------------------------------------------------------------------------
  299.   def initialize
  300.     super(0, 0, window_width, window_height)
  301.     refresh
  302.   end
  303.  
  304.   #--------------------------------------------------------------------------
  305.   # ■ Get Window Width
  306.   #--------------------------------------------------------------------------
  307.   def window_width
  308.     return ARCHER::FFIM::COMMANDSIZE
  309.   end
  310.  
  311.   #--------------------------------------------------------------------------
  312.   # ■ Get Window Height
  313.   #--------------------------------------------------------------------------
  314.   def window_height
  315.     return line_height*2
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # * Refresh
  319.   #--------------------------------------------------------------------------
  320.   def refresh
  321.     contents.clear
  322.     draw_location(0, 0, contents.width)
  323.   end
  324.  
  325.   #--------------------------------------------------------------------------
  326.   # ■ Draw Location
  327.   #--------------------------------------------------------------------------
  328.   def draw_location(x, y, width)
  329.     change_color(normal_color)
  330.     unless $game_map.display_name.empty?
  331.       draw_text(x, y, width - 2, line_height, $game_map.display_name, 1)
  332.     else
  333.       draw_text(x, y, width - 2, line_height, "Unknown", 1)
  334.     end
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   # * Open Window
  338.   #--------------------------------------------------------------------------
  339.   def open
  340.     refresh
  341.     super
  342.   end
  343. end
  344.  
  345. #==============================================================================
  346. # ■ Window_Time_Gold ■
  347. #------------------------------------------------------------------------------
  348. #  This window displays the total game time so far as well as the amount of gold.
  349. #==============================================================================
  350.  
  351. class Window_Time_Gold < Window_Base
  352.   #--------------------------------------------------------------------------
  353.   # ■ Object Initialization
  354.   #--------------------------------------------------------------------------
  355.   def initialize
  356.     super(0, 0, window_width, window_height)
  357.     refresh
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ■ Get Window Width
  361.   #--------------------------------------------------------------------------
  362.   def window_width
  363.     return ARCHER::FFIM::COMMANDSIZE
  364.   end
  365.  
  366.   #--------------------------------------------------------------------------
  367.   # ■ Get Window Height
  368.   #--------------------------------------------------------------------------
  369.   def window_height
  370.     return line_height*3
  371.   end
  372.  
  373.   #--------------------------------------------------------------------------
  374.   # ■ Refresh
  375.   #--------------------------------------------------------------------------
  376.   def refresh
  377.     contents.clear
  378.     draw_playtime(0, 0, contents.width)
  379.     draw_currency_value(value, currency_unit, 4, line_height, contents.width)
  380.   end
  381.  
  382.   #--------------------------------------------------------------------------
  383.   # ■ Open Window
  384.   #--------------------------------------------------------------------------
  385.   def open
  386.     refresh
  387.     super
  388.   end
  389.  
  390.   #--------------------------------------------------------------------------
  391.   # ■ Draw Playtime
  392.   #--------------------------------------------------------------------------
  393.   def draw_playtime(x, y, width)
  394.     change_color(normal_color)
  395.     draw_text(x, y, width - 2, line_height, $game_system.playtime_s, 2)
  396.     change_color(system_color)
  397.     draw_text(x, y, width, line_height, "Time", 0)
  398.   end
  399.  
  400.   #--------------------------------------------------------------------------
  401.   # ■ Draw Number (Gold Etc.) with Currency Unit
  402.   #--------------------------------------------------------------------------
  403.   def draw_currency_value(value, unit, x, y, width)
  404.     change_color(normal_color)
  405.     draw_text(x, y, width - 2, line_height, value, 2)
  406.     change_color(system_color)
  407.     draw_text(x, y, width, line_height, unit, 0)
  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # ■ Get Party Gold
  411.   #--------------------------------------------------------------------------
  412.   def value
  413.     $game_party.gold
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # ■ Get Currency Unit
  417.   #--------------------------------------------------------------------------
  418.   def currency_unit
  419.     Vocab::currency_unit
  420.   end
  421. end
  422.  
  423.  
  424. #==============================================================================
  425. # ■ Window_Crystal ■
  426. #------------------------------------------------------------------------------
  427. #  This window displays the crystals
  428. #==============================================================================
  429.  
  430. class Window_Crystal < Window_Base
  431.   #--------------------------------------------------------------------------
  432.   # ■ Object Initialization
  433.   #--------------------------------------------------------------------------
  434.   def initialize
  435.     super(0, 0, window_width, window_height)
  436.     refresh
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # ■ Get Window Width
  440.   #--------------------------------------------------------------------------
  441.   def window_width
  442.     return ARCHER::FFIM::COMMANDSIZE
  443.   end
  444.  
  445.   #--------------------------------------------------------------------------
  446.   # ■ Get Window Height
  447.   #--------------------------------------------------------------------------
  448.   def window_height
  449.     return line_height*4
  450.   end
  451.  
  452.   #--------------------------------------------------------------------------
  453.   # ■ Refresh
  454.   #--------------------------------------------------------------------------
  455.   def refresh
  456.     contents.clear  
  457.     x = Graphics.width - self.window_width - 5
  458.     y = Graphics.height - line_height*5 - self.window_height - 5
  459.  
  460.     draw_crystals(x, y, contents.width)
  461.   end
  462.  
  463.   def draw_crystals(x, y, width)
  464.     x_align = x
  465.     y_align = y + self.window_height/ 2
  466.     z_level = 100
  467.     jump = self.window_width / (ARCHER::FFIM::CRYSTALFILES.length + 1)
  468.    
  469.     @spritegroup = []
  470.     vector = []
  471.    
  472.     i = 0
  473.     while (i < ARCHER::FFIM::CRYSTALFILES.length)
  474.       vector[i] = jump*i + jump/2
  475.       i = i + 1
  476.     end  
  477.     i = 0
  478.     while (i < ARCHER::FFIM::CRYSTALFILES.length)
  479.       @spritegroup[i] = Sprite.new
  480.       if($game_switches[ARCHER::FFIM::CRYSTALFILES[i][0]])
  481.         @spritegroup[i].bitmap = Cache.system(ARCHER::FFIM::CRYSTALFILES[i][1])
  482.       else
  483.         @spritegroup[i].bitmap = Cache.system(ARCHER::FFIM::EMPTYFILENAME)
  484.       end
  485.       @spritegroup[i].x = x_align + vector[i]
  486.       @spritegroup[i].y = y_align - @spritegroup[i].bitmap.height / 2
  487.       @spritegroup[i].z = z_level
  488.       i = i+1
  489.     end
  490.   end
  491.  
  492.   #--------------------------------------------------------------------------
  493.   # ■ Open Window
  494.   #--------------------------------------------------------------------------
  495.   def open
  496.     refresh
  497.     super
  498.   end
  499.  
  500.   #--------------------------------------------------------------------------
  501.   # ■ Object Dispose
  502.   #--------------------------------------------------------------------------
  503.   def dispose
  504.     i = 0
  505.     while(i < @spritegroup.length)
  506.       @spritegroup[i].dispose
  507.       @spritegroup[i].bitmap.dispose
  508.       i = i + 1
  509.     end
  510.     super
  511.   end
  512. end
RAW Paste Data