Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - CORE
- # -- Author : Dekita
- # -- Version : 1.4
- # -- Level : Easy
- # -- Requires : N/A
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:CORE] = true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 28/o3/2o13 - Improved Customisation Layout,
- # - Removed Some Methods,
- # - Improved Keyboard Code,
- # 27/o3/2o13 - Added Keyboard Control,
- # 26/o3/2o13 - Compatibility, (Status Scene)
- # - Update, (Icons w/Hue)
- # 18/03/2013 - Compatibility, (Skill Scene)
- # 23/o2/2o13 - Started, Finished,
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script simply holds some information and methods used by some other
- # scripts in the $D13x system, things like fonts, color, vocab..
- #
- # Place above all other $D13x Scripts.
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- # Place Above ALL Other $D13x Scripts.
- #
- #===============================================================================
- # ☆ Notetags
- # For use with Weapons / Armors
- #-------------------------------------------------------------------------------
- # <tcol: red, grn, blu>
- # use this notetag to change the color of the items text shown in some of my
- # scenes.
- #
- #===============================================================================
- module Text_Color
- #===============================================================================
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ Color Settings
- #-----------------------------------------------------------------------------
- # You can use these colors in any of my scripts that offer color customisation.
- # simply put Text_Color::THE_COLOR_YOU_WANT as the setting.
- # eg.
- # Text_Color::Pure_White
- #-----------------------------------------------------------------------------
- # White's
- Pure_White = Color.new(255,255,255)
- White = Color.new(222,222,222)
- Grey = Color.new(111,111,111)
- #-----------------------------------------------------------------------------
- # Yellow's
- Yellow = Color.new(255,255,0)
- Gold = Color.new(212,212,64)
- Orange = Color.new(255,182,0)
- Deep_Orange = Color.new(212,64,0)
- Dirt_Orange = Color.new(182,64,0)
- Brown = Color.new(128,32,0)
- #-----------------------------------------------------------------------------
- # Red's
- Red = Color.new(251,111,111)
- Deep_Red = Color.new(222,60,60)
- Pure_Red = Color.new(255,0,0)
- Pink = Color.new(255,0,255)
- Dark_Pink = Color.new(182,0,156)
- #-----------------------------------------------------------------------------
- # Blue's
- Sky_Blue = Color.new(0,182,255)
- Light_Blue = Color.new(64,128,255)
- Dark_Blue = Color.new(32,64,255)
- Purple = Color.new(182,64,255)
- Magenta = Color.new(156,156,255)
- #-----------------------------------------------------------------------------
- # Green's
- Green = Color.new(111,251,111)
- Candy_Green = Color.new(0,255,0)
- Dirty_Green = Color.new(128,182,0)
- Khaki_Green = Color.new(111,156,64)
- Turquoise = Color.new(0,255,182)
- #-----------------------------------------------------------------------------
- # Sets the default equipment text color
- Default_Equip_Color = White
- end #===========================================================================
- module General
- #==============================================================================
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ General Settings
- #-----------------------------------------------------------------------------
- # these settings are usined for visual scripts of mine, such as status screen.
- Fonts = ["VL Gothic"]
- Font_Size = 18
- Font_Bold = false
- #-----------------------------------------------------------------------------
- # Gauges = [ Color 1 , Color 2 ]
- Hp_Colors = [ Text_Color::Dirt_Orange , Text_Color::Gold ]
- Mp_Colors = [ Text_Color::Dark_Blue , Text_Color::Sky_Blue ]
- Tp_Colors = [ Text_Color::Grey , Text_Color::Pure_Red ]
- Exp_Color = [ Text_Color::Deep_Red , Text_Color::Dark_Pink ]
- #-----------------------------------------------------------------------------
- # Show TP as a percentage ?
- # Only works in scripts i have written :p
- Show_Tp_As_Perc = false
- end #===========================================================================
- module Vocab
- #===============================================================================
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ Vocabulary Settings
- #-----------------------------------------------------------------------------
- # This is where you would adjust the common vocab used in some of my scripts.
- #-----------------------------------------------------------------------------
- # Parameters
- def self.param(param_id)
- case param_id
- when 0 then "Max HP" # "Health"
- when 1 then "Max MP" # "Will"
- when 2 then "Physical Attack" # "Attack"
- when 3 then "Physical Resist" # "Defence"
- when 4 then "Magical Attack" # "Magic"
- when 5 then "Magical Resist" # "Aura"
- when 6 then "Agility" # "Speed"
- when 7 then "Luck" # "Luck"
- end
- end
- #-----------------------------------------------------------------------------
- # Tp vocab
- Tp = "Rage"
- #-----------------------------------------------------------------------------
- # X - Parameters
- def self.x_param(x_param_id)
- case x_param_id
- when 0 then "Accuracy"
- when 1 then "Evasion"
- when 2 then "Critical"
- when 3 then "Crit Eva"
- when 4 then "Mag Eva"
- when 5 then "Mag Ref"
- when 6 then "Counter"
- when 7 then "HP Regen"
- when 8 then "MP Regen"
- when 9 then "TP Regen"
- end
- end
- #-----------------------------------------------------------------------------
- # S - Parameters
- def self.s_param(s_param_id)
- case s_param_id
- when 0 then "Aggro"
- when 1 then "Guard"
- when 2 then "Recovery"
- when 3 then "Medicine"#Pharmacology
- when 4 then "MP Cost"
- when 5 then "TP Charge"
- when 6 then "P DMG Taken"
- when 7 then "M DMG Taken"
- when 8 then "Floor DMG"
- when 9 then "Exp Rate"
- end
- end
- #-----------------------------------------------------------------------------
- # Specials
- def self.specials(id)
- case id
- when 0 then "Auto-Fight"
- when 1 then "Guard"
- when 2 then "Substitue"
- when 3 then "Preserve TP"
- end
- end
- #-----------------------------------------------------------------------------
- # Collapse Type
- def self.collapse_type(id)
- case id
- when 0 then "Boss"
- when 1 then "Instant"
- when 2 then "No Vanish"
- end
- end
- #-----------------------------------------------------------------------------
- # Party Ability
- def self.party_ability(id)
- case id
- when 0 then "Encounter ½"
- when 1 then "Encounter NA"
- when 2 then "No Surprise"
- when 3 then "Pre-Emptive +"
- when 4 then "Gold Double"
- when 5 then "Double Drops"
- end
- end
- #-----------------------------------------------------------------------------
- # Various Statistics
- Attack_Speed = "Atk Speed"
- Attack_Times = "Atks Per Turn" # "APT"
- Skill_Type = "Skillset"
- Skill = "Skills"
- Equip_Type = "Equipable"
- Action_Times = "Action Time"
- Fixed = "Fixed "
- Sealed = "Sealed "
- Slot_Type = "Slot Type"
- Dual_Slot = "Dual Wield"
- One__Slot = "Single"
- #####################
- # CUSTOMISATION END #
- end #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- # The following code is protected under the 2013 Dekita Data Protection Act. #
- # Ie. The “Do Not Fucking Look” Law. #
- # Breaking This One And Only Rule May Result In The Following Side Effects : #
- # Eyes Bleeding, Nightmares, Severe Head Ache's AND A Scratch On Your Knee :p #
- # That is all ! #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================
- class Object
- #===============================================================================
- #-------------------------------------------------------------------------
- # rand_between
- #-------------------------------------------------------------------------
- def rand_between(min, max)
- min + rand(max - min + 1)
- end
- end
- #===============================================================================
- class Numeric
- #===============================================================================
- #---------------------------------------------------------------------------
- # To Float (with limited digits after decimal point)
- #---------------------------------------------------------------------------
- def to_flim(limit = 5, saftey = "0")
- str = self.to_f.to_s + saftey
- new_str = ""
- limit.times do |i|
- break if new_str =~ /[0-9].[0-9][0-9]/
- break if str[i] == nil
- new_str += str[i]
- end
- return new_str
- end
- #---------------------------------------------------------------------------
- # To A Percentage Of (num)
- #---------------------------------------------------------------------------
- def perc_of(num)
- self.to_f / num.to_f * 100.0
- end
- #---------------------------------------------------------------------------
- # Even ?
- #---------------------------------------------------------------------------
- def even?
- e = self.to_s
- e[e.size] == ("0"||"2"||"4"||"6"||"8")
- end
- #---------------------------------------------------------------------------
- # 0dd?
- #---------------------------------------------------------------------------
- def odd?
- o = self.to_s
- o[o.size] == ("1"||"3"||"5"||"7"||"9")
- end
- end
- #===============================================================================
- module Keys
- #===============================================================================
- #---------------------------------------------------------------------------
- # Win32API Information
- #---------------------------------------------------------------------------
- def self.w ; Win32API ; end
- def self.u ; "user32" ; end
- def self.i ; "i" ; end
- def self.gk ; "GetKeyState" ; end
- def self.ga ; "GetAsyncKeyState" ; end
- #---------------------------------------------------------------------------
- # Key Settings
- #---------------------------------------------------------------------------
- Key={
- # Letters
- :A => 0x41,:B => 0x42,:C => 0x43,:D => 0x44,:E => 0x45,:F => 0x46,:G => 0x47,
- :H => 0x48,:I => 0x49,:J => 0x4A,:K => 0x4B,:L => 0x4C,:M => 0x4D,:N => 0x4E,
- :O => 0x4F,:P => 0x50,:Q => 0x51,:R => 0x52,:S => 0x53,:T => 0x54,:U => 0x55,
- :V => 0x56,:W => 0x57,:X => 0x58,:Y => 0x59,:Z => 0x5A,
- # Numbers
- :_0 => 0x30,:_1 => 0x31,:_2 => 0x32,:_3 => 0x33,:_4 => 0x34,
- :_5 => 0x35,:_6 => 0x36,:_7 => 0x37,:_8 => 0x38,:_9 => 0x39,
- # Other
- :SHIFT => 0x10,:LSHIFT => 0xa0,:RSHIFT => 0xa1, :TAB => 0x09,
- :LEFT => 0x25,:RIGHT => 0x27,:UP => 0x26, :DOWN => 0x28,
- :PAUSE => 0x13,
- } # << End Key {}
- #---------------------------------------------------------------------------
- # Constants
- #---------------------------------------------------------------------------
- KS = w.new(u,gk,[i],i)
- AK = w.new(u,ga,[i],i)
- #---------------------------------------------------------------------------
- # Key Got Triggered?
- #---------------------------------------------------------------------------
- def self.trigger?(key)
- return if key.nil?
- return true if AK.call(key) != 0
- end
- #---------------------------------------------------------------------------
- # Key Being Pressed Currently ?
- #---------------------------------------------------------------------------
- def self.press?(key)
- return if key.nil?
- result = KS.call(key)
- return true if result == -127
- return true if result == -128
- end
- #---------------------------------------------------------------------------
- # Key Being Held Down?
- #---------------------------------------------------------------------------
- def self.repeat?(key)
- return if key.nil?
- return true if KS.call(key) == 1
- end
- end
- #===============================================================================
- module Cache
- #===============================================================================
- #--------------------------------------------------------------------------
- # * Get System Graphic
- #--------------------------------------------------------------------------
- def self.icon(filename = "IconSet", hue = 0)
- load_bitmap("Graphics/System/", filename, hue)
- end
- end
- #===============================================================================
- module DataManager
- #===============================================================================
- #---------------------------------------------------------------------------
- # Alias List
- #---------------------------------------------------------------------------
- class << self
- alias :lbd_unique_shits :load_database
- end
- #---------------------------------------------------------------------------
- # Load Database (alias)
- #---------------------------------------------------------------------------
- def self.load_database
- lbd_unique_shits
- loa_unique_shits
- end
- #---------------------------------------------------------------------------
- # Load Unique Shit
- #---------------------------------------------------------------------------
- def self.loa_unique_shits
- classes = [$data_weapons, $data_armors , $data_items , $data_skills ,
- $data_actors , $data_classes, $data_enemies, $data_states ]
- for g in classes
- for o in g
- next if o == nil
- o.load_unique_shit
- end
- end
- end
- end # << DataManager
- #===============================================================================
- class RPG::BaseItem
- #===============================================================================
- #--------------------------------------------------------------------------
- # Pi Variables
- #--------------------------------------------------------------------------
- attr_accessor :item_disp_color
- #--------------------------------------------------------------------------
- # Loads Unique Shit
- #--------------------------------------------------------------------------
- def load_unique_shit
- load_item_color
- # << For use in Child Classes
- end
- #---------------------------------------------------------------------------
- # Load Item Text Color
- #---------------------------------------------------------------------------
- def load_item_color
- @item_disp_color = Text_Color::Default_Equip_Color
- if self.note.match(/<tcol:(.*),(.*),(.*)>/i)
- @item_disp_color = Color.new($1.to_i,$2.to_i,$3.to_i)
- end
- end
- #--------------------------------------------------------------------------
- # Returns features for item filtered by code (credits Tsukihime)
- #--------------------------------------------------------------------------
- def feature_val(code)
- self.features.select {|ft| ft.code == code}
- end
- #--------------------------------------------------------------------------
- # Returns features for item filtered by code and data ID (credits Tsukihime)
- #--------------------------------------------------------------------------
- def feature_val_with_id(code, data_id)
- self.features.select {|ft| ft.code == code && ft.data_id == data_id}
- end
- #--------------------------------------------------------------------------
- # Returns sum of all features for item, by code and data ID (credits Tsukihime)
- #--------------------------------------------------------------------------
- def features_sum(code, data_id)
- feature_val_with_id(code, data_id).inject(0.0) {|r, ft| r += ft.value }
- end
- #--------------------------------------------------------------------------
- # Returns features pi
- #--------------------------------------------------------------------------
- def features_pi(code, data_id)
- feature_val_with_id(code, data_id).inject(1.0) {|r, ft| r *= ft.value }
- end
- #--------------------------------------------------------------------------
- # Calculate Set Sum of Features
- #--------------------------------------------------------------------------
- def features_set(code)
- feature_val(code).inject([]) {|r, ft| r |= [ft.data_id] }
- end
- end # << RPG::BaseItem
- #==============================================================================
- class Window_Base < Window
- #==============================================================================
- #--------------------------------------------------------------------------
- # Draw Gauge (w/height)
- #--------------------------------------------------------------------------
- def draw_deki_gauge(gx, gy, gw, gh, rate, color1, color2)
- empty_gauge_color = Color.new(0,0,0,128)
- fill_w = [(gw * rate).to_i, gw].min
- gauge_h = gh
- gauge_y = gy + line_height - 2 - gauge_h
- contents.fill_rect(gx, gauge_y, gw, gauge_h, empty_gauge_color)
- contents.gradient_fill_rect(gx, gauge_y, fill_w, gauge_h, color1, color2)
- end
- #--------------------------------------------------------------------------
- # Draw Hp
- #--------------------------------------------------------------------------
- def draw_de_hp(x, y, wid = nil)
- wid = self.width/2 - (standard_padding*2) if wid == nil
- rate = @actor.hp_rate
- color1 = General::Hp_Colors[0]
- color2 = General::Hp_Colors[1]
- draw_deki_gauge(x, y, wid-x-2, 2, rate, color1, color2)
- draw_text(x, y, wid, line_height, Vocab::param(0))
- draw_text(x, y, wid-x-2, line_height, "#{@actor.hp}/#{@actor.mhp}",2)
- end
- #--------------------------------------------------------------------------
- # Draw Mp
- #--------------------------------------------------------------------------
- def draw_de_mp(x, y, wid = nil)
- wid = self.width/2 - (standard_padding*2) if wid == nil
- rate = @actor.mp_rate
- color1 = General::Mp_Colors[0]
- color2 = General::Mp_Colors[1]
- draw_deki_gauge(x, y, wid-x-2, 2, rate, color1, color2)
- draw_text(x, y, wid, line_height, Vocab::param(1))
- draw_text(x, y, wid-x-2, line_height, "#{@actor.mp}/#{@actor.mmp}",2)
- end
- #--------------------------------------------------------------------------
- # Draw Tp
- #--------------------------------------------------------------------------
- def draw_de_tp(x, y, wid = nil)
- wid = self.width/2 - (standard_padding*2) if wid == nil
- rate = @actor.tp / 100
- color1 = General::Tp_Colors[0]
- color2 = General::Tp_Colors[1]
- draw_deki_gauge(x, y, wid-x-2, 2, rate, color1, color2)
- draw_text(x, y, wid, line_height, Vocab::Tp)
- text = "#{(@actor.tp).to_i}/100"
- text = "#{(@actor.tp.perc_of(100)).to_flim}%" if General::Show_Tp_As_Perc
- draw_text(x, y, wid-x-2, line_height, text,2)
- end
- #--------------------------------------------------------------------------
- # Draw Exp (w/gauge)
- #--------------------------------------------------------------------------
- def draw_de_xp(x, y, gauge = true)
- s1 = @actor.current_level_exp
- s2 = @actor.next_level_exp
- s1_g = @actor.exp - @actor.current_level_exp
- s2_g = @actor.next_level_exp - @actor.current_level_exp
- wid = self.width/2 - (standard_padding*2)
- wid_b = self.width/2 - (standard_padding)
- rate = (s1_g).to_f / (s2_g)
- color1 = General::Exp_Color[0]
- color2 = General::Exp_Color[1]
- draw_deki_gauge(wid_b, y, wid-x-2, 2, rate, color1, color2) if gauge
- draw_text(wid_b, y, wid, line_height, "Exp:")
- draw_text(wid_b, y, wid-x-2, line_height, "#{s1}/#{s2}",2)
- end
- #--------------------------------------------------------------------------
- # Draw Icon (w/Hue)
- #--------------------------------------------------------------------------
- def draw_de_icon(icon_index, x, y, hue = 0, enabled = true)
- bitmap = Cache.icon("IconSet",hue)
- rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
- contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
- end
- end
- #==============================================================================
- class Deki_Help < Window_Base
- #==============================================================================
- #--------------------------------------------------------------------------
- # Object Initialization
- #--------------------------------------------------------------------------
- def initialize(line_number = 2)
- super(0, 0, Graphics.width/4*3, fitting_height(line_number))
- @item = nil
- 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)
- return if @item == item
- @item = item
- refresh
- set_text(item ? item.description : "")
- end
- #--------------------------------------------------------------------------
- # Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_text_ex(4, 0, @text)
- end
- #--------------------------------------------------------------------------
- # Reset Font Settings
- #--------------------------------------------------------------------------
- def reset_font_settings
- change_color(normal_color)
- self.contents.font.name = General::Fonts
- self.contents.font.size = General::Font_Size
- self.contents.font.bold = General::Font_Bold
- end
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement