赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 0 |
最后登录 | 2023-3-10 |
在线时间 | 4 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 61
- 在线时间
- 4 小时
- 注册时间
- 2021-4-13
- 帖子
- 2
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 RovinoVargas 于 2023-3-10 06:22 编辑
就是下面的脚本,:description显示在游戏里会挤在一起,不管怎么样都不能换行。
我不是很懂这个,不知道怎么改,所以来问一下各位大佬
就是这个- #~ #== Szyu Scripts presents =====================================================
- # * Szyu Scripts' 简单派系
- # Version 1.1
- # by Szyu
- #
- #== Download ==================================================================
- # * pastebin:
- # http://adf.ly/4920670/simple-factions
- #
- #== About =====================================================================
- # * 该脚本可以为游戏添加自定义派系系统,可以使用事件脚本进行控制
- #
- #== 使用方法 ================================================================
- # * 在下面的 SZS_Factions 模块中修改设定.
- #
- # * 使用 $game_factions[索引] 来引用指定索引的派系
- # !第一个派系的索引是 0!
- #
- # * 增加派系声望值:
- # $game_factions.gain_reputation(id, 数值)
- # 减少派系声望值:
- # $game_factions.lose_reputation(id, 数值)
- # 如果派系不可见,数值变动将不会出现在派系列表里
- #
- # * 设定当前事件页的派系,使用注释: <faction: 索引>
- #
- # * 在分支条件里使用脚本检查当前事件页的派系:
- # event.faction
- # 结果将返回事件的派系索引,无派系时返回 nil.
- #
- # * 在分支条件里使用脚本:
- # if event.faction && $game_factions[event.faction].reputation > x
- # 来对比当前事件的派系值是否大于x
- #
- #== Terms of Use ==============================================================
- # * You are free to use this script for commercial and non-commercial projects.
- # However I'd like you to inform me of the projects you are planning to use it
- # in, so I can keep track of where my scripts are used.
- #
- #== Import ====================================================================
- $imported = {} if $imported.nil?
- $imported["SZ-FACTIONS"] = true
- #==============================================================================
- module SZS_Factions
- # 设定派系等级:
- # :name - 派系等级名称
- # :rep_min - 派系等级的最低值
- # :bar_color1 - Default_BarColor1为nil或未定义时显示的值槽的颜色1
- # :bar_color2 - Default_BarColor2为nil或未定义时显示的值槽的颜色2
- Levels = [
- {:name => "过街老鼠", :rep_min => 0,
- :bar_color1 => Color.new(220, 20,18),
- :bar_color2 => Color.new(140, 5,30)},
-
- {:name => "芸芸众生", :rep_min => 1000,
- :bar_color1 => Color.new(40, 32, 218)},
-
- {:name => "略有耳闻", :rep_min => 1800},
-
- {:name => "声名显赫", :rep_min => 2400,
- :bar_color1 => Color.new(52, 242, 32)}
- ]
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # 派系类别. 可以自由增减派系类别:
- # :faction - 定义符号, 类似 :type => "巴啦啦小魔仙"
- FactionType = {
- :faction => "商业派系",
- :individual => "独立派系"
- }
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # 派系列表:
- # :name - 派系名称
- # :type - 派系类别
- # :initial_value - 派系初始声望值
- # :discovered - 该派系是否在游戏一开始就可见
- # :graphic - 显示的图像
- # :description - 显示的说明文字
- Factions = [
- {:name => "复仇者联盟", :type => :faction, :initial_value => 1250, :discovered => true,
- :graphic => "logo",:description =>
- "硬核派系,总是取胜。忠诚是其会员得原则之一,面对它们时不要掉以轻心..."},
- {:name => "创世纪协会", :type => :faction, :initial_value => 1000},
- {:name => "地球猫猫教", :type => :individual, :initial_value => 0,:discovered => true,
- :graphic => "logo",:description => "你已被猫猫包围。"},
- ]
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # 是否启用菜单指令
- UseInMenu = true
- MenuTerm = "派系"
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # 是否显示派系说明文字、图像和说明文字对齐方式
- UseDescriptions = false
- UseGraphics = false
- DescriptionAlignment = 1
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # 派系声望值上限
- MaxReputation = 2500
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # 拍戏声望值值槽默认的颜色1和颜色2
- Default_BarColor1 = Color.new(172,196,36)
- Default_BarColor2 = Color.new(82,106,16)
- end
- #==============================================================================
- # ** Game Faction
- #==============================================================================
- class Game_Faction
- attr_reader :id
- attr_reader :name
- attr_reader :reputation
- attr_reader :type
- attr_reader :level
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize(id)
- @id = id
- fac = SZS_Factions::Factions[id]
- @name = fac[:name]
- @type = fac[:type]
- @reputation = fac[:initial_value]
- check_level
- end
- #--------------------------------------------------------------------------
- # * Gain Reputation
- #--------------------------------------------------------------------------
- def gain_reputation(amount)
- @reputation += amount
- check_level
- end
- #--------------------------------------------------------------------------
- # * Lose Reputation
- #--------------------------------------------------------------------------
- def lose_reputation(amount)
- gain_reputation(-amount)
- end
- #--------------------------------------------------------------------------
- # * Check Reputation Level
- #--------------------------------------------------------------------------
- def check_level
- lv = -1
- SZS_Factions::Levels.each do |rlv|
- lv += 1 if @reputation >= rlv[:rep_min]
- end
- @level = lv
- end
- end
- #==============================================================================
- # ** Game Factions
- #==============================================================================
- class Game_Factions
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- @data = []
- end
- #--------------------------------------------------------------------------
- # * Get Actor
- #--------------------------------------------------------------------------
- def [](fac_id)
- return nil unless SZS_Factions::Factions[fac_id]
- @data[fac_id] ||= Game_Faction.new(fac_id)
- end
- #--------------------------------------------------------------------------
- # * Get All Factions not nil
- #--------------------------------------------------------------------------
- def all_factions
- return @data.select{|f| !f.nil?}
- end
- #--------------------------------------------------------------------------
- # * Get All Factions of a certain type
- #--------------------------------------------------------------------------
- def factions_of(type)
- return @data.select{|f| !f.nil? && f.type == type}
- end
- #--------------------------------------------------------------------------
- # * Gain Reputation
- #--------------------------------------------------------------------------
- def gain_reputation(fac_id, amount)
- return nil unless SZS_Factions::Factions[fac_id]
- @data[fac_id] ||= Game_Faction.new(fac_id)
- @data[fac_id].gain_reputation(amount)
- end
- #--------------------------------------------------------------------------
- # * Lose Reputation
- #--------------------------------------------------------------------------
- def lose_reputation(fac_id, amount)
- gain_reputation(fac_id, -amount)
- end
- end
- #==============================================================================
- # ** Game_Event
- #==============================================================================
- class Game_Event < Game_Character
- #--------------------------------------------------------------------------
- # * Get Faction ID of the event's current page
- #--------------------------------------------------------------------------
- def faction
- @page.list.map{|l| l.parameters}.each do |line|
- next if line[0].nil?
- if line[0] =~ /<faction:\s*(\d+)\s*>/i
- fac_id = $1.to_i
- return fac_id if SZS_Factions::Factions[fac_id]
- end
- end
- return nil
- end
- end
- #==============================================================================
- # ** Game_Interpreter
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # * Get Current event
- #--------------------------------------------------------------------------
- def event
- $game_map.events[@event_id] || nil
- end
- end
- #==============================================================================
- # ** DataManager
- #==============================================================================
- class << DataManager
- alias :szs_factions_create_game_objects :create_game_objects
- alias :szs_factions_make_save_contents :make_save_contents
- alias :szs_factions_extract_save_contents :extract_save_contents
- alias :szs_factions_setup_new_game :setup_new_game
- #--------------------------------------------------------------------------
- # * Create Game Objects
- #--------------------------------------------------------------------------
- def create_game_objects
- szs_factions_create_game_objects
- $game_factions = Game_Factions.new
- end
- #--------------------------------------------------------------------------
- # * Create Save Contents
- #--------------------------------------------------------------------------
- def make_save_contents
- contents = szs_factions_make_save_contents
- contents[:factions] = $game_factions
- contents
- end
- #--------------------------------------------------------------------------
- # * Extract Save Contents
- #--------------------------------------------------------------------------
- def extract_save_contents(contents)
- szs_factions_extract_save_contents(contents)
- $game_factions = contents[:factions]
- end
- #--------------------------------------------------------------------------
- # * Set Up New Game
- #--------------------------------------------------------------------------
- def setup_new_game
- szs_factions_setup_new_game
- SZS_Factions::Factions.select{|f| f[:discovered]}.each do |f|
- $game_factions[SZS_Factions::Factions.index(f)]
- end
- end
- end
- #==============================================================================
- # ** Scene FactionList
- #==============================================================================
- class Scene_FactionList < Scene_Base
- #--------------------------------------------------------------------------
- # * Start
- #--------------------------------------------------------------------------
- def start
- super
- create_category_window
- create_help_window
- create_fac_list_window
- create_desc_window if SZS_Factions::UseDescriptions
- end
- #--------------------------------------------------------------------------
- # * Create Category Window
- #--------------------------------------------------------------------------
- def create_category_window
- @category_win = Window_FactionCategory.new
- @category_win.set_handler(:ok, method(:on_category_ok))
- @category_win.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # * Create Status Window
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_FactionStatus.new
- end
- #--------------------------------------------------------------------------
- # * Create List Window
- #--------------------------------------------------------------------------
- def create_fac_list_window
- y = @category_win.height
- w = Graphics.width
- h = Graphics.height-y-@help_window.height
- w /= 2 if SZS_Factions::UseDescriptions
- @fac_list_win = Window_FactionList.new(0,y,w,h)
- @fac_list_win.help_window = @help_window
- @fac_list_win.set_handler(:cancel, method(:on_faction_cancel))
- @category_win.reputation_window = @fac_list_win
- end
- #--------------------------------------------------------------------------
- # * Create Description Window
- #--------------------------------------------------------------------------
- def create_desc_window
- y = @category_win.height
- h = Graphics.height-y-@help_window.height
- x = @fac_list_win.width
- w = Graphics.width - x
- @desc_window = Window_FactionDescription.new(x,y,w,h)
- @fac_list_win.description_window = @desc_window
- end
- #--------------------------------------------------------------------------
- # * Terminate
- #--------------------------------------------------------------------------
- def terminate
- super
- @category_win.dispose
- @fac_list_win.dispose
- @help_window.dispose
- @desc_window.dispose if @desc_window
- end
- #--------------------------------------------------------------------------
- # * On Category selected
- #--------------------------------------------------------------------------
- def on_category_ok
- @fac_list_win.activate.select(0)
- end
- #--------------------------------------------------------------------------
- # * On List cancel
- #--------------------------------------------------------------------------
- def on_faction_cancel
- @fac_list_win.deactivate.select(-1)
- @help_window.faction = nil
- @desc_window.faction = nil if @desc_window
- @category_win.activate
- end
- end
- #==============================================================================
- # ** Scene_Menu
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- alias :szs_factions_create_command_window :create_command_window
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- def create_command_window
- szs_factions_create_command_window
- @command_window.set_handler(:factions, method(:command_factions))
- end
- #--------------------------------------------------------------------------
- # * Command Factions
- #--------------------------------------------------------------------------
- def command_factions
- SceneManager.call(Scene_FactionList)
- end
- end
- #==============================================================================
- # ** Window_FactionCategory
- #==============================================================================
- class Window_FactionCategory < Window_HorzCommand
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :reputation_window
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0)
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- Graphics.width
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return SZS_Factions::FactionType.size
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- @reputation_window.category = current_symbol if @reputation_window
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- SZS_Factions::FactionType.each do |k, v|
- add_command(v,k)
- end
- end
- #--------------------------------------------------------------------------
- # * Set Item Window
- #--------------------------------------------------------------------------
- def reputation_window=(reputation_window)
- @reputation_window = reputation_window
- update
- end
- end
- #==============================================================================
- # ** Window_FactionList
- #==============================================================================
- class Window_FactionList < Window_Selectable
- attr_reader :description_window
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super
- @category = :none
- @data = []
- end
- #--------------------------------------------------------------------------
- # * Set Category
- #--------------------------------------------------------------------------
- def category=(category)
- return if @category == category
- @category = category
- refresh
- self.oy = 0
- end
- #--------------------------------------------------------------------------
- # * Set Description Window
- #--------------------------------------------------------------------------
- def description_window=(dw)
- @description_window = dw
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return SZS_Factions::UseDescriptions ? 1 : 2
- 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?
- return true
- end
- #--------------------------------------------------------------------------
- # * Create Item List
- #--------------------------------------------------------------------------
- def make_item_list
- @data = $game_factions.factions_of(@category)
- 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_text_ex(rect.x,rect.y, item.name)
- end
- end
- #--------------------------------------------------------------------------
- # * Update Help Text
- #--------------------------------------------------------------------------
- def update_help
- @help_window.faction = item if @help_window
- @description_window.faction = item if @description_window
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
- end
- #==============================================================================
- # ** Window_FactionStatus
- #==============================================================================
- class Window_FactionStatus < Window_Base
- attr_reader :faction
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize
- h = fitting_height(1)
- super(0,Graphics.height-h,Graphics.width, h)
- end
- #--------------------------------------------------------------------------
- # * Set Faction
- #--------------------------------------------------------------------------
- def faction=(faction)
- @faction=faction
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- return unless @faction
- draw_reputation
- draw_reputation_text
- end
- #--------------------------------------------------------------------------
- # * Draw Reputation
- #--------------------------------------------------------------------------
- def draw_reputation
- draw_rep_gauge(0, 0, contents.width/3*2,line_height-8,
- @faction.reputation.to_f/SZS_Factions::MaxReputation,
- hp_gauge_color1, hp_gauge_color2)
- change_color(system_color)
- draw_current_and_max_values(96, 0, 132,
- @faction.reputation, SZS_Factions::MaxReputation,
- normal_color, normal_color)
- end
- #--------------------------------------------------------------------------
- # * Draw Reputation Gauge
- #--------------------------------------------------------------------------
- def draw_rep_gauge(x, y, width,height, rate, color1, color2)
- fill_w = (width * rate).to_i
- gauge_y = y+(line_height-height)/2
- contents.fill_rect(x, gauge_y, width, height, gauge_back_color)
- contents.gradient_fill_rect(x, gauge_y, fill_w, height,
- SZS_Factions::Levels[faction.level][:bar_color1] || SZS_Factions::Default_BarColor1,
- SZS_Factions::Levels[faction.level][:bar_color2] || SZS_Factions::Default_BarColor2)
- end
- #--------------------------------------------------------------------------
- # * Draw Reputation Text
- #--------------------------------------------------------------------------
- def draw_reputation_text
- x = contents.width/3*2+8
- txt = SZS_Factions::Levels[faction.level][:name]
- fc = Color.new(0,0,0,96)
- contents.fill_rect(x,0,contents.width-x,line_height, fc)
- draw_text(x,0,contents.width-x,line_height, txt,1)
- end
- end
- #==============================================================================
- # ** Window_FactionDescription
- #==============================================================================
- class Window_FactionDescription < Window_Base
- attr_reader :faction
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize(x,y,w,h)
- super(x,y,w,h)
- end
- #--------------------------------------------------------------------------
- # * Set Faction
- #--------------------------------------------------------------------------
- def faction=(faction)
- @faction=faction
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- return unless @faction
- draw_faction_graphic if SZS_Factions::UseGraphics
- draw_faction_desc if SZS_Factions::UseDescriptions
- end
- #--------------------------------------------------------------------------
- # * Draw Faction Graphic
- #--------------------------------------------------------------------------
- def draw_faction_graphic
- return unless SZS_Factions::Factions[@faction.id][:graphic]
- gr = Cache.picture(SZS_Factions::Factions[@faction.id][:graphic])
- aspect = gr.width.to_f / gr.height.to_f
- h = contents.width * aspect
- contents.stretch_blt(Rect.new(0,(contents.height-h),contents.width, h),
- gr, Rect.new(0,0,gr.width, gr.height))
- end
- #--------------------------------------------------------------------------
- # * Draw Faction Description
- #--------------------------------------------------------------------------
- def draw_faction_desc
- return unless SZS_Factions::Factions[@faction.id][:description]
- i = 0
- split_text(SZS_Factions::Factions[@faction.id][:description]).each do |line|
- draw_line_back(0, line_height*i, contents.width, line_height)
- draw_text(0, line_height * i, contents.width, line_height, line, SZS_Factions::DescriptionAlignment)
- i += 1
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Line Back
- #--------------------------------------------------------------------------
- def draw_line_back(x,y,w,h)
- contents.fill_rect(x,y+1,w,h-2, Color.new(0,0,0,96))
- end
- #--------------------------------------------------------------------------
- # * Split Text
- #--------------------------------------------------------------------------
- def split_text(txt)
- txt_splits = []
- line = ""
- txt.split.each do |word|
- line += word + " "
- if contents.text_size(line).width > width
- txt_splits << line
- line = ""
- end
- end
- txt_splits << line if line.size > 0
- txt_splits
- end
- end
- #==============================================================================
- # ** Window_MenuCommand
- #==============================================================================
- class Window_MenuCommand < Window_Command
- alias :szs_factions_add_original_commands :add_original_commands
- #--------------------------------------------------------------------------
- # * For Adding Original Commands
- #--------------------------------------------------------------------------
- def add_original_commands
- szs_factions_add_original_commands
- add_command(SZS_Factions::MenuTerm, :factions) if SZS_Factions::UseInMenu
- end
- end
复制代码
|
|