查看: 2748|回复: 19

[已经解决] 二刀流的bug请各位大大帮忙解决

[复制链接]
梦石
0
星屑
3181
在线时间
1439 小时
注册时间
2009-7-27
回帖
1187
发表于 2017-9-28 00:10:23 | 显示全部楼层 |阅读模式

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

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

×
加了这个脚本之后除了武器和盾的位置正常外,其他装备位置就定死了,无法作装备和卸下操作了。请问该如何解决?

  1. #1.main之前右键插入,全选RGSS代码后,粘贴即可.脚本名可自己取.

  2. #2.在属性栏中创建或者修改一个属性的名字,命名为“二刀流”.

  3. #3.在武器中,把可以用来装备双手武器的属性上,把二刀流打上勾.

  4. #4,在职业中,把可以双手装备武器的职业的属性有效度设为A.

  5. class Special_Element
  6. #--------------------------------------------------------------------------
  7. # ● 特殊な属性を定義する定数
  8. #--------------------------------------------------------------------------
  9. TWO_WEAPONS = "二刀流"

  10. #--------------------------------------------------------------------------
  11. # ● 特殊な属性をすべて取得
  12. #--------------------------------------------------------------------------
  13. def self.special_elements
  14. # 特殊な属性をすべて列挙
  15. elements = [
  16. TWO_WEAPONS
  17. ]
  18. return elements
  19. end

  20. #--------------------------------------------------------------------------
  21. # ● 属性名からその属性のIDを得る
  22. #--------------------------------------------------------------------------
  23. def self.get_index(name)
  24. return $data_system.elements.index(name)
  25. end

  26. #--------------------------------------------------------------------------
  27. # ● 正規表現にマッチするすべての属性のIDとマッチ情報を得る
  28. # 戻り値 : 二次元配列 [n][0]にID、[n][1]にマッチ情報(MatchData)
  29. #--------------------------------------------------------------------------
  30. def self.get_indices(regexp)
  31. indices = []
  32. for i in 1...$data_system.elements.size
  33. indices.push([i, $~]) if regexp =~ $data_system.elements[i]
  34. end
  35. end

  36. #--------------------------------------------------------------------------
  37. # ● 特殊な属性を取り除く
  38. # element_set : 取り除く前の属性IDの配列
  39. # ignore_elements : 取り除きたい属性 ID?名前?正規表現で指定可能
  40. # 戻り値 : 取り除いた結果の属性IDの配列
  41. #--------------------------------------------------------------------------
  42. def self.delete(element_set)
  43. result = element_set.dup
  44. for ignore in Special_Element::special_elements
  45. case ignore
  46. when Integer
  47. result.delete(ignore)
  48. when String
  49. result.delete(Special_Element::get_index(ignore))
  50. when Regexp
  51. for i in result
  52. result[i] = nil if ignore =~ $data_system.elements[result[i]]
  53. end
  54. result.delete(nil)
  55. end
  56. end
  57. return result
  58. end
  59. end





  60. class Game_Battler
  61. #--------------------------------------------------------------------------
  62. # ● 属性修正の計算
  63. # element_set : 属性
  64. #--------------------------------------------------------------------------
  65. def elements_correct(element_set)
  66. # --- ここから変更部分 ---
  67. element_set = Special_Element::delete(element_set)
  68. # --- 変更部分終わり ---
  69. # 無属性の場合
  70. if element_set == []
  71. # 100 を返す
  72. return 100
  73. end
  74. # 与えられた属性の中で最も弱いものを返す
  75. # ※メソッド element_rate は、このクラスから継承される Game_Actor
  76. # および Game_Enemy クラスで定義される
  77. weakest = -100
  78. for i in element_set
  79. weakest = [weakest, self.element_rate(i)].max
  80. end
  81. return weakest
  82. end
  83. end

  84. class Game_Actor < Game_Battler
  85. #--------------------------------------------------------------------------
  86. # ● 公開インスタンス変数
  87. #--------------------------------------------------------------------------
  88. attr_reader :name # 名前
  89. attr_reader :character_name # キャラクター ファイル名
  90. attr_reader :character_hue # キャラクター 色相
  91. attr_reader :class_id # クラス ID
  92. attr_reader :weapon_id # 武器 ID
  93. # --- ここから追加部分 ---
  94. attr_reader :weapon2_id # 二刀流武器 ID
  95. # --- 追加部分終わり ---
  96. attr_reader :armor1_id # 盾 ID
  97. attr_reader :armor2_id # 頭防具 ID
  98. attr_reader :armor3_id # 体防具 ID
  99. attr_reader :armor4_id # 装飾品 ID
  100. attr_reader :level # レベル
  101. attr_reader :exp # EXP
  102. attr_reader :skills # スキル

  103. #--------------------------------------------------------------------------
  104. # ● セットアップ
  105. # actor_id : アクター ID
  106. #--------------------------------------------------------------------------
  107. def setup(actor_id)
  108. actor = $data_actors[actor_id]
  109. @actor_id = actor_id
  110. @name = actor.name
  111. @character_name = actor.character_name
  112. @character_hue = actor.character_hue
  113. @battler_name = actor.battler_name
  114. @battler_hue = actor.battler_hue
  115. @class_id = actor.class_id
  116. @weapon_id = actor.weapon_id
  117. # --- ここから追加部分 ---
  118. @weapon2_id = 0
  119. # --- 追加部分終わり ---
  120. @armor1_id = actor.armor1_id
  121. @armor2_id = actor.armor2_id
  122. @armor3_id = actor.armor3_id
  123. @armor4_id = actor.armor4_id
  124. @level = actor.initial_level
  125. @exp_list = Array.new(101)
  126. make_exp_list
  127. @exp = @exp_list[@level]
  128. @skills = []
  129. @hp = maxhp
  130. @sp = maxsp
  131. @states = []
  132. @states_turn = {}
  133. @maxhp_plus = 0
  134. @maxsp_plus = 0
  135. @str_plus = 0
  136. @dex_plus = 0
  137. @agi_plus = 0
  138. @int_plus = 0
  139. # スキル習得
  140. for i in 1..@level
  141. for j in $data_classes[@class_id].learnings
  142. if j.level == i
  143. learn_skill(j.skill_id)
  144. end
  145. end
  146. end
  147. # オートステートを更新
  148. update_auto_state(nil, $data_armors[@armor1_id])
  149. update_auto_state(nil, $data_armors[@armor2_id])
  150. update_auto_state(nil, $data_armors[@armor3_id])
  151. update_auto_state(nil, $data_armors[@armor4_id])
  152. end

  153. #--------------------------------------------------------------------------
  154. # ● 通常攻撃の属性取得
  155. #--------------------------------------------------------------------------
  156. def element_set
  157. weapon = $data_weapons[@weapon_id]
  158. # --- ここから変更部分 ---
  159. weapon2 = $data_weapons[@weapon2_id]
  160. result = []
  161. result.concat(weapon.element_set) if weapon != nil
  162. result.concat(weapon2.element_set) if weapon2 != nil
  163. return result
  164. # --- 変更部分終わり ---
  165. end
  166. #--------------------------------------------------------------------------
  167. # ● 通常攻撃のステート変化 (+) 取得
  168. #--------------------------------------------------------------------------
  169. def plus_state_set
  170. weapon = $data_weapons[@weapon_id]
  171. # --- ここから変更部分 ---
  172. weapon2 = $data_weapons[@weapon2_id]
  173. result = []
  174. result.concat(weapon.plus_state_set) if weapon != nil
  175. result.concat(weapon2.plus_state_set) if weapon2 != nil
  176. return result
  177. # --- 変更部分終わり ---
  178. end
  179. #--------------------------------------------------------------------------
  180. # ● 通常攻撃のステート変化 (-) 取得
  181. #--------------------------------------------------------------------------
  182. def minus_state_set
  183. weapon = $data_weapons[@weapon_id]
  184. # --- ここから変更部分 ---
  185. weapon2 = $data_weapons[@weapon2_id]
  186. result = []
  187. result.concat(weapon.minus_state_set) if weapon != nil
  188. result.concat(weapon2.minus_state_set) if weapon2 != nil
  189. return result
  190. # --- 変更部分終わり ---
  191. end

  192. #--------------------------------------------------------------------------
  193. # ● 基本腕力の取得
  194. #--------------------------------------------------------------------------
  195. def base_str
  196. n = $data_actors[@actor_id].parameters[2, @level]
  197. weapon = $data_weapons[@weapon_id]
  198. armor1 = $data_armors[@armor1_id]
  199. armor2 = $data_armors[@armor2_id]
  200. armor3 = $data_armors[@armor3_id]
  201. armor4 = $data_armors[@armor4_id]
  202. # --- ここから追加部分 ---
  203. weapon2 = $data_weapons[@weapon2_id]
  204. # そのまま加算すると強すぎなので半分にしてみるテスト
  205. n += weapon2 != nil ? weapon2.str_plus / 2 : 0
  206. # --- 追加部分終わり ---
  207. n += weapon != nil ? weapon.str_plus : 0
  208. n += armor1 != nil ? armor1.str_plus : 0
  209. n += armor2 != nil ? armor2.str_plus : 0
  210. n += armor3 != nil ? armor3.str_plus : 0
  211. n += armor4 != nil ? armor4.str_plus : 0
  212. return [[n, 1].max, 999].min
  213. end

  214. #--------------------------------------------------------------------------
  215. # ● 基本器用さの取得
  216. #--------------------------------------------------------------------------
  217. def base_dex
  218. n = $data_actors[@actor_id].parameters[3, @level]
  219. weapon = $data_weapons[@weapon_id]
  220. armor1 = $data_armors[@armor1_id]
  221. armor2 = $data_armors[@armor2_id]
  222. armor3 = $data_armors[@armor3_id]
  223. armor4 = $data_armors[@armor4_id]
  224. # --- ここから追加部分 ---
  225. weapon2 = $data_weapons[@weapon2_id]
  226. # そのまま加算すると強すぎなので半分にしてみるテスト
  227. n += weapon2 != nil ? weapon2.dex_plus / 2 : 0
  228. # --- 追加部分終わり ---
  229. n += weapon != nil ? weapon.dex_plus : 0
  230. n += armor1 != nil ? armor1.dex_plus : 0
  231. n += armor2 != nil ? armor2.dex_plus : 0
  232. n += armor3 != nil ? armor3.dex_plus : 0
  233. n += armor4 != nil ? armor4.dex_plus : 0
  234. return [[n, 1].max, 999].min
  235. end

  236. #--------------------------------------------------------------------------
  237. # ● 基本素早さの取得
  238. #--------------------------------------------------------------------------
  239. def base_agi
  240. n = $data_actors[@actor_id].parameters[4, @level]
  241. weapon = $data_weapons[@weapon_id]
  242. armor1 = $data_armors[@armor1_id]
  243. armor2 = $data_armors[@armor2_id]
  244. armor3 = $data_armors[@armor3_id]
  245. armor4 = $data_armors[@armor4_id]
  246. # --- ここから追加部分 ---
  247. weapon2 = $data_weapons[@weapon2_id]
  248. # そのまま加算すると強すぎなので半分にしてみるテスト
  249. n += weapon2 != nil ? weapon2.agi_plus / 2 : 0
  250. # --- 追加部分終わり ---
  251. n += weapon != nil ? weapon.agi_plus : 0
  252. n += armor1 != nil ? armor1.agi_plus : 0
  253. n += armor2 != nil ? armor2.agi_plus : 0
  254. n += armor3 != nil ? armor3.agi_plus : 0
  255. n += armor4 != nil ? armor4.agi_plus : 0
  256. return [[n, 1].max, 999].min
  257. end

  258. #--------------------------------------------------------------------------
  259. # ● 基本魔力の取得
  260. #--------------------------------------------------------------------------
  261. def base_int
  262. n = $data_actors[@actor_id].parameters[5, @level]
  263. weapon = $data_weapons[@weapon_id]
  264. armor1 = $data_armors[@armor1_id]
  265. armor2 = $data_armors[@armor2_id]
  266. armor3 = $data_armors[@armor3_id]
  267. armor4 = $data_armors[@armor4_id]
  268. # --- ここから追加部分 ---
  269. weapon2 = $data_weapons[@weapon2_id]
  270. # そのまま加算すると強すぎなので半分にしてみるテスト
  271. n += weapon2 != nil ? weapon2.int_plus / 2 : 0
  272. # --- 追加部分終わり ---
  273. n += weapon != nil ? weapon.int_plus : 0
  274. n += armor1 != nil ? armor1.int_plus : 0
  275. n += armor2 != nil ? armor2.int_plus : 0
  276. n += armor3 != nil ? armor3.int_plus : 0
  277. n += armor4 != nil ? armor4.int_plus : 0
  278. return [[n, 1].max, 999].min
  279. end

  280. #--------------------------------------------------------------------------
  281. # ● 基本攻撃力の取得
  282. #--------------------------------------------------------------------------
  283. def base_atk
  284. weapon = $data_weapons[@weapon_id]
  285. # --- ここから変更部分 ---
  286. weapon2 = $data_weapons[@weapon2_id]
  287. # そのまま加算すると強すぎなので半分にしてみるテスト
  288. n = weapon2 != nil ? weapon2.atk / 2 : 0
  289. return weapon != nil ? weapon.atk + n : n
  290. # --- 変更部分終わり ---
  291. end

  292. #--------------------------------------------------------------------------
  293. # ● 基本物理防御の取得
  294. #--------------------------------------------------------------------------
  295. def base_pdef
  296. weapon = $data_weapons[@weapon_id]
  297. armor1 = $data_armors[@armor1_id]
  298. armor2 = $data_armors[@armor2_id]
  299. armor3 = $data_armors[@armor3_id]
  300. armor4 = $data_armors[@armor4_id]
  301. pdef1 = weapon != nil ? weapon.pdef : 0
  302. pdef2 = armor1 != nil ? armor1.pdef : 0
  303. pdef3 = armor2 != nil ? armor2.pdef : 0
  304. pdef4 = armor3 != nil ? armor3.pdef : 0
  305. pdef5 = armor4 != nil ? armor4.pdef : 0
  306. # --- ここから追加部分 ---
  307. weapon2 = $data_weapons[@weapon2_id]
  308. # そのまま加算すると強すぎなので半分にしてみるテスト
  309. pdef1 += weapon2 != nil ? weapon2.pdef / 2 : 0
  310. # --- 追加部分終わり ---
  311. return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
  312. end

  313. #--------------------------------------------------------------------------
  314. # ● 基本魔法防御の取得
  315. #--------------------------------------------------------------------------
  316. def base_mdef
  317. weapon = $data_weapons[@weapon_id]
  318. armor1 = $data_armors[@armor1_id]
  319. armor2 = $data_armors[@armor2_id]
  320. armor3 = $data_armors[@armor3_id]
  321. armor4 = $data_armors[@armor4_id]
  322. mdef1 = weapon != nil ? weapon.mdef : 0
  323. mdef2 = armor1 != nil ? armor1.mdef : 0
  324. mdef3 = armor2 != nil ? armor2.mdef : 0
  325. mdef4 = armor3 != nil ? armor3.mdef : 0
  326. mdef5 = armor4 != nil ? armor4.mdef : 0
  327. # --- ここから追加部分 ---
  328. weapon2 = $data_weapons[@weapon2_id]
  329. # そのまま加算すると強すぎなので半分にしてみるテスト
  330. mdef1 += weapon2 != nil ? weapon2.mdef / 2 : 0
  331. # --- 追加部分終わり ---
  332. return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
  333. end

  334. #--------------------------------------------------------------------------
  335. # ● 通常攻撃 攻撃側アニメーション ID の取得
  336. #--------------------------------------------------------------------------
  337. def animation1_id
  338. weapon = $data_weapons[@weapon_id]
  339. # --- ここから変更部分 ---
  340. weapon2 = $data_weapons[@weapon2_id]
  341. animations = []
  342. animations.push(weapon.animation1_id) if weapon != nil
  343. animations.push(weapon2.animation1_id) if weapon2 != nil
  344. animations.delete(0)
  345. return animations.empty? ? 0 : animations
  346. # --- 変更部分終わり ---
  347. end

  348. #--------------------------------------------------------------------------
  349. # ● 通常攻撃 対象側アニメーション ID の取得
  350. #--------------------------------------------------------------------------
  351. def animation2_id
  352. weapon = $data_weapons[@weapon_id]
  353. # --- ここから変更部分 ---
  354. weapon2 = $data_weapons[@weapon2_id]
  355. animations = []
  356. animations.push(weapon.animation2_id) if weapon != nil
  357. animations.push(weapon2.animation2_id) if weapon2 != nil
  358. animations.delete(0)
  359. return animations.empty? ? 0 : animations
  360. # --- 変更部分終わり ---
  361. end

  362. #--------------------------------------------------------------------------
  363. # ● 装備の変更
  364. # equip_type : 装備タイプ(変更点:-1なら二刀流の盾部分の武器)
  365. # id : 武器 or 防具 ID (0 なら装備解除)
  366. #--------------------------------------------------------------------------
  367. def equip(equip_type, id)
  368. case equip_type
  369. when 0 # 武器
  370. if id == 0 or $game_party.weapon_number(id) > 0
  371. $game_party.gain_weapon(@weapon_id, 1)
  372. @weapon_id = id
  373. $game_party.lose_weapon(id, 1)
  374. # --- ここから追加部分 ---
  375. # 二刀武器じゃないものを装備した場合、盾の部分の二刀武器を外す
  376. if id != 0 and !$data_weapons[id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  377. $game_party.gain_weapon(@weapon2_id, 1)
  378. @weapon2_id = 0
  379. end
  380. # --- 追加部分終わり ---
  381. end
  382. when 1 # 盾
  383. if id == 0 or $game_party.armor_number(id) > 0
  384. update_auto_state($data_armors[@armor1_id], $data_armors[id])
  385. $game_party.gain_armor(@armor1_id, 1)
  386. @armor1_id = id
  387. $game_party.lose_armor(id, 1)
  388. # --- ここから追加部分 ---
  389. # 二刀武器を装備していた場合は外す
  390. if id != 0
  391. $game_party.gain_weapon(@weapon2_id, 1)
  392. @weapon2_id = 0
  393. end
  394. # --- 追加部分終わり ---
  395. end
  396. when 2 # 頭
  397. if id == 0 or $game_party.armor_number(id) > 0
  398. update_auto_state($data_armors[@armor2_id], $data_armors[id])
  399. $game_party.gain_armor(@armor2_id, 1)
  400. @armor2_id = id
  401. $game_party.lose_armor(id, 1)
  402. end
  403. when 3 # 身体
  404. if id == 0 or $game_party.armor_number(id) > 0
  405. update_auto_state($data_armors[@armor3_id], $data_armors[id])
  406. $game_party.gain_armor(@armor3_id, 1)
  407. @armor3_id = id
  408. $game_party.lose_armor(id, 1)
  409. end
  410. when 4 # 装飾品
  411. if id == 0 or $game_party.armor_number(id) > 0
  412. update_auto_state($data_armors[@armor4_id], $data_armors[id])
  413. $game_party.gain_armor(@armor4_id, 1)
  414. @armor4_id = id
  415. $game_party.lose_armor(id, 1)
  416. end
  417. # --- ここから追加部分 ---
  418. when -1 # 二刀流の盾部分の武器
  419. if id == 0 or $game_party.weapon_number(id) > 0
  420. $game_party.gain_weapon(@weapon2_id, 1)
  421. @weapon2_id = id
  422. $game_party.lose_weapon(id, 1)
  423. # 盾を外す
  424. $game_party.gain_armor(@armor1_id, 1)
  425. @armor1_id = 0
  426. # 既に装備している武器が二刀武器じゃない場合は外す
  427. if id != 0 and @weapon_id != 0 and !$data_weapons[@weapon_id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  428. $game_party.gain_weapon(@weapon_id, 1)
  429. @weapon_id = 0
  430. end
  431. end
  432. # --- 追加部分終わり ---
  433. end
  434. end

  435. #--------------------------------------------------------------------------
  436. # ● 二刀流可能なアクターかどうか
  437. #--------------------------------------------------------------------------
  438. def can_two_weapons?
  439. return class_element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  440. end

  441. #--------------------------------------------------------------------------
  442. # ● アクターの所属クラスの属性がAのものを取得
  443. #--------------------------------------------------------------------------
  444. def class_element_set
  445. element_set = []
  446. for i in 1...$data_classes[@class_id].element_ranks.xsize
  447. element_set.push(i) if $data_classes[@class_id].element_ranks[i] == 1
  448. end
  449. return element_set
  450. end
  451. end





  452. class Window_EquipRight < Window_Selectable
  453. #--------------------------------------------------------------------------
  454. # ● リフレッシュ
  455. #--------------------------------------------------------------------------
  456. def refresh
  457. self.contents.clear
  458. @data = []
  459. @data.push($data_weapons[@actor.weapon_id])
  460. # --- ここから変更部分 ---
  461. @data.push(@actor.weapon2_id != 0 ? $data_weapons[@actor.weapon2_id] : $data_armors[@actor.armor1_id])
  462. # --- 変更部分終わり ---
  463. @data.push($data_armors[@actor.armor2_id])
  464. @data.push($data_armors[@actor.armor3_id])
  465. @data.push($data_armors[@actor.armor4_id])
  466. @item_max = @data.size
  467. self.contents.font.color = system_color
  468. self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  469. self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  470. self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  471. self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  472. self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
  473. draw_item_name(@data[0], 92, 32 * 0)
  474. draw_item_name(@data[1], 92, 32 * 1)
  475. draw_item_name(@data[2], 92, 32 * 2)
  476. draw_item_name(@data[3], 92, 32 * 3)
  477. draw_item_name(@data[4], 92, 32 * 4)
  478. end
  479. end





  480. class Window_EquipItem < Window_Selectable
  481. #--------------------------------------------------------------------------
  482. # ● リフレッシュ
  483. #--------------------------------------------------------------------------
  484. def refresh
  485. if self.contents != nil
  486. self.contents.dispose
  487. self.contents = nil
  488. end
  489. @data = []
  490. # 装備可能な武器を追加
  491. if @equip_type == 0
  492. weapon_set = $data_classes[@actor.class_id].weapon_set
  493. for i in 1...$data_weapons.size
  494. if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  495. @data.push($data_weapons[i])
  496. end
  497. end
  498. end
  499. # --- ここから追加部分 ---
  500. # 二刀流可能なアクターの場合は、盾に二刀武器も表示
  501. if @equip_type == 1 and @actor.can_two_weapons?
  502. weapon_set = $data_classes[@actor.class_id].weapon_set
  503. for i in 1...$data_weapons.size
  504. if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) and $data_weapons[i].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  505. @data.push($data_weapons[i])
  506. end
  507. end
  508. end
  509. # --- 追加部分終わり ---
  510. # 装備可能な防具を追加
  511. if @equip_type != 0
  512. armor_set = $data_classes[@actor.class_id].armor_set
  513. for i in 1...$data_armors.size
  514. if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  515. if $data_armors[i].kind == @equip_type-1
  516. @data.push($data_armors[i])
  517. end
  518. end
  519. end
  520. end
  521. # 空白を追加
  522. @data.push(nil)
  523. # ビットマップを作成し、全項目を描画
  524. @item_max = @data.size
  525. self.contents = Bitmap.new(width - 32, row_max * 32)
  526. for i in 0...@item_max-1
  527. draw_item(i)
  528. end
  529. end
  530. end





  531. class Scene_Equip
  532. #--------------------------------------------------------------------------
  533. # ● リフレッシュ
  534. #--------------------------------------------------------------------------
  535. def refresh
  536. # アイテムウィンドウの可視状態設定
  537. @item_window1.visible = (@right_window.index == 0)
  538. @item_window2.visible = (@right_window.index == 1)
  539. @item_window3.visible = (@right_window.index == 2)
  540. @item_window4.visible = (@right_window.index == 3)
  541. @item_window5.visible = (@right_window.index == 4)
  542. # 現在装備中のアイテムを取得
  543. item1 = @right_window.item
  544. # 現在のアイテムウィンドウを @item_window に設定
  545. case @right_window.index
  546. when 0
  547. @item_window = @item_window1
  548. when 1
  549. @item_window = @item_window2
  550. when 2
  551. @item_window = @item_window3
  552. when 3
  553. @item_window = @item_window4
  554. when 4
  555. @item_window = @item_window5
  556. end
  557. # ライトウィンドウがアクティブの場合
  558. if @right_window.active
  559. # 装備変更後のパラメータを消去
  560. @left_window.set_new_parameters(nil, nil, nil)
  561. end
  562. # アイテムウィンドウがアクティブの場合
  563. if @item_window.active
  564. # 現在選択中のアイテムを取得
  565. item2 = @item_window.item
  566. # 装備を変更
  567. last_hp = @actor.hp
  568. last_sp = @actor.sp
  569. # --- ここから変更部分 ---
  570. # 現在の装備を保存(装備の種類を増やしている場合はここを変更)
  571. equipments = [@actor.weapon2_id, @actor.weapon_id, @actor.armor1_id, @actor.armor2_id, @actor.armor3_id, @actor.armor4_id]
  572. @actor.equip(equip_type(@right_window.index, item2), item2 == nil ? 0 : item2.id)
  573. # --- 変更部分終わり ---
  574. # 装備変更後のパラメータを取得
  575. new_atk = @actor.atk
  576. new_pdef = @actor.pdef
  577. new_mdef = @actor.mdef
  578. # --- ここから変更部分 ---
  579. # 装備を戻す
  580. for i in 0...equipments.size
  581. @actor.equip(i - 1, equipments[i])
  582. end
  583. # --- 変更部分終わり ---
  584. @actor.hp = last_hp
  585. @actor.sp = last_sp
  586. # レフトウィンドウに描画
  587. @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
  588. end
  589. end

  590. #--------------------------------------------------------------------------
  591. # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
  592. #--------------------------------------------------------------------------
  593. def update_item
  594. # B ボタンが押された場合
  595. if Input.trigger?(Input::B)
  596. # キャンセル SE を演奏
  597. $game_system.se_play($data_system.cancel_se)
  598. # ライトウィンドウをアクティブ化
  599. @right_window.active = true
  600. @item_window.active = false
  601. @item_window.index = -1
  602. return
  603. end
  604. # C ボタンが押された場合
  605. if Input.trigger?(Input::C)
  606. # 装備 SE を演奏
  607. $game_system.se_play($data_system.equip_se)
  608. # アイテムウィンドウで現在選択されているデータを取得
  609. item = @item_window.item
  610. # --- ここから変更部分 ---
  611. # 装備を変更
  612. @actor.equip(equip_type(@right_window.index, item), item == nil ? 0 : item.id)
  613. # --- 変更部分終わり ---
  614. # ライトウィンドウをアクティブ化
  615. @right_window.active = true
  616. @item_window.active = false
  617. @item_window.index = -1
  618. # ライトウィンドウ、アイテムウィンドウの内容を再作成
  619. @right_window.refresh
  620. # --- ここから変更部分 ---
  621. # めんどくさいのですべてのウィンドウをリフレッシュ
  622. @item_window1.refresh
  623. @item_window2.refresh
  624. @item_window3.refresh
  625. @item_window4.refresh
  626. @item_window5.refresh
  627. # --- 変更部分終わり ---
  628. return
  629. end
  630. end

  631. # --- ここから追加部分 ---
  632. #--------------------------------------------------------------------------
  633. # ● 二刀流用の装備部位取得
  634. #--------------------------------------------------------------------------
  635. def equip_type(index, item)
  636. return index * (item.is_a?(RPG::Armor) ? 1 : -1)
  637. end
  638. # --- 追加部分終わり ---
  639. end





  640. class Scene_Battle
  641. #--------------------------------------------------------------------------
  642. # ● 基本アクション 結果作成
  643. #--------------------------------------------------------------------------
  644. def make_basic_action_result
  645. # 攻撃の場合
  646. if @active_battler.current_action.basic == 0
  647. # --- ここから変更部分 ---
  648. # アニメーション ID を設定
  649. @animation1_id = @active_battler.animation1_id.is_a?(Array) ? @active_battler.animation1_id.dup : @active_battler.animation1_id
  650. @animation2_id = @active_battler.animation2_id.is_a?(Array) ? @active_battler.animation2_id.dup : @active_battler.animation2_id
  651. # --- 変更部分終わり ---
  652. # 行動側バトラーがエネミーの場合
  653. if @active_battler.is_a?(Game_Enemy)
  654. if @active_battler.restriction == 3
  655. target = $game_troop.random_target_enemy
  656. elsif @active_battler.restriction == 2
  657. target = $game_party.random_target_actor
  658. else
  659. index = @active_battler.current_action.target_index
  660. target = $game_party.smooth_target_actor(index)
  661. end
  662. end
  663. # 行動側バトラーがアクターの場合
  664. if @active_battler.is_a?(Game_Actor)
  665. if @active_battler.restriction == 3
  666. target = $game_party.random_target_actor
  667. elsif @active_battler.restriction == 2
  668. target = $game_troop.random_target_enemy
  669. else
  670. index = @active_battler.current_action.target_index
  671. target = $game_troop.smooth_target_enemy(index)
  672. end
  673. end
  674. # 対象側バトラーの配列を設定
  675. @target_battlers = [target]
  676. # 通常攻撃の効果を適用
  677. for target in @target_battlers
  678. target.attack_effect(@active_battler)
  679. end
  680. return
  681. end
  682. # 防御の場合
  683. if @active_battler.current_action.basic == 1
  684. # ヘルプウィンドウに "防御" を表示
  685. @help_window.set_text($data_system.words.guard, 1)
  686. return
  687. end
  688. # 逃げるの場合
  689. if @active_battler.is_a?(Game_Enemy) and
  690. @active_battler.current_action.basic == 2
  691. # ヘルプウィンドウに "逃げる" を表示
  692. @help_window.set_text("逃げる", 1)
  693. # 逃げる
  694. @active_battler.escape
  695. return
  696. end
  697. # 何もしないの場合
  698. if @active_battler.current_action.basic == 3
  699. # アクション強制対象のバトラーをクリア
  700. $game_temp.forcing_battler = nil
  701. # ステップ 1 に移行
  702. @phase4_step = 1
  703. return
  704. end
  705. end

  706. #--------------------------------------------------------------------------
  707. # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  708. #--------------------------------------------------------------------------
  709. def update_phase4_step3
  710. # --- ここから変更部分 ---
  711. # アニメーションの配列の先頭を取り出す
  712. if @animation1_id.is_a?(Integer)
  713. @animation1_id = [@animation1_id]
  714. end
  715. animation = @animation1_id.shift
  716. # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
  717. if animation == 0
  718. @active_battler.white_flash = true
  719. else
  720. @active_battler.animation_id = animation
  721. @active_battler.animation_hit = true
  722. end
  723. # アニメーションがなくなったらステップ 4 に移行
  724. @phase4_step = 4 if @animation1_id.empty?
  725. # --- 変更部分終わり ---
  726. end

  727. #--------------------------------------------------------------------------
  728. # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  729. #--------------------------------------------------------------------------
  730. def update_phase4_step4
  731. # --- ここから変更部分 ---
  732. # アニメーションの配列の先頭を取り出す
  733. if @animation2_id.is_a?(Integer)
  734. @animation2_id = [@animation2_id]
  735. end
  736. animation = @animation2_id.shift
  737. # 対象側アニメーション
  738. for target in @target_battlers
  739. target.animation_id = animation
  740. target.animation_hit = (target.damage != "Miss")
  741. end
  742. # アニメーションの長さにかかわらず、最低 8 フレーム待つ
  743. @wait_count = 8
  744. # アニメーションがなくなったらステップ 5 に移行
  745. @phase4_step = 5 if @animation2_id.empty?
  746. # --- 変更部分終わり ---
  747. end
  748. end

复制代码

博客:我的博客
梦石
0
星屑
3181
在线时间
1439 小时
注册时间
2009-7-27
回帖
1187
 楼主| 发表于 2017-9-30 08:16:01 | 显示全部楼层
人都没移过来吗?

博客:我的博客
回复

使用道具 举报

遠航の猫咪

梦石
3
星屑
27057
在线时间
2428 小时
注册时间
2005-10-15
回帖
989

开拓者

发表于 2017-10-1 22:30:15 | 显示全部楼层
二刀流的脚本何其多,你偏要用冲突最大的一个
http://rpg.blue/thread-225786-1-1.html

点评

还有战斗动画没有两次动画,我是脚本小白……  发表于 2017-10-2 08:10
知道怎么用了,可是如何实现一开始就装备着双武器?还有就是盾位置武器的攻击力怎么调整?  发表于 2017-10-2 08:08
SailCat (小猫子·要开心一点) 共上站 24 次,发表过 11 篇文章 上 次 在: [2006年01月28日11:41:18 星期六] 从 [162.105.120.91] 到本站一游。
回复

使用道具 举报

梦石
0
星屑
3181
在线时间
1439 小时
注册时间
2009-7-27
回帖
1187
 楼主| 发表于 2017-10-4 23:30:27 | 显示全部楼层
没人帮我吗?

博客:我的博客
回复

使用道具 举报

梦石
0
星屑
3181
在线时间
1439 小时
注册时间
2009-7-27
回帖
1187
 楼主| 发表于 2017-10-7 09:11:23 | 显示全部楼层
都没人帮我吗?

博客:我的博客
回复

使用道具 举报

梦石
0
星屑
3181
在线时间
1439 小时
注册时间
2009-7-27
回帖
1187
 楼主| 发表于 2017-10-11 18:03:07 | 显示全部楼层
还是没人吗?

博客:我的博客
回复

使用道具 举报

梦石
0
星屑
19426
在线时间
3082 小时
注册时间
2013-1-11
回帖
1207
发表于 2017-10-11 21:04:31 | 显示全部楼层
本帖最后由 张咚咚 于 2017-10-12 00:09 编辑

这脚本622行很玄学啊。。意义不明
615行改成 index = equip_type(@right_window.index, item2);@actor.equip((index == -1 ? index : index.abs), item2 == nil ? 0 : item2.id)
622行改成 for i in 0...equipments.size - 3

点评

for i in 0...equipments.size - 3 这句话不对吧,你阉割掉了后面3个数组,虽然能卸载下来装备,但是光标选择物品栏装备的话,原始数据成了装备后的数据。  发表于 2019-11-14 23:08
不是那句,不过你提醒了我,已经找到了  发表于 2017-10-11 22:38
应该是222行吧  发表于 2017-10-11 22:29
谢谢,解决了我的难题,能否再告诉我一下,这个计算副手武器的攻击力是在哪一行?我有点找不到  发表于 2017-10-11 22:07

评分

参与人数 2星屑 +50 赞 +1 收起 理由
RyanBern + 50 认可答案
爆焰 + 1 认可答案

查看全部评分

回复 1 0

使用道具 举报

梦石
0
星屑
3181
在线时间
1439 小时
注册时间
2009-7-27
回帖
1187
 楼主| 发表于 2017-10-11 22:39:55 | 显示全部楼层
张咚咚 发表于 2017-10-11 21:04
这脚本622行很玄学啊。。意义不明
614行改成 @actor.equip(equip_type(@right_window.index, item2).abs, ( ...

请问这是怎么回事?我已经修改了原脚本的Window_EquipRight和Window_EquipItem,把副手武器的语句加进去的,可是就是不显示
11212121212.jpg

点评

谢谢,这个脚本问题结束了。爱你(づ ̄3 ̄)づ╭❤~  发表于 2017-10-12 00:08
上楼说的614行改成:index = equip_type(@right_window.index, item2);@actor.equip((index == -1 ? index : index.abs), item2 == nil ? 0 : item2.id)  发表于 2017-10-11 23:59
盾的位置装备武器,攻击力面板不显示攻击力变化。要装备上去才显示变化  发表于 2017-10-11 23:36
好像没理解你的意思,你要加副手武器什么语句  发表于 2017-10-11 23:22
能否帮我找一下原因?我找了好久也没找到  发表于 2017-10-11 22:59

博客:我的博客
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部