赞 | 11 |
VIP | 302 |
好人卡 | 162 |
积分 | 62 |
经验 | 108302 |
最后登录 | 2024-11-2 |
在线时间 | 6592 小时 |
Lv4.逐梦者 醉啸 长风万里
- 梦石
- 0
- 星屑
- 6157
- 在线时间
- 6592 小时
- 注册时间
- 2007-12-16
- 帖子
- 4501
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 仲秋启明 于 2010-12-5 16:29 编辑
这是一个完善的技能树,具体设置脚本里有
不知道是什么的未翻译- #==============================================================================
- # 练习习得技能2.0b
- # 作者BY: modern algebra
- # 提供BY: 企鹅达达
- # 翻译BY: 仲秋启明
- # 感觉制作ARPG更好
- #==============================================================================
- # 使用方法A:
- # 在技能注释中加入\ROOT_SKILL[X, N]
- # 只有一个技能可以联系此技能
- # X:技能ID N:使用次数
- # 使用方法B:
- # \ROOT_SKILL[X, N, X]
- # \ROOT_SKILL[Z, N, <Y>]
- # \ROOT_SKILL[Y, N, <Z>]
- # 有两个个技能可以联系此技能
- # X、Y、Z:技能ID N:使用次数
- # 以上两个方法学到的技能都会忘记
- # 使用方法C:
- # \ROOT_SKILL[X, N]
- # \ROOT_SKILL[Y, M]
- # \ROOT_SKILL[X, A, <Y, Z>]
- # \ROOT_SKILL[Y, B, <X, Z>]
- # \ROOT_SKILL[Z, C, <X, Y>]
- # X、Y、Z:技能ID N、M、A、B、C:使用次数
- # 这个个方法学到的技能不会忘记
- # \PROHIBIT_CLASS[X]
- # 职业限定 X:职业ID
- # \MIN_LEVEL[X]
- # 最低等级 X:等级
- # \MASTER[X]
- # 使用者(应该是这样,测试未成功) X:角色ID
- #==============================================================================
- #==============================================================================
- # 设定
- #==============================================================================
- LSU_LEARN_IMMEDIATELY = true #是否使用
- LSU_VOCAB_OBTAIN_SKILL = "%n 学习到了 %s!" #语言设定
- LSU_SE_OBTAIN_SKILL = "Skill"
- LSU_SHOW_USE = true #技能菜单显示使用次数
- LSU_VOCAB_USECOUNT = "Used: " #技能菜单显示文字
- LSU_BUTTONSHOW = false #按钮设置(最好不打开)
- LSU_BUTTON = Input::SHIFT
- LSU_SHOWCOUNT_ALIGN = 0
- LSU_COUNT_FONTCOLOR = 16
- LSU_SHOW_MASTERY = false
- LSU_DEFAULT_MASTERY = 100
- LSU_VOCAB_MASTERY = "[MASTERED]"
- LSU_MASTER_REPLACE = true
- #==============================================================================
- # Dialog 父类脚本 BY:Zeriab
- #==============================================================================
- class Dialog
- STARTING_Z_VALUE = 1500
- attr_accessor :value
- attr_writer :marked_to_close
- def marked_to_close
- @marked_to_close = false if @marked_to_close.nil?
- return @marked_to_close
- end
- def mark_to_close
- self.marked_to_close = true
- end
- def self.show(*args, &block)
- dialog = self.new(*args, &block)
- dialog.marked_to_close = false
- return dialog.main
- end
- def initialize(*args, &block)
- end
- def main
- create_background
- main_window
- loop do
- Graphics.update
- Input.update
- update
- if marked_to_close
- break
- end
- end
- main_dispose
- dispose_background
- Input.update
- return self.value
- end
- def create_background
- bitmap = Bitmap.new(Graphics.width,Graphics.height)
- bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0,128))
- @background_sprite = Sprite.new
- @background_sprite.z = STARTING_Z_VALUE
- @background_sprite.bitmap = bitmap
- end
- def main_window
- end
- def dispose_background
- @background_sprite.dispose
- end
- def main_dispose
- end
- def update
- if Input.trigger?(Input::B)
- mark_to_close
- end
- end
- end
- #==============================================================================
- # ** 正文开始
- #==============================================================================
- if LSU_LEARN_IMMEDIATELY
- #==============================================================================
- # ** Dialog_DiscoverFavourite
- #==============================================================================
- class Dialog_LearnSkill < Dialog
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 初始化
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def initialize(actor, skill)
- @actor = actor
- @skill = skill
- begin
- (RPG::SE.new (*skill.ma_learn_se)).play
- rescue
- (RPG::SE.new ("Skill")).play
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 生成窗口
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def main_window
- text = help_text
- tw = [@background_sprite.bitmap.text_size (text).width + 40, Graphics.width].min
- @learn_window = Window_Help.new
- @learn_window.width = tw
- @learn_window.create_contents
- @learn_window.x = (Graphics.width - tw) / 2
- @learn_window.y = (Graphics.height - @learn_window.height) / 2
- @learn_window.z = STARTING_Z_VALUE + 1
- @learn_window.set_text (text, 1)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 帮助文字
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def help_text
- text = LSU_VOCAB_OBTAIN_SKILL.gsub (/%s/) { @skill.name }
- text.gsub! (/%n/) { @actor.name }
- return text
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 关闭窗口
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def main_dispose
- @learn_window.dispose
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 更新
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def update
- if Input.trigger?(Input::B) || Input.trigger?(Input::C)
- mark_to_close
- self.value = false
- end
- end
- end
- end
- #==============================================================================
- # ** Skill
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # 技能设定
- #==============================================================================
- class RPG::Skill
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 公开变量
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- attr_accessor :ma_root_skills
- attr_accessor :ma_descendant_skills
- attr_accessor :ma_level_requirement
- attr_accessor :ma_prohibited_classes
- attr_accessor :ma_master_uses
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * SE
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def ma_learn_se
- if self.note[/\\LEARN_SE\[(.+?),?\s*(\d*?),?\s*(\d*?)\]/i] != nil
- learn_se = [$1.to_s]
- learn_se.push ($2.to_i) unless $2.empty?
- learn_se.push ($3.to_i) unless $3.empty?
- else
- return LSU_SE_OBTAIN_SKILL
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 判定
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def ma_cache_lsu_skill_stats
- @ma_root_skills, @ma_prohibited_classes = [], []
- @ma_descendant_skills = [] if @ma_descendant_skills.nil?
- @ma_master_uses, @ma_level_requirement = LSU_DEFAULT_MASTERY, 1
- #等级
- @ma_level_requirement = $1.to_i if self.note[/\\MIN_LEVEL\[(\d+)\]/i] != nil
- @ma_master_uses = $1.to_i if self.note[/\\MASTERY?\[(\d+)\]/i] != nil && $1.to_i > 0
- root_paths = {}
- root_skills = []
- (self.note.scan (/\\ROOT_SKILL\[(\d+),?\s*(\d*),?\s*?<?([\d ,;:]*?)>?,?\s*?([F1]?)\]/i)).each { |match|
- id = match[0].to_i
- n = match[1].to_i
- supplement_skills = []
- (match[2].scan (/\d+?/)).each { |id2| supplement_skills.push (id2.to_i) } unless match[2].empty?
- forget = !match[3].empty?
- root_skills.push ([id, n, forget, supplement_skills])
- }
- root_skills.each { |array|
- key = ([array[0]] + array[3]).sort
- root_paths[key] = [] if !root_paths[key]
- root_paths[key].push (array[0, 3])
- }
- root_paths.each { |key, path|
- if path.size < key.size
- key.each { |key2|
- exists = false
- path.each { |array| exists = true if path[0] == key2 }
- path.push ([key2, 0, false]) if !exists
- }
- end
- path.sort! { |a, b| a[0] <=> b[0] }
- @ma_root_skills.push (path)
- }
- @ma_root_skills.each { |path|
- path.each { |d_id, n, forget|
- $data_skills[d_id].ma_descendant_skills = [] if $data_skills[d_id].ma_descendant_skills.nil?
- d_skills = $data_skills[d_id].ma_descendant_skills
- d_skills.push (self.id) unless d_skills.include? (self.id)
- }
- }
- # 职业
- (self.note.scan (/\\PROHIBIT_CLASS\[(\d+)\]/i)).each { |id|
- @ma_prohibited_classes.push (id[0].to_i)
- }
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 兼容性
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if self.method_defined? (:ma_reset_note_values)
- alias malg_lsu_rsetnote_8uk2 ma_reset_note_values
- def ma_reset_note_values (*args)
- malg_lsu_rsetnote_8uk2 (*args)
- @ma_root_skills.each { |path|
- path.each { |a| $data_skills[a[0]].ma_descendant_skills.delete (self.id) }
- }
- ma_cache_lsu_skill_stats
- end
- end
- end
- #==============================================================================
- # ** Game_Actor
- #==============================================================================
- class Game_Actor
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 初始化
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias modalg_brnchskill_stp_1xc3 setup
- def setup (*args)
- @lsbu_skill_count = []
- modalg_brnchskill_stp_1xc3(*args)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 升级
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias malg_skl_brnches_byuse_lvlplus_0kb2 level_up
- def level_up (*args)
- malg_skl_brnches_byuse_lvlplus_0kb2 (*args)
- skills.each { |skill|
- skill.ma_descendant_skills.each { |descendant_id|
- descen = $data_skills[descendant_id]
- if [email protected]? (descen.id) && lsu_skill_requirements_met? (descen)
- learn_skill_by_use (descen.id)
- end
- }
- }
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 学习判定
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def lsu_skill_requirements_met? (skill)
- return false if skill.ma_prohibited_classes.include? (@class_id)
- return false if @level < skill.ma_level_requirement
- skill.ma_root_skills.each { |path|
- path_complete = true
- path.each { |reqs|
- if skill_count (reqs[0]) < reqs[1]
- path_complete = false
- break
- end
- }
- return true if path_complete # If all requirements met
- }
- return false
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 学习技能
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def learn_skill_by_use (skill_id)
- forgets = []
- $data_skills[skill_id].ma_root_skills.each { |path|
- path.each { |reqs| forgets.push (reqs[0]) if reqs[2] }
- }
- forgets.each { |forget_id| forget_skill (forget_id) }
- learn_skill (skill_id)
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 学习完要忘记前面的
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def skill_count (skill_id)
- @lsbu_skill_count[skill_id] = 0 if @lsbu_skill_count[skill_id].nil?
- return @lsbu_skill_count[skill_id]
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 增加技能点
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def increase_skill_count (skill_id)
- @lsbu_skill_count[skill_id] = skill_count (skill_id) + 1
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 关于敌人
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def skill_mastered? (skill)
- return skill_count (skill.id) >= skill.ma_master_uses
- end
- end
- #==============================================================================
- # ** Window_Help
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- #==============================================================================
- class Window_Help
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 生成文字
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def lsu_insert_secondary_text (text, align = 2)
- if (@lsu_changed_text != @text) || (@lsu_changed_align != @align)
- if LSU_COUNT_FONTCOLOR.is_a? (Integer)
- self.contents.font.color = text_color (LSU_COUNT_FONTCOLOR)
- else
- self.contents.font.color = Color.new (*LSU_COUNT_FONTCOLOR)
- end
- self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
- @lsu_changed_text, @lsu_changed_align = @text, @align
- end
- end
- end
- #==============================================================================
- # ** Window_Skill
- #==============================================================================
- class Window_Skill
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 刷新帮助文字
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias ma_lsu_updhelp_uses_8kh2 update_help
- def update_help (*args)
- if LSU_BUTTONSHOW
- if Input.press? (LSU_BUTTON) && @actor
- @help_window.set_text (ma_use_text, LSU_SHOWCOUNT_ALIGN)
- else
- ma_lsu_updhelp_uses_8kh2 (*args)
- end
- else
- ma_lsu_updhelp_uses_8kh2 (*args)
- return unless @actor && skill
- @help_window.lsu_insert_secondary_text (ma_use_text)
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 生成文字判定
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def ma_use_text
- add = ""
- if LSU_SHOW_MASTERY
- if @actor.skill_mastered? (skill)
- return LSU_VOCAB_MASTERY if LSU_MASTER_REPLACE
- add = LSU_VOCAB_MASTERY
- else
- add = " / #{skill.ma_master_uses}"
- end
- end
- return LSU_VOCAB_USECOUNT + @actor.skill_count(skill.id).to_s + add
- end
- end
- #==============================================================================
- # ** Scene_Base
- #==============================================================================
- class Scene_Base
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 计算增加次数
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def lsu_advance_skill_count (user, skill)
- user.increase_skill_count (skill.id)
- if LSU_LEARN_IMMEDIATELY
- new_skills = []
- skill.ma_descendant_skills.each { |descendant_id|
- descendant = $data_skills[descendant_id]
- if !user.skill_learn? (descendant) && user.lsu_skill_requirements_met? (descendant)
- new_skills.push (descendant)
- end
- }
- for new_skill in new_skills
- user.learn_skill_by_use (new_skill.id)
- Dialog_LearnSkill.show (user, new_skill)
- end
- end
- end
- end
- #==============================================================================
- # ** Scene_Title
- #==============================================================================
- class Scene_Title
- alias malsu_lddata_5yj7 load_database
- def load_database (*args)
- malsu_lddata_5yj7 (*args
- $data_skills.each { |skill| skill.ma_cache_lsu_skill_stats if !skill.nil? }
- end
- alias malg_lsu_btdat_6yh1 load_bt_database
- def load_bt_database (*args)
- malg_lsu_btdat_6yh1 (*args)
- $data_skills.each { |skill| skill.ma_cache_lsu_skill_stats if !skill.nil? }
- end
- end
- #==============================================================================
- # ** Scene_Skill
- #==============================================================================
- class Scene_Skill
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 使用技能
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias ma_lsu_uskll_7uj2 use_skill_nontarget
- def use_skill_nontarget (*args)
- ma_lsu_uskll_7uj2 (*args)
- lsu_advance_skill_count (@actor, @skill)
- end
- end
- #==============================================================================
- # ** Scene Battle
- #==============================================================================
- class Scene_Battle
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # * 使用技能
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- alias mdrnalg_exctskl_lsbu_4nv2 execute_action_skill
- def execute_action_skill (*args)
- mdrnalg_exctskl_lsbu_4nv2 (*args)
- lsu_advance_skill_count (@active_battler, @active_battler.action.skill) if @active_battler.actor?
- end
- end
复制代码 我也不知道为什么汉化后会无法进入游戏
范例奉上:
练习习得技能.rar
(250.94 KB, 下载次数: 564)
|
评分
-
查看全部评分
|