设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2344|回复: 19
打印 上一主题 下一主题

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

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
跳转到指定楼层
1
发表于 2017-9-28 00:10:23 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

RUBY 代码复制
  1. #1.main之前右键插入,全选RGSS代码后,粘贴即可.脚本名可自己取.
  2.  
  3. #2.在属性栏中创建或者修改一个属性的名字,命名为“二刀流”.
  4.  
  5. #3.在武器中,把可以用来装备双手武器的属性上,把二刀流打上勾.
  6.  
  7. #4,在职业中,把可以双手装备武器的职业的属性有效度设为A.
  8.  
  9. class Special_Element
  10. #--------------------------------------------------------------------------
  11. # ● 特殊な属性を定義する定数
  12. #--------------------------------------------------------------------------
  13. TWO_WEAPONS = "二刀流"
  14.  
  15. #--------------------------------------------------------------------------
  16. # ● 特殊な属性をすべて取得
  17. #--------------------------------------------------------------------------
  18. def self.special_elements
  19. # 特殊な属性をすべて列挙
  20. elements = [
  21. TWO_WEAPONS
  22. ]
  23. return elements
  24. end
  25.  
  26. #--------------------------------------------------------------------------
  27. # ● 属性名からその属性のIDを得る
  28. #--------------------------------------------------------------------------
  29. def self.get_index(name)
  30. return $data_system.elements.index(name)
  31. end
  32.  
  33. #--------------------------------------------------------------------------
  34. # ● 正規表現にマッチするすべての属性のIDとマッチ情報を得る
  35. # 戻り値 : 二次元配列 [n][0]にID、[n][1]にマッチ情報(MatchData)
  36. #--------------------------------------------------------------------------
  37. def self.get_indices(regexp)
  38. indices = []
  39. for i in 1...$data_system.elements.size
  40. indices.push([i, $~]) if regexp =~ $data_system.elements[i]
  41. end
  42. end
  43.  
  44. #--------------------------------------------------------------------------
  45. # ● 特殊な属性を取り除く
  46. # element_set : 取り除く前の属性IDの配列
  47. # ignore_elements : 取り除きたい属性 ID?名前?正規表現で指定可能
  48. # 戻り値 : 取り除いた結果の属性IDの配列
  49. #--------------------------------------------------------------------------
  50. def self.delete(element_set)
  51. result = element_set.dup
  52. for ignore in Special_Element::special_elements
  53. case ignore
  54. when Integer
  55. result.delete(ignore)
  56. when String
  57. result.delete(Special_Element::get_index(ignore))
  58. when Regexp
  59. for i in result
  60. result[i] = nil if ignore =~ $data_system.elements[result[i]]
  61. end
  62. result.delete(nil)
  63. end
  64. end
  65. return result
  66. end
  67. end
  68.  
  69.  
  70.  
  71.  
  72.  
  73. class Game_Battler
  74. #--------------------------------------------------------------------------
  75. # ● 属性修正の計算
  76. # element_set : 属性
  77. #--------------------------------------------------------------------------
  78. def elements_correct(element_set)
  79. # --- ここから変更部分 ---
  80. element_set = Special_Element::delete(element_set)
  81. # --- 変更部分終わり ---
  82. # 無属性の場合
  83. if element_set == []
  84. # 100 を返す
  85. return 100
  86. end
  87. # 与えられた属性の中で最も弱いものを返す
  88. # ※メソッド element_rate は、このクラスから継承される Game_Actor
  89. # および Game_Enemy クラスで定義される
  90. weakest = -100
  91. for i in element_set
  92. weakest = [weakest, self.element_rate(i)].max
  93. end
  94. return weakest
  95. end
  96. end
  97.  
  98. class Game_Actor < Game_Battler
  99. #--------------------------------------------------------------------------
  100. # ● 公開インスタンス変数
  101. #--------------------------------------------------------------------------
  102. attr_reader :name # 名前
  103. attr_reader :character_name # キャラクター ファイル名
  104. attr_reader :character_hue # キャラクター 色相
  105. attr_reader :class_id # クラス ID
  106. attr_reader :weapon_id # 武器 ID
  107. # --- ここから追加部分 ---
  108. attr_reader :weapon2_id # 二刀流武器 ID
  109. # --- 追加部分終わり ---
  110. attr_reader :armor1_id # 盾 ID
  111. attr_reader :armor2_id # 頭防具 ID
  112. attr_reader :armor3_id # 体防具 ID
  113. attr_reader :armor4_id # 装飾品 ID
  114. attr_reader :level # レベル
  115. attr_reader :exp # EXP
  116. attr_reader :skills # スキル
  117.  
  118. #--------------------------------------------------------------------------
  119. # ● セットアップ
  120. # actor_id : アクター ID
  121. #--------------------------------------------------------------------------
  122. def setup(actor_id)
  123. actor = $data_actors[actor_id]
  124. @actor_id = actor_id
  125. @name = actor.name
  126. @character_name = actor.character_name
  127. @character_hue = actor.character_hue
  128. @battler_name = actor.battler_name
  129. @battler_hue = actor.battler_hue
  130. @class_id = actor.class_id
  131. @weapon_id = actor.weapon_id
  132. # --- ここから追加部分 ---
  133. @weapon2_id = 0
  134. # --- 追加部分終わり ---
  135. @armor1_id = actor.armor1_id
  136. @armor2_id = actor.armor2_id
  137. @armor3_id = actor.armor3_id
  138. @armor4_id = actor.armor4_id
  139. @level = actor.initial_level
  140. @exp_list = Array.new(101)
  141. make_exp_list
  142. @exp = @exp_list[@level]
  143. @skills = []
  144. @hp = maxhp
  145. @sp = maxsp
  146. @states = []
  147. @states_turn = {}
  148. @maxhp_plus = 0
  149. @maxsp_plus = 0
  150. @str_plus = 0
  151. @dex_plus = 0
  152. @agi_plus = 0
  153. @int_plus = 0
  154. # スキル習得
  155. for i in 1..@level
  156. for j in $data_classes[@class_id].learnings
  157. if j.level == i
  158. learn_skill(j.skill_id)
  159. end
  160. end
  161. end
  162. # オートステートを更新
  163. update_auto_state(nil, $data_armors[@armor1_id])
  164. update_auto_state(nil, $data_armors[@armor2_id])
  165. update_auto_state(nil, $data_armors[@armor3_id])
  166. update_auto_state(nil, $data_armors[@armor4_id])
  167. end
  168.  
  169. #--------------------------------------------------------------------------
  170. # ● 通常攻撃の属性取得
  171. #--------------------------------------------------------------------------
  172. def element_set
  173. weapon = $data_weapons[@weapon_id]
  174. # --- ここから変更部分 ---
  175. weapon2 = $data_weapons[@weapon2_id]
  176. result = []
  177. result.concat(weapon.element_set) if weapon != nil
  178. result.concat(weapon2.element_set) if weapon2 != nil
  179. return result
  180. # --- 変更部分終わり ---
  181. end
  182. #--------------------------------------------------------------------------
  183. # ● 通常攻撃のステート変化 (+) 取得
  184. #--------------------------------------------------------------------------
  185. def plus_state_set
  186. weapon = $data_weapons[@weapon_id]
  187. # --- ここから変更部分 ---
  188. weapon2 = $data_weapons[@weapon2_id]
  189. result = []
  190. result.concat(weapon.plus_state_set) if weapon != nil
  191. result.concat(weapon2.plus_state_set) if weapon2 != nil
  192. return result
  193. # --- 変更部分終わり ---
  194. end
  195. #--------------------------------------------------------------------------
  196. # ● 通常攻撃のステート変化 (-) 取得
  197. #--------------------------------------------------------------------------
  198. def minus_state_set
  199. weapon = $data_weapons[@weapon_id]
  200. # --- ここから変更部分 ---
  201. weapon2 = $data_weapons[@weapon2_id]
  202. result = []
  203. result.concat(weapon.minus_state_set) if weapon != nil
  204. result.concat(weapon2.minus_state_set) if weapon2 != nil
  205. return result
  206. # --- 変更部分終わり ---
  207. end
  208.  
  209. #--------------------------------------------------------------------------
  210. # ● 基本腕力の取得
  211. #--------------------------------------------------------------------------
  212. def base_str
  213. n = $data_actors[@actor_id].parameters[2, @level]
  214. weapon = $data_weapons[@weapon_id]
  215. armor1 = $data_armors[@armor1_id]
  216. armor2 = $data_armors[@armor2_id]
  217. armor3 = $data_armors[@armor3_id]
  218. armor4 = $data_armors[@armor4_id]
  219. # --- ここから追加部分 ---
  220. weapon2 = $data_weapons[@weapon2_id]
  221. # そのまま加算すると強すぎなので半分にしてみるテスト
  222. n += weapon2 != nil ? weapon2.str_plus / 2 : 0
  223. # --- 追加部分終わり ---
  224. n += weapon != nil ? weapon.str_plus : 0
  225. n += armor1 != nil ? armor1.str_plus : 0
  226. n += armor2 != nil ? armor2.str_plus : 0
  227. n += armor3 != nil ? armor3.str_plus : 0
  228. n += armor4 != nil ? armor4.str_plus : 0
  229. return [[n, 1].max, 999].min
  230. end
  231.  
  232. #--------------------------------------------------------------------------
  233. # ● 基本器用さの取得
  234. #--------------------------------------------------------------------------
  235. def base_dex
  236. n = $data_actors[@actor_id].parameters[3, @level]
  237. weapon = $data_weapons[@weapon_id]
  238. armor1 = $data_armors[@armor1_id]
  239. armor2 = $data_armors[@armor2_id]
  240. armor3 = $data_armors[@armor3_id]
  241. armor4 = $data_armors[@armor4_id]
  242. # --- ここから追加部分 ---
  243. weapon2 = $data_weapons[@weapon2_id]
  244. # そのまま加算すると強すぎなので半分にしてみるテスト
  245. n += weapon2 != nil ? weapon2.dex_plus / 2 : 0
  246. # --- 追加部分終わり ---
  247. n += weapon != nil ? weapon.dex_plus : 0
  248. n += armor1 != nil ? armor1.dex_plus : 0
  249. n += armor2 != nil ? armor2.dex_plus : 0
  250. n += armor3 != nil ? armor3.dex_plus : 0
  251. n += armor4 != nil ? armor4.dex_plus : 0
  252. return [[n, 1].max, 999].min
  253. end
  254.  
  255. #--------------------------------------------------------------------------
  256. # ● 基本素早さの取得
  257. #--------------------------------------------------------------------------
  258. def base_agi
  259. n = $data_actors[@actor_id].parameters[4, @level]
  260. weapon = $data_weapons[@weapon_id]
  261. armor1 = $data_armors[@armor1_id]
  262. armor2 = $data_armors[@armor2_id]
  263. armor3 = $data_armors[@armor3_id]
  264. armor4 = $data_armors[@armor4_id]
  265. # --- ここから追加部分 ---
  266. weapon2 = $data_weapons[@weapon2_id]
  267. # そのまま加算すると強すぎなので半分にしてみるテスト
  268. n += weapon2 != nil ? weapon2.agi_plus / 2 : 0
  269. # --- 追加部分終わり ---
  270. n += weapon != nil ? weapon.agi_plus : 0
  271. n += armor1 != nil ? armor1.agi_plus : 0
  272. n += armor2 != nil ? armor2.agi_plus : 0
  273. n += armor3 != nil ? armor3.agi_plus : 0
  274. n += armor4 != nil ? armor4.agi_plus : 0
  275. return [[n, 1].max, 999].min
  276. end
  277.  
  278. #--------------------------------------------------------------------------
  279. # ● 基本魔力の取得
  280. #--------------------------------------------------------------------------
  281. def base_int
  282. n = $data_actors[@actor_id].parameters[5, @level]
  283. weapon = $data_weapons[@weapon_id]
  284. armor1 = $data_armors[@armor1_id]
  285. armor2 = $data_armors[@armor2_id]
  286. armor3 = $data_armors[@armor3_id]
  287. armor4 = $data_armors[@armor4_id]
  288. # --- ここから追加部分 ---
  289. weapon2 = $data_weapons[@weapon2_id]
  290. # そのまま加算すると強すぎなので半分にしてみるテスト
  291. n += weapon2 != nil ? weapon2.int_plus / 2 : 0
  292. # --- 追加部分終わり ---
  293. n += weapon != nil ? weapon.int_plus : 0
  294. n += armor1 != nil ? armor1.int_plus : 0
  295. n += armor2 != nil ? armor2.int_plus : 0
  296. n += armor3 != nil ? armor3.int_plus : 0
  297. n += armor4 != nil ? armor4.int_plus : 0
  298. return [[n, 1].max, 999].min
  299. end
  300.  
  301. #--------------------------------------------------------------------------
  302. # ● 基本攻撃力の取得
  303. #--------------------------------------------------------------------------
  304. def base_atk
  305. weapon = $data_weapons[@weapon_id]
  306. # --- ここから変更部分 ---
  307. weapon2 = $data_weapons[@weapon2_id]
  308. # そのまま加算すると強すぎなので半分にしてみるテスト
  309. n = weapon2 != nil ? weapon2.atk / 2 : 0
  310. return weapon != nil ? weapon.atk + n : n
  311. # --- 変更部分終わり ---
  312. end
  313.  
  314. #--------------------------------------------------------------------------
  315. # ● 基本物理防御の取得
  316. #--------------------------------------------------------------------------
  317. def base_pdef
  318. weapon = $data_weapons[@weapon_id]
  319. armor1 = $data_armors[@armor1_id]
  320. armor2 = $data_armors[@armor2_id]
  321. armor3 = $data_armors[@armor3_id]
  322. armor4 = $data_armors[@armor4_id]
  323. pdef1 = weapon != nil ? weapon.pdef : 0
  324. pdef2 = armor1 != nil ? armor1.pdef : 0
  325. pdef3 = armor2 != nil ? armor2.pdef : 0
  326. pdef4 = armor3 != nil ? armor3.pdef : 0
  327. pdef5 = armor4 != nil ? armor4.pdef : 0
  328. # --- ここから追加部分 ---
  329. weapon2 = $data_weapons[@weapon2_id]
  330. # そのまま加算すると強すぎなので半分にしてみるテスト
  331. pdef1 += weapon2 != nil ? weapon2.pdef / 2 : 0
  332. # --- 追加部分終わり ---
  333. return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
  334. end
  335.  
  336. #--------------------------------------------------------------------------
  337. # ● 基本魔法防御の取得
  338. #--------------------------------------------------------------------------
  339. def base_mdef
  340. weapon = $data_weapons[@weapon_id]
  341. armor1 = $data_armors[@armor1_id]
  342. armor2 = $data_armors[@armor2_id]
  343. armor3 = $data_armors[@armor3_id]
  344. armor4 = $data_armors[@armor4_id]
  345. mdef1 = weapon != nil ? weapon.mdef : 0
  346. mdef2 = armor1 != nil ? armor1.mdef : 0
  347. mdef3 = armor2 != nil ? armor2.mdef : 0
  348. mdef4 = armor3 != nil ? armor3.mdef : 0
  349. mdef5 = armor4 != nil ? armor4.mdef : 0
  350. # --- ここから追加部分 ---
  351. weapon2 = $data_weapons[@weapon2_id]
  352. # そのまま加算すると強すぎなので半分にしてみるテスト
  353. mdef1 += weapon2 != nil ? weapon2.mdef / 2 : 0
  354. # --- 追加部分終わり ---
  355. return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
  356. end
  357.  
  358. #--------------------------------------------------------------------------
  359. # ● 通常攻撃 攻撃側アニメーション ID の取得
  360. #--------------------------------------------------------------------------
  361. def animation1_id
  362. weapon = $data_weapons[@weapon_id]
  363. # --- ここから変更部分 ---
  364. weapon2 = $data_weapons[@weapon2_id]
  365. animations = []
  366. animations.push(weapon.animation1_id) if weapon != nil
  367. animations.push(weapon2.animation1_id) if weapon2 != nil
  368. animations.delete(0)
  369. return animations.empty? ? 0 : animations
  370. # --- 変更部分終わり ---
  371. end
  372.  
  373. #--------------------------------------------------------------------------
  374. # ● 通常攻撃 対象側アニメーション ID の取得
  375. #--------------------------------------------------------------------------
  376. def animation2_id
  377. weapon = $data_weapons[@weapon_id]
  378. # --- ここから変更部分 ---
  379. weapon2 = $data_weapons[@weapon2_id]
  380. animations = []
  381. animations.push(weapon.animation2_id) if weapon != nil
  382. animations.push(weapon2.animation2_id) if weapon2 != nil
  383. animations.delete(0)
  384. return animations.empty? ? 0 : animations
  385. # --- 変更部分終わり ---
  386. end
  387.  
  388. #--------------------------------------------------------------------------
  389. # ● 装備の変更
  390. # equip_type : 装備タイプ(変更点:-1なら二刀流の盾部分の武器)
  391. # id : 武器 or 防具 ID (0 なら装備解除)
  392. #--------------------------------------------------------------------------
  393. def equip(equip_type, id)
  394. case equip_type
  395. when 0 # 武器
  396. if id == 0 or $game_party.weapon_number(id) > 0
  397. $game_party.gain_weapon(@weapon_id, 1)
  398. @weapon_id = id
  399. $game_party.lose_weapon(id, 1)
  400. # --- ここから追加部分 ---
  401. # 二刀武器じゃないものを装備した場合、盾の部分の二刀武器を外す
  402. if id != 0 and !$data_weapons[id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  403. $game_party.gain_weapon(@weapon2_id, 1)
  404. @weapon2_id = 0
  405. end
  406. # --- 追加部分終わり ---
  407. end
  408. when 1 # 盾
  409. if id == 0 or $game_party.armor_number(id) > 0
  410. update_auto_state($data_armors[@armor1_id], $data_armors[id])
  411. $game_party.gain_armor(@armor1_id, 1)
  412. @armor1_id = id
  413. $game_party.lose_armor(id, 1)
  414. # --- ここから追加部分 ---
  415. # 二刀武器を装備していた場合は外す
  416. if id != 0
  417. $game_party.gain_weapon(@weapon2_id, 1)
  418. @weapon2_id = 0
  419. end
  420. # --- 追加部分終わり ---
  421. end
  422. when 2 # 頭
  423. if id == 0 or $game_party.armor_number(id) > 0
  424. update_auto_state($data_armors[@armor2_id], $data_armors[id])
  425. $game_party.gain_armor(@armor2_id, 1)
  426. @armor2_id = id
  427. $game_party.lose_armor(id, 1)
  428. end
  429. when 3 # 身体
  430. if id == 0 or $game_party.armor_number(id) > 0
  431. update_auto_state($data_armors[@armor3_id], $data_armors[id])
  432. $game_party.gain_armor(@armor3_id, 1)
  433. @armor3_id = id
  434. $game_party.lose_armor(id, 1)
  435. end
  436. when 4 # 装飾品
  437. if id == 0 or $game_party.armor_number(id) > 0
  438. update_auto_state($data_armors[@armor4_id], $data_armors[id])
  439. $game_party.gain_armor(@armor4_id, 1)
  440. @armor4_id = id
  441. $game_party.lose_armor(id, 1)
  442. end
  443. # --- ここから追加部分 ---
  444. when -1 # 二刀流の盾部分の武器
  445. if id == 0 or $game_party.weapon_number(id) > 0
  446. $game_party.gain_weapon(@weapon2_id, 1)
  447. @weapon2_id = id
  448. $game_party.lose_weapon(id, 1)
  449. # 盾を外す
  450. $game_party.gain_armor(@armor1_id, 1)
  451. @armor1_id = 0
  452. # 既に装備している武器が二刀武器じゃない場合は外す
  453. if id != 0 and @weapon_id != 0 and !$data_weapons[@weapon_id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  454. $game_party.gain_weapon(@weapon_id, 1)
  455. @weapon_id = 0
  456. end
  457. end
  458. # --- 追加部分終わり ---
  459. end
  460. end
  461.  
  462. #--------------------------------------------------------------------------
  463. # ● 二刀流可能なアクターかどうか
  464. #--------------------------------------------------------------------------
  465. def can_two_weapons?
  466. return class_element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  467. end
  468.  
  469. #--------------------------------------------------------------------------
  470. # ● アクターの所属クラスの属性がAのものを取得
  471. #--------------------------------------------------------------------------
  472. def class_element_set
  473. element_set = []
  474. for i in 1...$data_classes[@class_id].element_ranks.xsize
  475. element_set.push(i) if $data_classes[@class_id].element_ranks[i] == 1
  476. end
  477. return element_set
  478. end
  479. end
  480.  
  481.  
  482.  
  483.  
  484.  
  485. class Window_EquipRight < Window_Selectable
  486. #--------------------------------------------------------------------------
  487. # ● リフレッシュ
  488. #--------------------------------------------------------------------------
  489. def refresh
  490. self.contents.clear
  491. @data = []
  492. @data.push($data_weapons[@actor.weapon_id])
  493. # --- ここから変更部分 ---
  494. @data.push(@actor.weapon2_id != 0 ? $data_weapons[@actor.weapon2_id] : $data_armors[@actor.armor1_id])
  495. # --- 変更部分終わり ---
  496. @data.push($data_armors[@actor.armor2_id])
  497. @data.push($data_armors[@actor.armor3_id])
  498. @data.push($data_armors[@actor.armor4_id])
  499. @item_max = @data.size
  500. self.contents.font.color = system_color
  501. self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  502. self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  503. self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  504. self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  505. self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
  506. draw_item_name(@data[0], 92, 32 * 0)
  507. draw_item_name(@data[1], 92, 32 * 1)
  508. draw_item_name(@data[2], 92, 32 * 2)
  509. draw_item_name(@data[3], 92, 32 * 3)
  510. draw_item_name(@data[4], 92, 32 * 4)
  511. end
  512. end
  513.  
  514.  
  515.  
  516.  
  517.  
  518. class Window_EquipItem < Window_Selectable
  519. #--------------------------------------------------------------------------
  520. # ● リフレッシュ
  521. #--------------------------------------------------------------------------
  522. def refresh
  523. if self.contents != nil
  524. self.contents.dispose
  525. self.contents = nil
  526. end
  527. @data = []
  528. # 装備可能な武器を追加
  529. if @equip_type == 0
  530. weapon_set = $data_classes[@actor.class_id].weapon_set
  531. for i in 1...$data_weapons.size
  532. if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  533. @data.push($data_weapons[i])
  534. end
  535. end
  536. end
  537. # --- ここから追加部分 ---
  538. # 二刀流可能なアクターの場合は、盾に二刀武器も表示
  539. if @equip_type == 1 and @actor.can_two_weapons?
  540. weapon_set = $data_classes[@actor.class_id].weapon_set
  541. for i in 1...$data_weapons.size
  542. 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))
  543. @data.push($data_weapons[i])
  544. end
  545. end
  546. end
  547. # --- 追加部分終わり ---
  548. # 装備可能な防具を追加
  549. if @equip_type != 0
  550. armor_set = $data_classes[@actor.class_id].armor_set
  551. for i in 1...$data_armors.size
  552. if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  553. if $data_armors[i].kind == @equip_type-1
  554. @data.push($data_armors[i])
  555. end
  556. end
  557. end
  558. end
  559. # 空白を追加
  560. @data.push(nil)
  561. # ビットマップを作成し、全項目を描画
  562. @item_max = @data.size
  563. self.contents = Bitmap.new(width - 32, row_max * 32)
  564. for i in 0...@item_max-1
  565. draw_item(i)
  566. end
  567. end
  568. end
  569.  
  570.  
  571.  
  572.  
  573.  
  574. class Scene_Equip
  575. #--------------------------------------------------------------------------
  576. # ● リフレッシュ
  577. #--------------------------------------------------------------------------
  578. def refresh
  579. # アイテムウィンドウの可視状態設定
  580. @item_window1.visible = (@right_window.index == 0)
  581. @item_window2.visible = (@right_window.index == 1)
  582. @item_window3.visible = (@right_window.index == 2)
  583. @item_window4.visible = (@right_window.index == 3)
  584. @item_window5.visible = (@right_window.index == 4)
  585. # 現在装備中のアイテムを取得
  586. item1 = @right_window.item
  587. # 現在のアイテムウィンドウを @item_window に設定
  588. case @right_window.index
  589. when 0
  590. @item_window = @item_window1
  591. when 1
  592. @item_window = @item_window2
  593. when 2
  594. @item_window = @item_window3
  595. when 3
  596. @item_window = @item_window4
  597. when 4
  598. @item_window = @item_window5
  599. end
  600. # ライトウィンドウがアクティブの場合
  601. if @right_window.active
  602. # 装備変更後のパラメータを消去
  603. @left_window.set_new_parameters(nil, nil, nil)
  604. end
  605. # アイテムウィンドウがアクティブの場合
  606. if @item_window.active
  607. # 現在選択中のアイテムを取得
  608. item2 = @item_window.item
  609. # 装備を変更
  610. last_hp = @actor.hp
  611. last_sp = @actor.sp
  612. # --- ここから変更部分 ---
  613. # 現在の装備を保存(装備の種類を増やしている場合はここを変更)
  614. equipments = [@actor.weapon2_id, @actor.weapon_id, @actor.armor1_id, @actor.armor2_id, @actor.armor3_id, @actor.armor4_id]
  615. @actor.equip(equip_type(@right_window.index, item2), item2 == nil ? 0 : item2.id)
  616. # --- 変更部分終わり ---
  617. # 装備変更後のパラメータを取得
  618. new_atk = @actor.atk
  619. new_pdef = @actor.pdef
  620. new_mdef = @actor.mdef
  621. # --- ここから変更部分 ---
  622. # 装備を戻す
  623. for i in 0...equipments.size
  624. @actor.equip(i - 1, equipments[i])
  625. end
  626. # --- 変更部分終わり ---
  627. @actor.hp = last_hp
  628. @actor.sp = last_sp
  629. # レフトウィンドウに描画
  630. @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
  631. end
  632. end
  633.  
  634. #--------------------------------------------------------------------------
  635. # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
  636. #--------------------------------------------------------------------------
  637. def update_item
  638. # B ボタンが押された場合
  639. if Input.trigger?(Input::B)
  640. # キャンセル SE を演奏
  641. $game_system.se_play($data_system.cancel_se)
  642. # ライトウィンドウをアクティブ化
  643. @right_window.active = true
  644. @item_window.active = false
  645. @item_window.index = -1
  646. return
  647. end
  648. # C ボタンが押された場合
  649. if Input.trigger?(Input::C)
  650. # 装備 SE を演奏
  651. $game_system.se_play($data_system.equip_se)
  652. # アイテムウィンドウで現在選択されているデータを取得
  653. item = @item_window.item
  654. # --- ここから変更部分 ---
  655. # 装備を変更
  656. @actor.equip(equip_type(@right_window.index, item), item == nil ? 0 : item.id)
  657. # --- 変更部分終わり ---
  658. # ライトウィンドウをアクティブ化
  659. @right_window.active = true
  660. @item_window.active = false
  661. @item_window.index = -1
  662. # ライトウィンドウ、アイテムウィンドウの内容を再作成
  663. @right_window.refresh
  664. # --- ここから変更部分 ---
  665. # めんどくさいのですべてのウィンドウをリフレッシュ
  666. @item_window1.refresh
  667. @item_window2.refresh
  668. @item_window3.refresh
  669. @item_window4.refresh
  670. @item_window5.refresh
  671. # --- 変更部分終わり ---
  672. return
  673. end
  674. end
  675.  
  676. # --- ここから追加部分 ---
  677. #--------------------------------------------------------------------------
  678. # ● 二刀流用の装備部位取得
  679. #--------------------------------------------------------------------------
  680. def equip_type(index, item)
  681. return index * (item.is_a?(RPG::Armor) ? 1 : -1)
  682. end
  683. # --- 追加部分終わり ---
  684. end
  685.  
  686.  
  687.  
  688.  
  689.  
  690. class Scene_Battle
  691. #--------------------------------------------------------------------------
  692. # ● 基本アクション 結果作成
  693. #--------------------------------------------------------------------------
  694. def make_basic_action_result
  695. # 攻撃の場合
  696. if @active_battler.current_action.basic == 0
  697. # --- ここから変更部分 ---
  698. # アニメーション ID を設定
  699. @animation1_id = @active_battler.animation1_id.is_a?(Array) ? @active_battler.animation1_id.dup : @active_battler.animation1_id
  700. @animation2_id = @active_battler.animation2_id.is_a?(Array) ? @active_battler.animation2_id.dup : @active_battler.animation2_id
  701. # --- 変更部分終わり ---
  702. # 行動側バトラーがエネミーの場合
  703. if @active_battler.is_a?(Game_Enemy)
  704. if @active_battler.restriction == 3
  705. target = $game_troop.random_target_enemy
  706. elsif @active_battler.restriction == 2
  707. target = $game_party.random_target_actor
  708. else
  709. index = @active_battler.current_action.target_index
  710. target = $game_party.smooth_target_actor(index)
  711. end
  712. end
  713. # 行動側バトラーがアクターの場合
  714. if @active_battler.is_a?(Game_Actor)
  715. if @active_battler.restriction == 3
  716. target = $game_party.random_target_actor
  717. elsif @active_battler.restriction == 2
  718. target = $game_troop.random_target_enemy
  719. else
  720. index = @active_battler.current_action.target_index
  721. target = $game_troop.smooth_target_enemy(index)
  722. end
  723. end
  724. # 対象側バトラーの配列を設定
  725. @target_battlers = [target]
  726. # 通常攻撃の効果を適用
  727. for target in @target_battlers
  728. target.attack_effect(@active_battler)
  729. end
  730. return
  731. end
  732. # 防御の場合
  733. if @active_battler.current_action.basic == 1
  734. # ヘルプウィンドウに "防御" を表示
  735. @help_window.set_text($data_system.words.guard, 1)
  736. return
  737. end
  738. # 逃げるの場合
  739. if @active_battler.is_a?(Game_Enemy) and
  740. @active_battler.current_action.basic == 2
  741. # ヘルプウィンドウに "逃げる" を表示
  742. @help_window.set_text("逃げる", 1)
  743. # 逃げる
  744. @active_battler.escape
  745. return
  746. end
  747. # 何もしないの場合
  748. if @active_battler.current_action.basic == 3
  749. # アクション強制対象のバトラーをクリア
  750. $game_temp.forcing_battler = nil
  751. # ステップ 1 に移行
  752. @phase4_step = 1
  753. return
  754. end
  755. end
  756.  
  757. #--------------------------------------------------------------------------
  758. # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  759. #--------------------------------------------------------------------------
  760. def update_phase4_step3
  761. # --- ここから変更部分 ---
  762. # アニメーションの配列の先頭を取り出す
  763. if @animation1_id.is_a?(Integer)
  764. @animation1_id = [@animation1_id]
  765. end
  766. animation = @animation1_id.shift
  767. # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
  768. if animation == 0
  769. @active_battler.white_flash = true
  770. else
  771. @active_battler.animation_id = animation
  772. @active_battler.animation_hit = true
  773. end
  774. # アニメーションがなくなったらステップ 4 に移行
  775. @phase4_step = 4 if @animation1_id.empty?
  776. # --- 変更部分終わり ---
  777. end
  778.  
  779. #--------------------------------------------------------------------------
  780. # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  781. #--------------------------------------------------------------------------
  782. def update_phase4_step4
  783. # --- ここから変更部分 ---
  784. # アニメーションの配列の先頭を取り出す
  785. if @animation2_id.is_a?(Integer)
  786. @animation2_id = [@animation2_id]
  787. end
  788. animation = @animation2_id.shift
  789. # 対象側アニメーション
  790. for target in @target_battlers
  791. target.animation_id = animation
  792. target.animation_hit = (target.damage != "Miss")
  793. end
  794. # アニメーションの長さにかかわらず、最低 8 フレーム待つ
  795. @wait_count = 8
  796. # アニメーションがなくなったらステップ 5 に移行
  797. @phase4_step = 5 if @animation2_id.empty?
  798. # --- 変更部分終わり ---
  799. end
  800. end

博客:我的博客

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
2
 楼主| 发表于 2017-9-30 08:16:01 | 只看该作者
人都没移过来吗?

博客:我的博客
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (版主)

遠航の猫咪

梦石
3
星屑
23109
在线时间
2386 小时
注册时间
2005-10-15
帖子
1166

开拓者

3
发表于 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] 到本站一游。
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
4
 楼主| 发表于 2017-10-4 23:30:27 | 只看该作者
没人帮我吗?

博客:我的博客
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
5
 楼主| 发表于 2017-10-7 09:11:23 | 只看该作者
都没人帮我吗?

博客:我的博客
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
6
 楼主| 发表于 2017-10-11 18:03:07 | 只看该作者
还是没人吗?

博客:我的博客
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
19334
在线时间
3077 小时
注册时间
2013-1-11
帖子
1288
7
发表于 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

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
8
 楼主| 发表于 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,把副手武器的语句加进去的,可是就是不显示


点评

谢谢,这个脚本问题结束了。爱你(づ ̄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

博客:我的博客
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-20 05:52

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表