赞 | 8 |
VIP | 0 |
好人卡 | 0 |
积分 | 21 |
经验 | 11208 |
最后登录 | 2024-10-18 |
在线时间 | 664 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 2084
- 在线时间
- 664 小时
- 注册时间
- 2014-2-15
- 帖子
- 81
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 资深萝莉控 于 2016-9-23 20:08 编辑
使用的多职业脚本72行发生no method error,为什么?还有该怎么设定副职业@tseyik
- #==============================================================================
- # ■マルチクラス for RGSS3 Ver0.80-α
- # □作成者 kure
- #==============================================================================
- $kure_integrate_script = {} if $kure_integrate_script == nil
- $kure_integrate_script[:multiclass] = 100
- p "マルチクラス"
- module KURE
- module MultiClass
- #初期設定(変更しない事)------------------------------------------------------
- CLASS_SETTING = []
-
- #基本職の反映設定------------------------------------------------------------
- #BASE_CLASS = [項目1,項目2]
- #項目1 → パラメータ反映率(割合で設定)
- #項目2 → スキル習得を反映するか (1=反映する, 0=反映しない)
- BASE_CLASS = [1, 1]
-
- #拡張職の反映設定------------------------------------------------------------
- #CLASS_SETTING[ID] = [項目1,項目2,項目3,]
- #項目1 → パラメータ反映率 (割合で設定)
- #項目2 → 特徴を反映するか (1=反映する, 0=反映しない)
- #項目3 → スキル習得を反映するか (1=反映する, 0=反映しない)
- #項目4 → 経験値獲得率の補正 (割合で設定)
-
- CLASS_SETTING[0] = [0.5, 1, 1, 0.4]
- CLASS_SETTING[1] = [1, 1, 1, 1]
- CLASS_SETTING[2] = [1, 1, 1, 1]
-
- #表示設定
- #基本職の職名を表示するか(0=表示しない 1=表示する)
- VIEW_BASE_CLASS_NAME = 1
- #基本職のレベルを表示するか(0=表示しない 1=表示する)
- VIEW_BASE_CLASS_LEVEL = 1
-
- #職名を表示しない拡張職IDを指定
- NO_VIEW_ADVCLASS = [1]
- #レベルを表示しない拡張職IDを指定
- NO_VIEW_ADVCLASS_LV = [1]
- end
- end
- #==============================================================================
- # ■ RPG::Class(追加定義)
- #==============================================================================
- class RPG::Class < RPG::BaseItem
- #--------------------------------------------------------------------------
- # ★ 職業別最大レベル
- #--------------------------------------------------------------------------
- def max_adv_level
- @note.match(/<最大レベル\s?(\d+)\s?>/)
- return $1 ? $1.to_i : nil
- end
- #--------------------------------------------------------------------------
- # ★ 短縮職業名
- #--------------------------------------------------------------------------
- def short_class_name
- @note.match(/<短縮名称\s?(.+?)\s?>/)
- return $1 ? $1 : @name
- end
- end
- #==============================================================================
- # ■ RPG::Actor(追加定義)
- #==============================================================================
- class RPG::Actor < RPG::BaseItem
- #--------------------------------------------------------------------------
- # ★ 拡張職の定義(追加定義)
- #--------------------------------------------------------------------------
- def adv_class_id
- KURE.add_feature_basic([], @note, "拡張職", 31, 111)
- end
- end
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # □ レベルの描画(再定義)
- #--------------------------------------------------------------------------
- def draw_actor_level(actor, x, y)
- change_color(system_color)
- draw_text(x, y, 32, line_height, Vocab::level_a)
-
- actor_level = ""
- actor_level = actor.level.to_s if KURE::MultiClass::VIEW_BASE_CLASS_LEVEL == 1
- length = 0
- actor.adv_class_id.each_with_index{|block, index|
- next unless block
- next if KURE::MultiClass::NO_VIEW_ADVCLASS_LV.include?(index)
- actor_level += "/" + block[1].to_s ; length += 34 }
-
- change_color(normal_color)
- draw_text(x + 32, y, 24 + length, line_height, actor_level)
- end
- #--------------------------------------------------------------------------
- # ■ 職業の描画(再定義)
- #--------------------------------------------------------------------------
- def draw_actor_class(actor, x, y, width = 180)
- change_color(normal_color)
-
- actor_calss_name = ""
- actor_calss_name += actor.class.name if KURE::MultiClass::VIEW_BASE_CLASS_NAME == 1
- actor.adv_class_id.each_with_index{|block, index|
- next unless block
- next if KURE::MultiClass::NO_VIEW_ADVCLASS.include?(index)
- actor_calss_name += "/" unless actor_calss_name == ""
- actor_calss_name += $data_classes[block[0]].short_class_name}
-
- draw_text(x, y, width, line_height, actor_calss_name)
- end
- end
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- attr_reader :adv_class_id # 拡張職業
- #--------------------------------------------------------------------------
- # ◎ スキルの初期化(エイリアス再定義)
- #--------------------------------------------------------------------------
- alias k_multiclass_before_init_skills init_skills unless $!
- def init_skills
- k_multiclass_before_init_skills
- @adv_class_id.each{|block|
- next unless block
- learn_class_skills(block[0], block[1])}
- end
- #--------------------------------------------------------------------------
- # ◎ 経験値の初期化(エイリアス再定義)
- #--------------------------------------------------------------------------
- alias k_multiclass_before_init_exp init_exp unless $!
- def init_exp
- k_multiclass_before_init_exp
- init_adv_exp
- end
- #--------------------------------------------------------------------------
- # ★ 拡張職業の初期化(追加定義)
- #--------------------------------------------------------------------------
- def init_adv_exp
- @adv_class_id = []
-
- actor.adv_class_id.each{|block|
- next if block[1] == @class_id
- @adv_class_id[block[0]] = [block[1], block[2]]}
-
- @adv_class_id.each{|block|
- next unless block
- @exp[block[0]] = current_adv_level_exp(block[0], block[1])}
- end
- #--------------------------------------------------------------------------
- # ★ 指定IDの職業の指定レベルの最低経験値を取得(追加定義)
- #--------------------------------------------------------------------------
- def current_adv_level_exp(id, level)
- adv_exp_for_level(id, level)
- end
- #--------------------------------------------------------------------------
- # ★ 指定IDの職業の指定レベルに上がるのに必要な累計経験値の取得(追加定義)
- #--------------------------------------------------------------------------
- def adv_exp_for_level(id, level)
- $data_classes[id].exp_for_level(level)
- end
- #--------------------------------------------------------------------------
- # ★ 指定IDの職業の指定レベルの次のレベルの経験値を取得
- #--------------------------------------------------------------------------
- def adv_next_level_exp(id, level)
- adv_exp_for_level(id, level + 1)
- end
- #--------------------------------------------------------------------------
- # ★ 最大レベル(追加定義)
- #--------------------------------------------------------------------------
- def max_adv_level(id)
- $data_classes[id].max_adv_level ? $data_classes[id].max_adv_level : actor.max_level
- end
- #--------------------------------------------------------------------------
- # ★ 最大レベル判定(追加定義)
- #--------------------------------------------------------------------------
- def max_adv_level?(id)
- @adv_class_id[id][1] >= max_adv_level(@adv_class_id[id][0])
- end
- #--------------------------------------------------------------------------
- # ★ 指定IDの職業の経験値の取得
- #--------------------------------------------------------------------------
- def adv_exp(id)
- @exp[id]
- end
- #--------------------------------------------------------------------------
- # ★ 拡張職業の経験値の変更(追加定義)
- # show : レベルアップ表示フラグ
- #--------------------------------------------------------------------------
- def change_adv_exp(id, exp, show)
- return unless @adv_class_id[id]
- adv_id = @adv_class_id[id][0]
- @exp[adv_id] = [exp, 0].max
- @adv_class_id[id][1] ||= 1
- last_level = @adv_class_id[id][1]
- last_skills = skills
- adv_level_up(id) while !max_adv_level?(id) && adv_exp(adv_id) >= adv_next_level_exp(adv_id, @adv_class_id[id][1])
- adv_level_down(id) while adv_exp(adv_id) < current_adv_level_exp(adv_id, @adv_class_id[id][1])
- display_adv_level_up(id, skills - last_skills) if show && @adv_class_id[id][1] > last_level
- refresh
- end
- #--------------------------------------------------------------------------
- # ★ 拡張職のレベルアップ(追加定義)
- #--------------------------------------------------------------------------
- def adv_level_up(id)
- @adv_class_id[id][1] += 1
- return if multi_class_data(id, 2) == 0
- $data_classes[@adv_class_id[id][0]].learnings.each { |learning|
- learn_skill(learning.skill_id) if learning.level == @adv_class_id[id][1]}
- end
- #--------------------------------------------------------------------------
- # ★ 拡張職のレベルダウン(追加定義)
- #--------------------------------------------------------------------------
- def adv_level_down(id)
- @adv_class_id[id][1] -= 1
- return if multi_class_data(id, 2) == 0
- $data_classes[@adv_class_id[id][0]].learnings.each { |learning|
- forget_skill(learning.skill_id) if learning.level > @adv_class_id[id][1]}
- end
- #--------------------------------------------------------------------------
- # ★ 拡張職のレベルアップメッセージの表示
- #--------------------------------------------------------------------------
- def display_adv_level_up(id, new_skills)
- $game_message.new_page
- class_name = $data_classes[@adv_class_id[id][0]].name
-
- $game_message.add(sprintf(Vocab::LevelUp, @name, class_name + "の" + Vocab::level + "が" , @adv_class_id[id][1]))
- new_skills.each do |skill|
- $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))
- end
- end
- #--------------------------------------------------------------------------
- # ◎ 経験値の獲得(経験獲得率を考慮)(エイリアス再定義)
- #--------------------------------------------------------------------------
- alias k_multiclass_before_gain_exp gain_exp
- def gain_exp(exp)
- k_multiclass_before_gain_exp(exp)
- @adv_class_id.each_with_index{|block, index|
- next unless block
- adv_gain_exp(index, exp)}
- end
- #--------------------------------------------------------------------------
- # ★ 拡張職の経験値の獲得(経験獲得率を考慮)
- #--------------------------------------------------------------------------
- def adv_gain_exp(id, exp, show = true)
- return unless @adv_class_id[id]
- change_adv_exp(id, adv_exp(@adv_class_id[id][0]) + (exp * final_exp_rate * multi_class_data(id, 3)).to_i, show)
- end
- #--------------------------------------------------------------------------
- # ★ 拡張職のレベルの変更(追加定義)
- #--------------------------------------------------------------------------
- def change_adv_level(id, level, show)
- return unless @adv_class_id[id]
-
- exp = [[@adv_class_id[id][1] + level, max_adv_level(@adv_class_id[id][0])].min, 1].max
- change_adv_exp(id, adv_exp_for_level(@adv_class_id[id][0], exp), show)
- end
- #--------------------------------------------------------------------------
- # ★ 指定IDのクラスの指定レベルまでのスキルを習得(追加定義)
- #--------------------------------------------------------------------------
- def learn_class_skills(id, level)
- $data_classes[id].learnings.each { |learning|
- learn_skill(learning.skill_id) if learning.level <= level}
- end
- #--------------------------------------------------------------------------
- # ★ 指定IDのクラスのスキルを忘れる(追加定義)
- #--------------------------------------------------------------------------
- def forget_class_skills(id)
- $data_classes[id].learnings.each { |learning| forget_skill(learning.skill_id)}
- end
- #--------------------------------------------------------------------------
- # □ 通常能力値の基本値取得(再定義)
- #--------------------------------------------------------------------------
- def param_base(param_id)
- value = self.class.params[param_id, @level] * KURE::MultiClass::BASE_CLASS[0]
- @adv_class_id.each_with_index{|block, index|
- next unless block
- value += $data_classes[block[0]].params[param_id, block[1]] * multi_class_data(index, 0)
- }
- return value
- end
- #--------------------------------------------------------------------------
- # ★ 特徴を反映する拡張職業の配列を取得(追加定義)
- #--------------------------------------------------------------------------
- def multi_class_obj
- @adv_class_id ||=[] ; result = []
- @adv_class_id.each_with_index{|block, index|
- next unless block
- next if multi_class_data(index, 1) == 0
- result.push($data_classes[block[0]])}
- return result
- end
- #--------------------------------------------------------------------------
- # ★ 特徴を反映する拡張職業のメモを取得(追加定義)
- #--------------------------------------------------------------------------
- def multi_class_note
- multi_class_obj.inject("") {|r, item| r += item.note }
- end
- #--------------------------------------------------------------------------
- # ★ 拡張職の反映データ取得(追加定義)
- #--------------------------------------------------------------------------
- def multi_class_data(id, value)
- return 0 unless KURE::MultiClass::CLASS_SETTING[id]
- return KURE::MultiClass::CLASS_SETTING[id][value]
- end
- #--------------------------------------------------------------------------
- # □ レベルアップ(再定義)
- #--------------------------------------------------------------------------
- def level_up
- @level += 1
- return if KURE::MultiClass::BASE_CLASS[1] == 0
- self.class.learnings.each do |learning|
- learn_skill(learning.skill_id) if learning.level == @level
- end
- end
- #--------------------------------------------------------------------------
- # □ レベルダウン(再定義)
- #--------------------------------------------------------------------------
- def level_down
- @level -= 1
- return if KURE::MultiClass::BASE_CLASS[1] == 0
- self.class.learnings.each do |learning|
- forget_skill(learning.skill_id) if learning.level > @level
- end
- end
- #--------------------------------------------------------------------------
- # □ 職業の変更(再定義)
- # keep_exp : 経験値を引き継ぐ
- #--------------------------------------------------------------------------
- def change_class(class_id, keep_exp = false)
- @exp[class_id] = exp if keep_exp
- @class_id = class_id
- change_exp(@exp[@class_id] || 0, false)
-
- #重複した職業が存在すれば削除する
- @adv_class_id.each_with_index{|block,index|
- next unless @adv_class_id[index]
- @adv_class_id[index] = nil if block[0] == class_id}
-
- fix_memorize if $kure_integrate_script[:Memorize3]
- refresh
- end
- #--------------------------------------------------------------------------
- # ★ 拡張職業の変更(追加定義)
- #--------------------------------------------------------------------------
- def change_adv_class(id, class_id, keep_exp = false)
- #基本職には転職できない
- return if class_id == @class_id
- #ID0の場合は職業を辞める
- if class_id == 0 or class_id == nil
- @adv_class_id[id] = nil
- else
- @exp[class_id] = adv_exp(@adv_class_id[id][0]) if keep_exp && @adv_class_id[id]
- @adv_class_id[id] ||= []
- @adv_class_id[id][0] = class_id
- @adv_class_id[id][1] = 1
- change_adv_exp(id, @exp[class_id] || 0, false)
- learn_class_skills(class_id, 1)
- #重複した職業が存在すれば削除する
- @adv_class_id.each_with_index{|block,index|
- next unless block
- next if index == id
- @adv_class_id[index] = nil if block[0] == class_id}
- end
- fix_memorize if $kure_integrate_script[:Memorize3]
- refresh
- end
- end
- #==============================================================================
- # ■ Game_Interpreter(追加定義)
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # ● 拡張職の変更(追加定義)
- #--------------------------------------------------------------------------
- def change_adv_class(id, actor_id, class_id)
- actor = $game_actors[actor_id]
- actor.change_adv_class(id, class_id)
- end
- #--------------------------------------------------------------------------
- # ● 拡張職のレベルの増減(追加定義)
- #--------------------------------------------------------------------------
- def change_adv_lv(id, actor_id, value, show)
- actor = $game_actors[actor_id]
- actor.change_adv_level(id, value, show)
- end
- #--------------------------------------------------------------------------
- # ● 拡張職経験値の増減(追加定義)
- #--------------------------------------------------------------------------
- def change_adv_exp(id, actor_id, value, show)
- actor = $game_actors[actor_id]
- actor.adv_gain_exp(id, value, show)
- end
- end
复制代码 |
|