Vai al contenuto

Rilevato Ad-Blocker. Per favore disabilita il tuo adblocker quando navighi su makerando.com - Non c'è nessun annuncio invasivo.

  • Chatbox

    You don't have permission to chat.
    Load More

Recommended Posts

Nome Script: Ring Menù
Versione: 1.1
Autore/i: Syvkal

Informazioni:
Un Menù ad Anello =)

Screenshots:

RingMenu.jpg
Vxsyvkal.png


Istruzioni:
IMPORTANTE
Bisogna includere anche questo script:
http://rpgmkr.net/forum/topic/1073-syvkals-menu-bars/

Poi,nella cartella Picture,inserite le seguenti icone:
Icon_Items.pngIcon_Skills.pngIcon_Equip.pngIcon_Status.pngIcon_Save.pngIcon_Load.pngIcon_End.pngIcon_Disable.png

Script:

#==============================================================================
# ** Ring Menu
#-------------------------------------------------------------------------------
# by Syvkal
# Version 1.1
# 06-23-08
#==============================================================================

   #===================================================#
   #  **  C O N F I G U R A T I O N   S Y S T E M  **  #
   #===================================================#

  # Amount of frames for Startup Animation
  STARTUP_FRAMES = 20
  # Amount of frames for Movement Animation
  MOVING_FRAMES = 15
  # Radius of the Menu Ring
  RING_R = 75
  # Disabled icon to display when disabled
  ICON_DISABLE= Cache::picture('Icon_Disable')


   #-------------D-O---N-O-T---T-O-U-C-H---------------#

  class Scene_Title < Scene_Base
    alias game_objects_original create_game_objects
    def create_game_objects
      game_objects_original

   #-------------D-O---N-O-T---T-O-U-C-H---------------#

  # As this script allows you to make a custom Menu I thought to make it easier
  # I would make it possible to add extra Menu Options from here

  # All you need to do is specify the Text to display, the icon and the command
  # The command must be in a STRING
  # Simply add to the array below :

  $game_ring_menu = [

   # Menu Option 0  eg. Item
   [Vocab],

   # Menu Option 1  eg. Skill
   [Vocab],

   # Menu Option 2  eg. Equip
   [Vocab],

   # Menu Option 3  eg. Status
   [Vocab],

   #---------------------------------------------------#
   #  **      I N S E R T   M O R E   H E R E      **  #
   #---------------------------------------------------#

   # Preferably Insert your custom Menu Options Here
   # Otherwise the existing Menu Options will return to wrong point on the Menu

   # Menu Option 4  eg. Save
   ["Save Game", Cache::picture('Icon_Save'), "$scene = Scene_File.new(true, false, false)"],

   # Menu Option 5  eg. Load
   ["Load Game", Cache::picture('Icon_Load'), "$scene = Scene_File.new(false, false, false)"],

   # Menu Option 6  eg. End Game
   [Vocab]

   ] # <--- Do no Delete This

   #===================================================#
   #  **     E N D   C O N F I G U R A T I O N     **  #
   #===================================================#
  end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  Edited to add Ring Menu
