查看: 2887|回复: 4

[已经过期] 连携技发生NameError

[复制链接]
梦石
0
星屑
50
在线时间
43 小时
注册时间
2016-12-15
回帖
1
发表于 2017-2-11 14:11:52 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
从外站搞了一套脚本,打开后显示其244行出现了NameError
求教大神该怎么处理




代码

  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ 連繋スキル - KGC_CooperationSkill ◆
  3. #_/    ◇ Last update : 2007/11/30 ◇
  4. #_/----------------------------------------------------------------------------
  5. #_/  複数のスキルを組み合わせ、別のスキルを発動させる機能です。
  6. #_/  It is a function to combine some skills, and to execute another skill.
  7. #_/============================================================================
  8. #_/  ≪個別戦闘コマンド[SeparationCommand]≫より下
  9. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  10. #==============================================================================
  11. # ★ カスタマイズ項目 - Customize ★
  12. #==============================================================================

  13. module KGC
  14.   # ◆連繋スキル配列
  15.   #  ≪[発動スキルID, [必要スキルID1, 必要スキルID2, ...]]≫
  16.   #  配列なので、忘れずに , で区切ってください。
  17.   CS_SKILLS = [
  18.     # スパイラルフレア
  19.     [101, [7, 60]],
  20.     [101, [8, 60]],
  21.     [101, [9, 60]],
  22.   ]  # -- Don't delete this line! --

  23.   # ◆敵連繋スキル許可
  24.   #  true にすると、敵も連繋スキル判定を行う。
  25.   CS_PERMIT_ENEMY = true

  26.   # ◆連繋元スキル発動許可
  27.   #  true にすると、連繋元となるスキルもすべて発動する。
  28.   #  false にすると、連繋スキルのみ発動する。
  29.   #  (≪Active Count Battle≫では、最後の連繋元スキルにのみ影響)
  30.   CS_EXECUTE_ORIGIN_SKILL = false

  31.   # ◆ターゲットが同じ場合のみ連繋を許可
  32.   #  元のスキルがすべて同じターゲット(または全体)の場合のみ発動許可。
  33.   #   ※ ランダムターゲットとは相性が良くありません。
  34.   CS_ONLY_SAME_TARGET = true
  35. end

  36. #### CS_SKILLS
  37. ### Array of "Cooperation Skill".
  38. #  << ["Cooperation Skill" ID, [Necessary skill ID 1, ID 2, ...]] >>

  39. #### CS_PERMIT_ENEMY
  40. ### Enables enemy to execute "Cooperation Skill".

  41. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  42. $imported = {} if $imported == nil
  43. $imported["CooperationSkill"] = true

  44. #==============================================================================
  45. # ■ Game_Battler (分割定義 3)
  46. #==============================================================================

  47. class Game_Battler
  48.   #--------------------------------------------------------------------------
  49.   # ● 連繋スキルの効果適用
  50.   #     user_list : スキルの使用者リスト (バトラー)
  51.   #     skill     : スキル
  52.   #     is_actor  : 使用者がアクター
  53.   #--------------------------------------------------------------------------
  54.   def cooperation_skill_effect(user_list, skill, is_actor)
  55.     # クリティカルフラグをクリア
  56.     self.critical = false
  57.     # スキルの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  58.     # またはスキルの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  59.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  60.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  61.       # メソッド終了
  62.       return false
  63.     end
  64.     # 有効フラグをクリア
  65.     effective = false
  66.     # コモンイベント ID が有効の場合は有効フラグをセット
  67.     effective |= skill.common_event_id > 0
  68.     # 第一命中判定
  69.     hit2 = 100 * user_list.size
  70.     if skill.atk_f > 0
  71.       user_list.each { |user|
  72.         hit2 += user.hit * skill.atk_f / 100
  73.       }
  74.     end
  75.     hit2 /= user_list.size * 0.75
  76.     hit = Integer(skill.hit * hit2 / 100)
  77.     hit_result = (rand(100) < hit)
  78.     # 不確実なスキルの場合は有効フラグをセット
  79.     effective |= hit < 100
  80.     # 命中の場合
  81.     if hit_result
  82.       # 威力を計算
  83.       power = 0
  84.       user_list.each { |user|
  85.         power += user.atk * skill.atk_f / 100
  86.       }
  87.       power /= user_list.size * 0.75
  88.       power = Integer(power + skill.power)
  89.       if power > 0
  90.         power -= self.pdef * skill.pdef_f / 200
  91.         power -= self.mdef * skill.mdef_f / 200
  92.         power = [power, 0].max
  93.       end
  94.       # 倍率を計算
  95.       rate = 0
  96.       user_list.each { |user|
  97.         rate += (user.str * skill.str_f / 100)
  98.         rate += (user.dex * skill.dex_f / 100)
  99.         rate += (user.agi * skill.agi_f / 100)
  100.         rate += (user.int * skill.int_f / 100)
  101.       }
  102.       rate /= user_list.size * 0.75
  103.       rate = Integer(rate + 20)
  104.       # 基本ダメージを計算
  105.       self.damage = power * rate / 20
  106.       # 属性修正
  107.       self.damage *= elements_correct(skill.element_set)
  108.       self.damage /= 100
  109.       # ダメージの符号が正の場合
  110.       if self.damage > 0
  111.         # 防御修正
  112.         if self.guarding?
  113.           self.damage /= 2
  114.         end
  115.       end
  116.       # 分散
  117.       if skill.variance > 0 and self.damage.abs > 0
  118.         amp = [self.damage.abs * skill.variance / 100, 1].max
  119.         self.damage += rand(amp+1) + rand(amp+1) - amp
  120.       end
  121.       # 第二命中判定
  122.       eva = 0
  123.       user_dex = 0
  124.       user_list.each { |user|
  125.         user_dex += user.dex
  126.       }
  127.       user_dex /= user_list.size
  128.       eva += 8 * self.agi / user_dex
  129.       eva += self.eva
  130.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  131.       hit = self.cant_evade? ? 100 : hit
  132.       hit_result = (rand(100) < hit)
  133.       # 不確実なスキルの場合は有効フラグをセット
  134.       effective |= hit < 100
  135.     end
  136.     # 命中の場合
  137.     if hit_result
  138.       # 威力 0 以外の物理攻撃の場合
  139.       if skill.power != 0 and skill.atk_f > 0
  140.         # ステート衝撃解除
  141.         remove_states_shock
  142.         # 有効フラグをセット
  143.         effective = true
  144.       end
  145.       # HP からダメージを減算
  146.       last_hp = self.hp
  147.       self.hp -= self.damage
  148.       effective |= self.hp != last_hp
  149.       # ステート変化
  150.       @state_changed = false
  151.       effective |= states_plus(skill.plus_state_set)
  152.       effective |= states_minus(skill.minus_state_set)
  153.       # 威力が 0 の場合
  154.       if skill.power == 0
  155.         # ダメージに空文字列を設定
  156.         self.damage = ""
  157.         # ステートに変化がない場合
  158.         unless @state_changed
  159.           # ダメージに "Miss" を設定
  160.           self.damage = "Miss"
  161.         end
  162.       end
  163.     # ミスの場合
  164.     else
  165.       # ダメージに "Miss" を設定
  166.       self.damage = "Miss"
  167.     end
  168.     # 戦闘中でない場合
  169.     unless $game_temp.in_battle
  170.       # ダメージに nil を設定
  171.       self.damage = nil
  172.     end
  173.     # メソッド終了
  174.     return effective
  175.   end
  176. end

  177. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  178. #==============================================================================
  179. # ■ Game_Actor
  180. #==============================================================================

  181. class Game_Actor < Game_Battler
  182.   #--------------------------------------------------------------------------
  183.   # ● スキルの使用可能判定
  184.   #     skill_id : スキル ID
  185.   #--------------------------------------------------------------------------
  186.   def skill_can_use?(skill_id)
  187.     return super(skill_id)
  188.   end
  189. end

  190. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  191. #==============================================================================
  192. # ■ Game_CooperationSkillUser
  193. #==============================================================================

  194. class Game_CooperationSkillUser
  195.   attr_reader   :index, :skill_id, :target_battlers
  196.   #--------------------------------------------------------------------------
  197.   # ● オブジェクト初期化
  198.   #--------------------------------------------------------------------------
  199.   def initialize(index, skill_id, target_battlers = [])
  200.     @index = index
  201.     @skill_id = skill_id
  202.     @target_battlers = []
  203.     target_battlers.each { |t|
  204.       @target_battlers << t.index
  205.     }
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ● 同値判定
  209.   #--------------------------------------------------------------------------
  210.   def equal?(obj)
  211.     return (obj.is_a?(Game_CooperationSkillUser) &&
  212.       @index == obj.index && @skill_id == obj.skill_id &&
  213.       @target_battlers == obj.target_battlers)
  214.   end
  215. end

  216. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  217. #==============================================================================
  218. # ■ Scene_Battle (分割定義 1)
  219. #==============================================================================

  220. class Scene_Battle
  221.   #--------------------------------------------------------------------------
  222.   # ● メイン処理
  223.   #--------------------------------------------------------------------------
  224.   alias main_KGC_CooperationSkill main
  225.   def main
  226.     # 連繋スキル発動フラグを解除
  227.     @cooperation_skill_exec = false
  228.     @cooperation_skill_id = 0
  229.     # 連繋判定用配列を初期化
  230.     @cooperate_actors = []
  231.     @cooperate_enemies = []

  232.     main_KGC_CooperationSkill
  233.   end
  234. end

  235. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  236. #==============================================================================
  237. # ■ Scene_Battle (分割定義 2)
  238. #==============================================================================

  239. class Scene_Battle
  240.   #--------------------------------------------------------------------------
  241.   # ● パーティコマンドフェーズ開始
  242.   #--------------------------------------------------------------------------
  243.   alias start_phase2_KGC_CooperationSkill start_phase2
  244.   def start_phase2
  245.     # 連繋スキル発動フラグを解除
  246.     @cooperation_skill_exec = false
  247.     @cooperation_skill_id = 0
  248.     # 連繋判定用配列を初期化
  249.     @cooperate_actors = []
  250.     @cooperate_enemies = []

  251.     start_phase2_KGC_CooperationSkill
  252.   end
  253. end

  254. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  255. #==============================================================================
  256. # ■ Scene_Battle (分割定義 4)
  257. #==============================================================================

  258. class Scene_Battle
  259.   unless KGC::CS_EXECUTE_ORIGIN_SKILL || $imported["ActiveCountBattle"]
  260.   #--------------------------------------------------------------------------
  261.   # ● メインフェーズ開始
  262.   #--------------------------------------------------------------------------
  263.   alias start_phase4_KGC_CooperationSkill start_phase4
  264.   def start_phase4
  265.     start_phase4_KGC_CooperationSkill

  266.     # 判定用データ作成
  267.     @cooperate_actors = []
  268.     @cooperate_enemies = []
  269.     init_cooperate_battler_list(0)
  270.     init_cooperate_battler_list(1)
  271.   end
  272.   #--------------------------------------------------------------------------
  273.   # ● 判定用データ初期化
  274.   #--------------------------------------------------------------------------
  275.   def init_cooperate_battler_list(type)
  276.     case type
  277.     when 0  # Actor
  278.       cooperate_battlers = @cooperate_actors
  279.       battler_list = $game_party.actors
  280.     when 1  # Enemy
  281.       cooperate_battlers = @cooperate_actors
  282.       battler_list = $game_troop.enemies
  283.     end
  284.     # 対象側バトラーを設定
  285.     battler_list.each { |battler|
  286.       if battler.current_action.kind == 1
  287.         @active_battler = battler
  288.         skill = $data_skills[battler.current_action.skill_id]
  289.         @target_battlers = []
  290.         set_target_battlers(skill.scope)
  291.         user = Game_CooperationSkillUser.new(battler.index,
  292.           battler.current_action.skill_id,
  293.           @target_battlers.clone)
  294.         cooperate_battlers << user
  295.       end
  296.     }
  297.     @active_battler = nil
  298.   end
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  302.   #--------------------------------------------------------------------------
  303.   alias update_phase4_step2_KGC_CooperationSkill update_phase4_step2
  304.   def update_phase4_step2
  305.     @judged = false
  306.     unless KGC::CS_EXECUTE_ORIGIN_SKILL
  307.       # 行動がスキルの場合
  308.       if @active_battler.current_action.kind == 1
  309.         # 対象側バトラーを設定
  310.         skill = $data_skills[@active_battler.current_action.skill_id]
  311.         @target_battlers = []
  312.         set_target_battlers(skill.scope)
  313.       end
  314.       # 発動判定
  315.       judge_cooperation_skill(@active_battler)
  316.       if @cooperation_skill_exec
  317.         @phase4_step = 6
  318.         return
  319.       end
  320.     end

  321.     update_phase4_step2_KGC_CooperationSkill
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  325.   #--------------------------------------------------------------------------
  326.   alias update_phase4_step6_KGC_CooperationSkill update_phase4_step6
  327.   def update_phase4_step6
  328.     if @cooperation_skill_exec && !@judged
  329.       # 連繋スキル終了
  330.       @cooperation_skill_exec = false
  331.       @cooperation_skill_id = 0
  332.       @exec_battlers = []
  333.     # 発動判定
  334.     elsif KGC::CS_EXECUTE_ORIGIN_SKILL
  335.       judge_cooperation_skill(@active_battler)
  336.     end
  337.     if @cooperation_skill_exec
  338.       execute_cooperation_skill
  339.       @judged = false
  340.       return
  341.     end

  342.     update_phase4_step6_KGC_CooperationSkill
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● 連繋スキル第一発動判定
  346.   #     battler : 判定対象
  347.   #--------------------------------------------------------------------------
  348.   def judge_cooperation_skill(battler)
  349.     if @judged
  350.       return false
  351.     end
  352.     @judged = true

  353.     # 行動がスキルの場合
  354.     if battler.current_action.kind == 1
  355.       # 敵全滅判定
  356.       target_all_dead = true
  357.       target_list = battler.is_a?(Game_Actor) ?
  358.         $game_troop.enemies : $game_party.actors
  359.       target_list.each { |t|
  360.         if t.exist?
  361.           target_all_dead = false
  362.           break
  363.         end
  364.       }
  365.       # 対象が残っていれば第二発動判定
  366.       unless target_all_dead
  367.         return judge_cooperation_skill_second(battler)
  368.       end
  369.     else
  370.       # 判定用配列から削除
  371.       if battler.is_a?(Game_Actor)
  372.         remove_cooperate_battler(0, battler)
  373.       elsif battler.is_a?(Game_Enemy)
  374.         remove_cooperate_battler(1, battler)
  375.       end
  376.     end
  377.     return false
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● 連繋スキル第二発動判定
  381.   #--------------------------------------------------------------------------
  382.   def judge_cooperation_skill_second(battler)
  383.     # 判定用データ作成
  384.     user = Game_CooperationSkillUser.new(battler.index,
  385.       battler.current_action.skill_id,
  386.       @target_battlers.clone)
  387.     @current_cooperate_battler = user
  388.     if battler.is_a?(Game_Actor)
  389.       remove_cooperate_battler(0, battler)
  390.       @cooperate_actors << user
  391.     elsif battler.is_a?(Game_Enemy) && KGC::CS_PERMIT_ENEMY
  392.       remove_cooperate_battler(1, battler)
  393.       @cooperate_enemies << user
  394.     end
  395.     # 連繋スキル発動判定
  396.     KGC::CS_SKILLS.each { |cs|
  397.       # アクター判定
  398.       if battler.is_a?(Game_Actor)
  399.         check_cooperation_exec_battlers(0, cs)
  400.       # エネミー判定
  401.       elsif battler.is_a?(Game_Enemy) && KGC::CS_PERMIT_ENEMY
  402.         check_cooperation_exec_battlers(1, cs)
  403.       end
  404.       if @cooperation_skill_exec
  405.         break
  406.       end
  407.     }
  408.     return @cooperation_skill_exec
  409.   end
  410.   #--------------------------------------------------------------------------
  411.   # ● 連繋スキル発動バトラー判定
  412.   #     type        : 0..Actor  1..Enemy
  413.   #     cs_data : Cooperation skill data
  414.   #--------------------------------------------------------------------------
  415.   def check_cooperation_exec_battlers(type, cs_data)
  416.     @cooperation_skill_exec = false
  417.     case type
  418.     when 0  # Actor
  419.       cooperate_battlers = @cooperate_actors
  420.       battler_list = $game_party.actors
  421.     when 1  # Enemy
  422.       cooperate_battlers = @cooperate_enemies
  423.       battler_list = $game_troop.enemies
  424.     end

  425.     # 行動者が発動者に含まれるか判定
  426.     @exec_battlers = []
  427.     need_skills = cs_data[1].clone
  428.     cs_data[1].each_with_index { |skill_id, i|
  429.       if @current_cooperate_battler.skill_id == skill_id
  430.         @exec_battlers << @current_cooperate_battler
  431.         need_skills.delete_at(i)
  432.         break
  433.       end
  434.     }
  435.     # 行動者が加担していなければ戻る
  436.     if @exec_battlers.size == 0
  437.       return
  438.     end

  439.     # 発動者リストを作成
  440.     need_skills.each { |skill_id|
  441.       user = cooperate_battlers.find { |cb|
  442.         skill_id == cb.skill_id && !@exec_battlers.include?(cb)
  443.       }
  444.       if user == nil
  445.         return
  446.       end
  447.       @exec_battlers << user
  448.     }

  449.     # 発動者全員が発動条件を満たすか判定
  450.     duplicate_battlers = (0..99).to_a
  451.     @exec_battlers.each { |eb|
  452.       if !battler_list[eb.index].exist? ||
  453.           !battler_list[eb.index].skill_can_use?(cs_data[0])
  454.         return
  455.       end
  456.       duplicate_battlers &= eb.target_battlers
  457.     }
  458.     # 同じターゲットを指定しているか判定
  459.     if KGC::CS_ONLY_SAME_TARGET && duplicate_battlers.size == 0
  460.       return
  461.     end

  462.     # 発動フラグを立てる
  463.     @cooperation_skill_exec = true
  464.     @cooperation_skill_id = cs_data[0]
  465.     @cooperation_skill_user = type
  466.     # 発動者を削除
  467.     cooperate_battlers.each_with_index { |cb, i|
  468.       if @exec_battlers.include?(cb)
  469.         @action_battlers.delete(battler_list[cb.index])
  470.         cooperate_battlers[i] = nil
  471.       end
  472.     }
  473.     cooperate_battlers.compact!
  474.   end
  475.   #--------------------------------------------------------------------------
  476.   # ● 連繋加担者削除
  477.   #     type    : 0..アクター  1..エネミー
  478.   #     battler : 削除対象
  479.   #--------------------------------------------------------------------------
  480.   def remove_cooperate_battler(type, battler)
  481.     case type
  482.     when 0  # アクター
  483.       if @cooperate_actors.size > 1
  484.         @cooperate_actors.each_index { |i|
  485.           if @cooperate_actors[i].index == battler.index
  486.             @cooperate_actors[i] = nil
  487.           end
  488.         }
  489.         @cooperate_actors.compact!
  490.       end
  491.     when 1  # エネミー
  492.       if KGC::CS_PERMIT_ENEMY && @cooperate_enemies.size > 1
  493.         @cooperate_enemies.each_index { |i|
  494.           if @cooperate_enemies[i].index == battler.index
  495.             @cooperate_enemies[i] = nil
  496.           end
  497.         }
  498.         @cooperate_enemies.compact!
  499.       end
  500.     end
  501.   end
  502.   #--------------------------------------------------------------------------
  503.   # ● 連繋スキル発動
  504.   #--------------------------------------------------------------------------
  505.   def execute_cooperation_skill
  506.     # スキル取得
  507.     skill = $data_skills[@cooperation_skill_id]
  508.     # ヘルプウィンドウにスキル名を表示
  509.     @help_window.set_text(skill.name, 1)
  510.     if $imported["SkillMessage"]
  511.       # スキル使用メッセージ表示
  512.       show_skill_message(@active_battler, skill)
  513.     end
  514.     # アニメーション ID を設定
  515.     @animation1_id = skill.animation1_id
  516.     @animation2_id = skill.animation2_id
  517.     # コモンイベント ID を設定
  518.     @common_event_id = skill.common_event_id
  519.     # 攻撃対象取得
  520.     @target_battlers = []
  521.     set_target_battlers(skill.scope)

  522.     user_list = []
  523.     case @cooperation_skill_user
  524.     when 0  # アクター
  525.       @exec_battlers.each { |eb|
  526.         user_list << $game_party.actors[eb.index]
  527.       }
  528.       if $imported["ActiveCountBattle"] && @input_battler != nil
  529.         user_list.each { |user|
  530.           if user == @input_battler
  531.             # コマンド入力を解除
  532.             cancel_command_input
  533.           end
  534.         }
  535.       end
  536.       @status_window.refresh
  537.     when 1  # エネミー
  538.       @exec_battlers.each { |eb|
  539.         user_list << $game_troop.enemies[eb.index]
  540.       }
  541.     end
  542.     user_list.each { |user|
  543.       # SP消費
  544.       user.sp -= skill.sp_cost
  545.       # 発動アニメを表示
  546.       user.animation_id = @animation1_id
  547.       user.animation_hit = true
  548.       # OverDrive ゲージ消費
  549.       if $imported["OverDrive2"] && skill.overdrive?
  550.         user.overdrive -= skill.od_cost
  551.       elsif $imported["OverDrive"] &&
  552.           skill.element_set.include?($game_special_elements["overdrive"])
  553.         user.overdrive = 0
  554.       end
  555.     }
  556.     # スキル適用
  557.     @target_battlers.each { |target|
  558.       target.cooperation_skill_effect(user_list, skill,
  559.         @cooperation_skill_user == 0)
  560.     }
  561.     # ステップ 4 に移行
  562.     @phase4_step = 4
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # ● 連繋スキル加担判定
  566.   #     battler : 判定するバトラー
  567.   #--------------------------------------------------------------------------
  568.   def cooperation_exec?(battler)
  569.     if @cooperation_skill_exec
  570.       if !battler.is_a?(Game_Enemy) || KGC::CS_PERMIT_ENEMY
  571.         # 発動者に含まれているか判定
  572.         @exec_battlers.each_index { |i|
  573.           if @exec_battlers[i].index == battler.index
  574.             return true
  575.           end
  576.         }
  577.       end
  578.     end
  579.     return false
  580.   end
  581. end