#==============================================================================

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias initialize_original initialize
  alias start_selection_original start_actor_selection
  alias end_selection_original end_actor_selection
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0, move = true)
    @move = move
    initialize_original(menu_index)
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    @gold_window = Window_Gold.new(0, 360)
    @location_window = Window_location.new(0, 0)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @command_window.dispose
    @gold_window.dispose
    @status_window.dispose if @status_window
    @location_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @command_window.update
    @gold_window.update
    @status_window.update if @status_window
    @location_window.update
    if @command_window.active
      update_command_selection
    elsif @status_window.active
      update_actor_selection
    end
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    commands = []
    for i in 0...$game_ring_menu.size
      commands.push($game_ring_menu[i][0])
    end
    icons = []
    for i in 0...$game_ring_menu.size
      icons.push($game_ring_menu[i][1])
    end
    @command_window = Window_RingMenu.new(232, 164, commands, icons, @move, @menu_index)
    if $game_party.members.size == 0
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    if $game_system.save_disabled
      @command_window.disable_item(4)
    end
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_status_window
    names = []
    chars = []
    for i in 0...$game_party.members.size
      names[i] = $game_party.members[i].name
      chars[i] = $game_party.members[i]
    end
    @status_window = Window_RingMenu.new(255, 200, names, chars, true, $game_party.last_actor_index, true)
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      if $game_party.members.size == 0 and @command_window.index < 4
        Sound.play_buzzer
        return
      elsif $game_system.save_disabled and @command_window.index == 4
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      eval($game_ring_menu[@command_window.index][2])
    end
  end
  #--------------------------------------------------------------------------
  # * Start Actor Selection
  #--------------------------------------------------------------------------
  def start_actor_selection
    @command_window.active = false
    @command_window.visible = false
    create_status_window
    if $game_party.last_actor_index < @status_window.item_max
      @status_window.index = $game_party.last_actor_index
    else
      @status_window.index = 0
    end
  end
  #--------------------------------------------------------------------------
  # * End Actor Selection
  #--------------------------------------------------------------------------
  def end_actor_selection
    @command_window.active = true
    @command_window.visible = true
    @status_window.dispose if @status_window
    @status_window = nil
  end
  #--------------------------------------------------------------------------
  # * Update Actor Selection
  #--------------------------------------------------------------------------
  def update_actor_selection
    if Input.trigger?(Input::
      Sound.play_cancel
      end_actor_selection
    elsif Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      eval($game_ring_menu[@command_window.index][3])
    end
  end
end

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  Edited to return to the menu properly when loading
#==============================================================================

class Scene_File
  alias return_scene_original return_scene
  def return_scene
    if @from_title
      $scene = Scene_Title.new
    elsif @from_event
      $scene = Scene_Map.new
    else
      if @saving
        $scene = Scene_Menu.new($game_ring_menu.size - 3)
      else
        $scene = Scene_Menu.new($game_ring_menu.size - 2)
      end
    end
  end
end

#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
#  Edited to return to the menu properly due to loading being added
#==============================================================================

class Scene_End
  alias return_scene_original return_scene
  def return_scene
    $scene = Scene_Menu.new($game_ring_menu.size - 1)
  end
end

#==============================================================================
# ** Window_Location
#------------------------------------------------------------------------------
#  This class shows the current map name.
#==============================================================================

class Window_location < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 160, (WLH*2) + 32)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    $maps = load_data("Data/MapInfos.rvdata")
    @map_id = $game_map.map_id
    @currmap = $maps[@map_id].name
    self.contents.font.color = system_color
    self.contents.draw_text(0, -4, 128, 32, "Location :")
    self.contents.font.color = normal_color
    self.contents.draw_text(0, -4+WLH, 128, 32, @currmap, 1)
  end
end

#==============================================================================
# ** Window_RingMenu
#------------------------------------------------------------------------------
#  This Window creates a Ring Menu system
#==============================================================================

class Window_RingMenu < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :index
  attr_reader   :item_max
  #--------------------------------------------------------------------------
  # * Refresh Setup
  #--------------------------------------------------------------------------
  START = 1
  WAIT  = 2
  MOVER = 3
  MOVEL = 4
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(center_x, center_y, commands, items, move = true, index = 0, character = false)
    super(0, 0, 544, 416)
    self.contents = Bitmap.new(width-32, height-32)
    self.opacity = 0
    @move = move
    @char = character
    @startup = STARTUP_FRAMES
    @commands = commands
    @item_max = commands.size
    @index = index
    @items = items
    @disabled = []
    for i in 0...commands.size-1
      @disabled[i] = false
    end
    @cx = center_x
    @cy = center_y
    start_setup
    refresh
  end
  #--------------------------------------------------------------------------
  # * Start Setup
  #--------------------------------------------------------------------------
  def start_setup
    @mode = START
    @steps = @startup
  end
  #--------------------------------------------------------------------------
  # * Disable index
  #     index : item number
  #--------------------------------------------------------------------------
  def disable_item(index)
    @disabled[index] = true
  end
  #--------------------------------------------------------------------------
  # * Determines if is moving
  #--------------------------------------------------------------------------
  def animation?
    return @mode != WAIT
  end
  #--------------------------------------------------------------------------
  # * Determine if cursor is moveable
  #--------------------------------------------------------------------------
  def cursor_movable?
    return false if (not visible or not active)
    return false if (@opening or @closing)
    return false if animation?
    return true
  end
  #--------------------------------------------------------------------------
  # * Move cursor right
  #--------------------------------------------------------------------------
  def cursor_right
    @index -= 1
    @index = @items.size - 1 if @index < 0
    @mode = MOVER
    @steps = MOVING_FRAMES
  end
  #--------------------------------------------------------------------------
  # * Move cursor left
  #--------------------------------------------------------------------------
  def cursor_left
    @index += 1
    @index = 0 if @index >= @items.size
    @mode = MOVEL
    @steps = MOVING_FRAMES
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    if self.active
      if cursor_movable?
        last_index = @index
        if Input.repeat?(Input::DOWN) or Input.repeat?(Input::RIGHT)
          cursor_right
        end
        if Input.repeat?(Input::UP) or Input.repeat?(Input::LEFT)
          cursor_left
        end
        if @index != last_index
          Sound.play_cursor
        end
      end
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh   
    self.contents.clear
    case @mode
    when START
      refresh_start
    when WAIT
      refresh_wait
    when MOVER
      refresh_move(1)
    when MOVEL
      refresh_move(0)
    end
    rect = Rect.new(18, 196, self.contents.width-32, 32)
    self.contents.draw_text(rect, @commands[@index], 1)
  end
  #--------------------------------------------------------------------------
  # * Refresh Start Period
  #--------------------------------------------------------------------------
  def refresh_start
    d1 = 2.0 * Math::PI / @item_max
    d2 = 1.0 * Math::PI / @startup
    for i in 0...@item_max
      j = i - @index
      if @move
        r = RING_R - 1.0 * RING_R * @steps / @startup
        d = d1 * j + d2 * @steps
      else
        r = RING_R
        d = d1 * j
      end
      x = @cx + ( r * Math.sin( d ) ).to_i
      y = @cy - ( r * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = WAIT
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh Wait Period
  #--------------------------------------------------------------------------
  def refresh_wait
    d = 2.0 * Math::PI / @item_max
    for i in 0...@item_max
      j = i - @index
      x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
      y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
      draw_item(x, y, i)
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh Movement Period
  #--------------------------------------------------------------------------
  def refresh_move( mode )
    d1 = 2.0 * Math::PI / @item_max
    d2 = d1 / MOVING_FRAMES
    d2 *= -1 if mode != 0
    for i in 0...@item_max
      j = i - @index
      d = d1 * j + d2 * @steps
      x = @cx + ( RING_R * Math.sin( d ) ).to_i
      y = @cy - ( RING_R * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = WAIT
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(x, y, index)
    if @char
      if @index == index
        draw_character(@items[index].character_name, @items[index].character_index , x, y)
        if @mode == WAIT
          draw_actor_hp_ring(@items[index], @cx, @cy-16, 50, 6, 84, 270, true)
          draw_actor_mp_ring(@items[index], @cx, @cy-16, 50, 6, 84, 180, false)
          draw_actor_exp_ring(@items[index], @cx, @cy-16, 50, 6, 155, 12, false)
        end
      else
        draw_character(@items[index].character_name, @items[index].character_index , x, y, false)
      end
    else
      rect = Rect.new(0, 0, @items[index].width, @items[index].height)
      if @index == index
        self.contents.blt( x, y, @items[index], rect )
        if @disabled[@index]
          self.contents.blt( x, y, ICON_DISABLE, rect )
        end
      else
        self.contents.blt( x, y, @items[index], rect, 128 )
      end
    end
  end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  Edited to allow disabled character icons
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Character Graphic
  #--------------------------------------------------------------------------
  def draw_character(character_name, character_index, x, y, enabled = true)
    return if character_name == nil
    bitmap = Cache.character(character_name)
    sign = character_name[/^[!$]./]
    if sign != nil and sign.include?('$')
      cw = bitmap.width / 3
      ch = bitmap.height / 4
    else
      cw = bitmap.width / 12
      ch = bitmap.height / 8
    end
    n = character_index
    src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, enabled ? 255 : 128)
  end
end

Condividi questo messaggio


Link di questo messaggio
Condividi su altri siti

Crea un account o accedi per lasciare un commento

You need to be a member in order to leave a comment

Crea un account

Iscriviti per un nuovo account nella nostra comunità. È facile!

Registra un nuovo account

Accedi

Sei già registrato? Accedi qui.

Accedi Ora

  • Contenuti simili

    • Da MrSte
      Autore/i: Nicke
       
      Versione: 1.0a
       
      Informazioni: Questo Script permette di aggiungere o di creare delle missioni per il proprio gioco, aggiungendo EXP, Soldi, Armi oppure Oggetti come ricompensa 
       
      Script:
       
      Core (Prima di installare lo Script, installate questo): http://niclas-thornqvist.se/rpg/scripts/ace/xs-core.txt
       
      Script: http://niclas-thornqvist.se/rpg/scripts/ace/xs-journal.txt
       
      Crediti:
      Creditate l'autore dello Script ovvero Nicke, lo script può essere usato anche per giochi commerciali 
    • Da Ally
      Nome Script: MSX - Scene_Menu MOD
      Versione: 1.0
      Autore/i: Melosx
       
      Informazioni:
      Modifica il menu. Riscrive lo stile delle barre non solo nel menù ma in tutto il gioco.
       
      Screenshots:
       
       
       
      Istruzioni:
      Nello script.
       
      Script:
       
       
    • Da Ally
      Nome Script: MSX - Name Input
      Versione: 1.0
      Autore/i: Melosx
       
      Features:
      Modifica la schermata di inserimento del nome eroe.
       
      Screenshots:
       
       
       
      Istruzioni:
      Copiare sotto materialse sopra main.
       
      Script:
       
       
    • Da Ally
      Nome Script: MSX - Window_SaveFile
      Versione: 1.0
      Autore/i: Melosx
       
      Informazioni:
      Nuova finestra di salvataggio con più elementi. Consiglio l'utilizzo dello script Text Cache per una corretta resa delle stringhe di testo.
       
      Screenshots:
       
       
       
      Istruzioni:
      Copiare lo script Sopra Main e sotto Materials
       
      Script:
       
       
      #==============================================================================# ** MSX - Window_SaveFile II#==============================================================================# Author: Melosx# Versione: 1.0# Release Date: 27/03/2012# #==============================================================================# * Description# -----------------------------------------------------------------------------# This script change the Window_SaveFile by adding more information.# This release add: actor name, level, class, map name and gold.##==============================================================================# * Instruction# -----------------------------------------------------------------------------# Place the script under Materials and above Main.##==============================================================================#==============================================================================# ** DataManager#==============================================================================module DataManager def self.make_save_header header = {} header[:characters] = $game_party.characters_for_savefile header[:playtime_s] = $game_system.playtime_s header[:info] = $game_party.characters_info_for_savefile header endend#==============================================================================# ** Game_Party#==============================================================================class Game_Party < Game_Unit def characters_info_for_savefile battle_members.collect do |actor| map_name = load_data("Data/MapInfos.rvdata2")[$game_map.map_id].name [actor.name, actor.level, actor.class.name, $game_party.gold, map_name, actor.face_name, actor.face_index] end endend#==============================================================================# ** Window_SaveFile#==============================================================================class Window_SaveFile < Window_Base def refresh contents.clear self.contents.font.size = 16 change_color(normal_color) name = Vocab::File + " #{@file_index + 1}" draw_text(4, 0, 200, line_height, name) @name_width = text_size(name).width draw_playtime(0, contents.height - line_height, contents.width - 4, 2) draw_info draw_party_characters(150, 117) end def draw_party_characters(x, y) header = DataManager.load_header(@file_index) return unless header header[:characters].each_with_index do |data, i| draw_character(data[0], data[1], x + i * 115, y) end end def draw_playtime(x, y, width, align) header = DataManager.load_header(@file_index) return unless header draw_text(x, y, width, line_height, "Playtime: " + header[:playtime_s], 2) end def draw_info header = DataManager.load_header(@file_index) return unless header header[:info].each_with_index do |data, i| draw_face(data[5], data[6], 70 + i * 115, 23) draw_text(70 + i * 115, 3, 110, line_height, data[0], 0) draw_text(75 + i * 115, 38, 110, line_height, Vocab.level_a + " " + data[1].to_s, 0) draw_text(75 + i * 115, 23, 105, line_height, data[2], 0) draw_text(0, contents.height - line_height, contents.width - 4, line_height, "Map: " + data[4], 1) draw_text(4, contents.height - line_height, contents.width - 4, line_height, "Gold: " + data[3].to_s + Vocab::currency_unit, 0) end endend#==============================================================================# ** Scene_File#==============================================================================class Scene_File < Scene_MenuBase def visible_max return 2 endendend
    • Da Ally
      Nome Script: Syvkal's Menu Bars VXAce
      Versione: 1.2
      Autore/i: Syvkal
       
      Informazioni:
      Con questo script,potete avere le barre HP, MP etc,in stile diverso,come potete vedere dalle immagini ^^
      Lo stesso script è anche presente per il VX...
       
      Screenshots:
       
       
       
      Istruzioni:
      Inserire lo script sotto Material.
      Altre istruzioni all'interno dello script.
       
      Script
       
       
      #==============================================================================# ** Syvkal's Menu Bars VXAce#------------------------------------------------------------------------------# by Syvkal# Version 1.2# 19-03-12#------------------------------------------------------------------------------# * Original available at:# www.rpgmakervxace.net & forums.rpgmakerweb.com# Please do not redistribute this script#------------------------------------------------------------------------------# * Terms of Use# Available for use in commercial games provided that I get a free copy # Email me: [email protected]# Please do not redistribute this script#==============================================================================## - INTRODUCTION -## This system implements a series of Plug 'N' Play Menu Bars/Gauges# The Bars (and some of the colour schemes) were inspired CogWheel,# but all coding was done by me##------------------------------------------------------------------------------## - USAGE -## This system will work as soon as you put it in the Script Editor# You can edit the script from the Configuration System## --- Custom Gauges -----------------------------------## I have designed the script so you can easily (with minimal scripting# knowledge) add you own custom gauges for any attribute you want## To draw a gauge use:# draw_syvkal_gauge(x, y, width, rate, color1, color2, slant)## rate : Percentage of your custom attribute max (full at 1.0)# color1 : left side gradient color# color2 : right side gradient color# style : gauge draw style (explained in the Configuration System)## --- Auto Generate Color ---------------------------## Additionally, I have added an extra function to make it easy to# create your own colours that change as the gauge decreases## To generate a custom colour use:# auto_color(color1, color2, r)## r : Percentage of your custom attribute max (full at 1.0)# color1 : Colour you want for when the gauge is full# color2 : Colour you want for when the gauge is nearly empty## This generates a SINGLE colour that changes with the gauge# Each gauge requires two colours so it has a gradient## --- Ring Bars -------------------------------------## Ring Bars have been removed for now, I didn't like how they looked# Testing has shown RGSS3 is more capable of the kind of ring bars I# wanted to make, but I want to perfect them first##============================================================================== #===================================================# # ** M I N O R C O N F I G U R A T I O N ** # #===================================================# #-------------------------------------------------------------------------- # * Parameter Gauge Max # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Minor addition allowing you to choose a max for the parameter gauges # Best set just above your actor's highest stat (to allow for buffs) # Excludes HP, MP, TP # (This does not affect your actor's stats, but simply makes the gauges # fill up quicker and look more appealing) #-------------------------------------------------------------------------- P_MAX = 400 # Parameter Gauge Max #-------------------------------------------------------------------------# # ** Full Configuration system further down ** # #-------------------------------------------------------------------------##==============================================================================# ** Window_Base#------------------------------------------------------------------------------# Replaces various 'Draw' functions to add each gauge.#==============================================================================class Window_Base < Window #===================================================# # ** C O N F I G U R A T I O N S Y S T E M ** # #===================================================# #-------------------------------------------------------------------------- # * Gauge Draw Styles # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Use different bracket types to 'draw' the style of each bar # Available bracket types: # ( ) < > | / \ # Simply mix and match for achieve your desired effect # # To use the default rectangular gauges, use | or simply leave blank # eg. '| |' or '' # Any invalid symbol will result in the default | as well # # - - W A R N I N G - - # # When using the following bracket: # \ # Ensure it is followed a space (eg. '| \ ') or itself (eg. '| \\') # If the rest of the text below turns purple, you've done it wrong #-------------------------------------------------------------------------- HPSTYLE = '| |' # Style of the HP Gauge MPSTYLE = '| |' # Style of the MP Gauge TPSTYLE = '/ /' # Style of the TP Gauge PARSTYLE = '( )' # Style of the Parameter Gauges #-------------------------------------------------------------------------- # * Additional Gauge Preferences # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Simple adjustments to aesthetics # Advised to use SLANTDSIZE if you have used / or \ in multiple bars #-------------------------------------------------------------------------- THICKCURVED = false # Slightly thicken curved bars? SLANTDSIZE = true # Shorten slanted bars? #-------------------------------------------------------------------------- # * Gauge Border Colors # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Control the colours of the gauge borders #-------------------------------------------------------------------------- COLOR1 = Color.new(0, 0, 0, 192) # Outer Border COLOR2 = Color.new(255, 255, 192, 192) # Inner Border #-------------------------------------------------------------------------- # * Empty Cauge Filler Colors # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Control the colours of the empty gauge filler #-------------------------------------------------------------------------- COLOR3 = Color.new(0, 0, 0, 12) # Half of Inner Shading COLOR4 = Color.new(64, 0, 0, 92) # Half of Inner Shading #-------------------------------------------------------------------------- # * Paramater Gauge Colors # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Control the colours of various parameters such as ATK, DEF, etc. # (HP, MP, TP are in the 'Complex Configuration' section) #-------------------------------------------------------------------------- def param_gauge_color1(param_id) case param_id when 2 text_color(20) # ATK Gauge Color1 when 3 text_color(14) # DEF Gauge Color1 when 4 text_color(30) # MAT Gauge Color1 when 5 text_color(13) # MDF Gauge Color1 when 6 text_color(28) # AGI Gauge Color1 when 7 text_color(19) # LUK Gauge Color1 end end def param_gauge_color2(param_id) case param_id when 2 text_color(21) # ATK Gauge Color1 when 3 text_color(6) # DEF Gauge Color1 when 4 text_color(31) # MAT Gauge Color1 when 5 text_color(5) # MDF Gauge Color1 when 6 text_color(29) # AGI Gauge Color1 when 7 text_color(7) # LUK Gauge Color1 end end #===================================================# # ** C O M P L E X C O N F I G U R A T I O N ** # #===================================================# #-------------------------------------------------------------------------- # * HP Gauge Colors # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Control the colours of the HP gauge # (Edit only if you know what you're doing) #-------------------------------------------------------------------------- def hp_gauge_color1 # HP Guage Color1 return Color.new(80 - 24 * @rate, 80 * @rate, 14 * @rate, 192) end def hp_gauge_color2 # HP Guage Color2 return Color.new(240 - 72 * @rate, 240 * @rate, 62 * @rate, 192) end #-------------------------------------------------------------------------- # * MP Gauge Colors # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Control the colours of the MP gauge # (Edit only if you know what you're doing) #-------------------------------------------------------------------------- def mp_gauge_color1 # MP Guage Color1 return Color.new(14 * @rate, 80 - 24 * @rate, 80 * @rate, 192) end def mp_gauge_color2 # MP Guage Color2 return Color.new(62 * @rate, 240 - 72 * @rate, 240 * @rate, 192) end #-------------------------------------------------------------------------- # * TP Gauge Colors # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Control the colours of the TP gauge # (Edit only if you know what you're doing) #-------------------------------------------------------------------------- def tp_gauge_color1 # TP Gauge Color1 return auto_color(Color.new(192,0,0,192), Color.new(255,110,0,192)) end def tp_gauge_color2 # TP Gauge Color2 return auto_color(Color.new(255,165,0,192), Color.new(255,220,0,192)) end #===================================================# # ** E N D C O N F I G U R A T I O N ** # #===================================================# #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :rate # Rate for Colour calculations #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias draw_actor_param_original draw_actor_param alias initialize_original initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(x, y, width, height) @rate = 1.0 initialize_original(x, y, width, height) end #-------------------------------------------------------------------------- # * Draw HP #-------------------------------------------------------------------------- def draw_actor_hp(actor, x, y, width = 124) @rate = [actor.hp_rate, 1.0].min draw_syvkal_gauge(x, y, width, @rate, hp_gauge_color1, hp_gauge_color2, HPSTYLE) 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 #-------------------------------------------------------------------------- # * Draw MP #-------------------------------------------------------------------------- def draw_actor_mp(actor, x, y, width = 124) @rate = [actor.mp_rate, 1.0].min draw_syvkal_gauge(x, y, width, @rate, mp_gauge_color1, mp_gauge_color2, MPSTYLE) change_color(system_color) draw_text(x, y, 30, line_height, Vocab::mp_a) draw_current_and_max_values(x, y, width, actor.mp, actor.mmp, mp_color(actor), normal_color) end #-------------------------------------------------------------------------- # * Draw TP #-------------------------------------------------------------------------- def draw_actor_tp(actor, x, y, width = 124) @rate = [actor.tp_rate, 1.0].min draw_syvkal_gauge(x, y, width, @rate, tp_gauge_color1, tp_gauge_color2, TPSTYLE) change_color(system_color) draw_text(x, y, 30, line_height, Vocab::tp_a) change_color(tp_color(actor)) draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2) end #-------------------------------------------------------------------------- # * Draw Parameters # actor : actor # x : draw spot x-coordinate # y : draw spot y-coordinate # type : Type of parameters (0-3) #-------------------------------------------------------------------------- def draw_actor_param(actor, x, y, param_id, width = 156) draw_syvkal_gauge(x, y, width, actor.params_rate(param_id), param_gauge_color1(param_id), param_gauge_color2(param_id), PARSTYLE) draw_actor_param_original(actor, x, y, param_id) end #-------------------------------------------------------------------------- # * Auto Generate Color # color1 : initial color # color2 : ending color # r : rate (full at 1.0) 1 -> color1, 0 -> color2 #-------------------------------------------------------------------------- def auto_color(color1, color2, r = @rate) a_color = Color.new a_color.red = (1-r)*color2.red + r*color1.red a_color.green = (1-r)*color2.green + r*color1.green a_color.blue = (1-r)*color2.blue + r*color1.blue a_color.alpha = (1-r)*color2.alpha + r*color1.alpha return a_color end #-------------------------------------------------------------------------- # * Draw Syvkal Style Gauge # rate : Rate (full at 1.0) # color1 : Left side color # color2 : Right side color # style : gauge draw style #-------------------------------------------------------------------------- def draw_syvkal_gauge(x, y, width, rate, color1, color2, style = '') fill_w = (width * rate).to_i gauge_y = y + line_height - 8 h = 6 style.slice!(/\s*/); style = style.split(/\s*/) if style.empty? or (style[0] == '|' && style[1] == '|') contents.fill_rect(x-2, gauge_y-2, width+4, 10, COLOR1) contents.fill_rect(x-1, gauge_y-1, width+2, 8, COLOR2) contents.gradient_fill_rect(x, gauge_y, width, 6, COLOR3, COLOR4) contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2) else adj1 = style_adj_string(style[0]); adj2 = style_adj_string(style[1], true) h += 4 for i in 0...h a1 = eval(adj1[0]); a2 = eval(adj2[0]) a3 = adj1[2]; a4 = adj2[4].nil? ? adj2[2] : adj2[4] contents.fill_rect(x-a3 +a1, gauge_y-2 + i, width+(a3+a4) - a1 - a2, 1, COLOR1) end h -= 2 for i in 0...h a1 = eval(adj1[0]); a2 = eval(adj2[0]) a3 = adj1[1]; a4 = adj2[3].nil? ? adj2[1] : adj2[3] contents.fill_rect(x-a3 +a1, gauge_y-1 + i, width+(a3+a4) - a1 - a2, 1, COLOR2) end h -= 2 for i in 0...h a1 = eval(adj1[0]); a2 = eval(adj2[0]) contents.gradient_fill_rect(x +a1, gauge_y +i, width - a1 - a2, 1, COLOR3, COLOR4) end for i in 0...h a1 = eval(adj1[0]); a2 = eval(adj2[0]) contents.gradient_fill_rect(x +a1, gauge_y +i, fill_w - a1 - a2, 1, color1, color2) end end end #-------------------------------------------------------------------------- # * Get Style Specific Adjustment Array # sym : edge style '(', ')', '<', '>', '|', '/' or '\' # edge : end of the gauge? # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Returns an array containing the following: # * a formular string to be evaluated # * adjustments to x and width values for Outer and Inner Borders #-------------------------------------------------------------------------- def style_adj_string(sym, edge = false) case sym when '/' SLANTDSIZE ? [(edge ? 'i+2' : '(h+1) - i'), 3, 5] : [(edge ? 'i' : '(h-1) - i'), 3, 5] when '\\' SLANTDSIZE ? [(edge ? '(h+1) - i' : 'i+2'), 3, 5] : [(edge ? '(h-1) - i' : 'i'), 3, 5] when '<' [(edge ? '(h/2)-((h/2) - i).abs' : '((h/2) - i).abs'), 2, 3] when '>' [(edge ? '((h/2) - i).abs' : '(h/2)-((h/2) - i).abs'), 2, 3] when '(' [(edge ? '((h/2) * Math.sin(i * 1.0 * Math::PI / (h-1))).round.to_i' : '(h-6) - ((h/2) * Math.sin(i * 1.0 * Math::PI / (h-1))).round.to_i'), THICKCURVED ? 3 : 2, THICKCURVED ? 5 : 4, 3, 5] when ')' [(edge ? '(h-3) - ((h/2) * Math.sin(i * 1.0 * Math::PI / (h-1))).round.to_i' : '((h/2) * Math.sin(i * 1.0 * Math::PI / (h-1))).round.to_i'), 3, 5, THICKCURVED ? 3 : 2, THICKCURVED ? 5 : 4] else # eg. | or invalid sym ['0', 1, 2] end end #-------------------------------------------------------------------------- # * Draw Gauge #-------------------------------------------------------------------------- def draw_gauge(x, y, width, rate, color1, color2, style = '') r = [rate, 1.0].min draw_syvkal_gauge(x, y, width, r, color1, color2, style) endend#==============================================================================# ** Game_BattlerBase#------------------------------------------------------------------------------# Added specialised 'params_rate' function.#==============================================================================class Game_BattlerBase #-------------------------------------------------------------------------- # * Get Percentage of Paramaters #-------------------------------------------------------------------------- def params_rate(param_id) return [param(param_id).to_f / P_MAX, 1.0].min endend#==============================================================================# ** Script Import#============================================================================== $imported = {} if $imported == nil $imported["Syvkal's Menu Bars"] = true
×