复制代码
梦石
1
星屑
24088
在线时间
3339 小时
注册时间
2011-7-8
回帖
3862

开拓者

发表于 2017-2-11 15:00:52 | 显示全部楼层
你是不是把这个脚本插在了 Scene_Battle之前了?插在main前面试试?
熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复

使用道具 举报

梦石
0
星屑
50
在线时间
43 小时
注册时间
2016-12-15
回帖
1
 楼主| 发表于 2017-2-11 15:27:20 | 显示全部楼层
guoxiaomi 发表于 2017-2-11 15:00
你是不是把这个脚本插在了 Scene_Battle之前了?插在main前面试试?

解决了,但又出了BUG.....麻烦一并解决了吧........
  1. [code][code][code][code]#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ ダッシュ&8方向移動 - KGC_Dash_8DirMove ◆
  3. #_/    ◇ Last update : 2007/04/28 ◇
  4. #_/----------------------------------------------------------------------------
  5. #_/  マップ移動時のダッシュ&8方向移動機能を追加します。
  6. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  7. #==============================================================================
  8. # ★ カスタマイズ項目 ★
  9. #==============================================================================

  10. module KGC
  11.   # ◆ダッシュボタン
  12.   D8DM_DASH_BUTTON = Input::A
  13.   # ◆ダッシュ速度
  14.   D8DM_DASH_SPEED = 5
  15.   # ◆歩行速度
  16.   D8DM_WALK_SPEED = 4
  17. end

  18. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  19. $imported = {} if $imported == nil
  20. $imported["Dash_8DirMove"] = true

  21. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  22. module Dash
  23.   #--------------------------------------------------------------------------
  24.   # ● 一時ダッシュ速度指定
  25.   #--------------------------------------------------------------------------
  26.   def self.dash_speed=(value)
  27.     $game_system.temp_dash_speed = value
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● 一時歩行速度指定
  31.   #--------------------------------------------------------------------------
  32.   def self.walk_speed=(value)
  33.     $game_system.temp_walk_speed = value
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 一時ダッシュ/歩行速度設定を解除
  37.   #--------------------------------------------------------------------------
  38.   def self.reset_speed
  39.     $game_system.temp_dash_speed = nil
  40.     $game_system.temp_walk_speed = nil
  41.   end
  42. end

  43. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  44. #==============================================================================
  45. # ■ Game_System
  46. #==============================================================================

  47. class Game_System
  48.   #--------------------------------------------------------------------------
  49.   # ● 公開インスタンス変数
  50.   #--------------------------------------------------------------------------
  51.   attr_accessor :dash_permit              # ダッシュ許可フラグ
  52.   attr_accessor :dir8_permit              # 8方向移動許可フラグ
  53.   attr_accessor :temp_dash_speed          # ダッシュ速度(一時)
  54.   attr_accessor :temp_walk_speed          # 歩行速度(一時)
  55.   #--------------------------------------------------------------------------
  56.   # ● オブジェクト初期化
  57.   #--------------------------------------------------------------------------
  58.   alias initialize_KGC_Dash_8DirMove initialize
  59.   def initialize
  60.     initialize_KGC_Dash_8DirMove

  61.     @dash_permit = true
  62.     @dir8_permit = true
  63.     @temp_dash_speed = nil
  64.     @temp_walk_speed = nil
  65.   end
  66. end

  67. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  68. #==============================================================================
  69. # ■ Game_Player
  70. #==============================================================================

  71. class Game_Player < Game_Character
  72.   #--------------------------------------------------------------------------
  73.   # ● フレーム更新
  74.   #--------------------------------------------------------------------------
  75.   def update
  76.     # ローカル変数に移動中かどうかを記憶
  77.     last_moving = moving?
  78.     # 移動中、イベント実行中、移動ルート強制中、
  79.     # メッセージウィンドウ表示中のいずれでもない場合
  80.     unless moving? or $game_system.map_interpreter.running? or
  81.            @move_route_forcing or $game_temp.message_window_showing
  82.       # 向きを保存
  83.       direction = @direction
  84.       # 方向ボタンが押されていれば、その方向へプレイヤーを移動
  85.       if $game_system.dir8_permit
  86.         case Input.dir8
  87.         when 1  # 左下
  88.           move_left
  89.           move_down
  90.           # 向き固定でない場合
  91.           unless @direction_fix
  92.             # 右向きだった場合は左を、上向きだった場合は下を向く
  93.             @direction = (direction == 6 ? 4 : direction == 8 ? 2 : direction)
  94.           end
  95.         when 2  # 下
  96.           move_down
  97.         when 3  # 右下
  98.           move_down
  99.           move_right
  100.           # 向き固定でない場合
  101.           unless @direction_fix
  102.             # 左向きだった場合は右を、上向きだった場合は下を向く
  103.             @direction = (direction == 4 ? 6 : direction == 8 ? 2 : direction)
  104.           end
  105.         when 4  # 左
  106.           move_left
  107.         when 6  # 右
  108.           move_right
  109.         when 7  # 左上
  110.           move_up
  111.           move_left
  112.           # 向き固定でない場合
  113.           unless @direction_fix
  114.             # 右向きだった場合は左を、下向きだった場合は上を向く
  115.             @direction = (direction == 6 ? 4 : direction == 2 ? 8 : direction)
  116.           end
  117.         when 8  # 上
  118.           move_up
  119.         when 9  # 右上
  120.           move_right
  121.           move_up
  122.           # 向き固定でない場合
  123.           unless @direction_fix
  124.             # 左向きだった場合は右を、下向きだった場合は上を向く
  125.             @direction = (direction == 4 ? 6 : direction == 2 ? 8 : direction)
  126.           end
  127.         end
  128.       else
  129.         case Input.dir4
  130.         when 2
  131.           move_down
  132.         when 4
  133.           move_left
  134.         when 6
  135.           move_right
  136.         when 8
  137.           move_up
  138.         end
  139.       end

  140.       # 歩行速度調整
  141.       if $game_system.dash_permit && Input.press?(KGC::D8DM_DASH_BUTTON)
  142.         if $game_system.temp_dash_speed == nil
  143.           @move_speed = KGC::D8DM_DASH_SPEED
  144.         else
  145.           @move_speed = $game_system.temp_dash_speed
  146.         end
  147.       else
  148.         if $game_system.temp_walk_speed == nil
  149.           @move_speed = KGC::D8DM_WALK_SPEED
  150.         else
  151.           @move_speed = $game_system.temp_walk_speed
  152.         end
  153.       end
  154.     end
  155.     # ローカル変数に座標を記憶
  156.     last_real_x = @real_x
  157.     last_real_y = @real_y
  158.     super
  159.     # キャラクターが下に移動し、かつ画面上の位置が中央より下の場合
  160.     if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  161.       # マップを下にスクロール
  162.       $game_map.scroll_down(@real_y - last_real_y)
  163.     end
  164.     # キャラクターが左に移動し、かつ画面上の位置が中央より左の場合
  165.     if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  166.       # マップを左にスクロール
  167.       $game_map.scroll_left(last_real_x - @real_x)
  168.     end
  169.     # キャラクターが右に移動し、かつ画面上の位置が中央より右の場合
  170.     if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  171.       # マップを右にスクロール
  172.       $game_map.scroll_right(@real_x - last_real_x)
  173.     end
  174.     # キャラクターが上に移動し、かつ画面上の位置が中央より上の場合
  175.     if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  176.       # マップを上にスクロール
  177.       $game_map.scroll_up(last_real_y - @real_y)
  178.     end
  179.     # 移動中ではない場合
  180.     unless moving?
  181.       # 前回プレイヤーが移動中だった場合
  182.       if last_moving
  183.         # 同位置のイベントとの接触によるイベント起動判定
  184.         result = check_event_trigger_here([1,2])
  185.         # 起動したイベントがない場合
  186.         if result == false
  187.           # デバッグモードが ON かつ CTRL キーが押されている場合を除き
  188.           unless $DEBUG and Input.press?(Input::CTRL)
  189.             # エンカウント カウントダウン
  190.             if @encounter_count > 0
  191.               @encounter_count -= 1
  192.             end
  193.           end
  194.         end
  195.       end
  196.       # C ボタンが押された場合
  197.       if Input.trigger?(Input::C)
  198.         # 同位置および正面のイベント起動判定
  199.         check_event_trigger_here([0])
  200.         check_event_trigger_there([0,1,2])
  201.       end
  202.     end
  203.   end
  204. end
复制代码
[/code][/code][/code]
[/code]
捕获26.PNG
捕获27.PNG

点评

把脚本插在main前,以及其他所有的脚本后面……  发表于 2017-2-11 16:54
把脚本插在main前……把脚本插在main前……把脚本插在main前……把脚本插在main前……把脚本插在main前……  发表于 2017-2-11 16:53
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部