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

Project1

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

[已经解决] 急需炼药脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
85 小时
注册时间
2012-8-9
帖子
102
跳转到指定楼层
1
发表于 2013-7-24 09:30:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
斗破大家看过没?就是斗破里的炼药!


每练一次药提升1级,时间为一分钟!!练的药可以吃了加MP\HP!!

不要使用起来太困难的脚本!!!!!!跪求啊!!!!!
药鼎在背包中打开药鼎可以选择炼药啊!


跪求!各位大神!谢谢啦!!!!!!{:2_279:}
《烈火契约》工作室招收美工,有意者进Q群:248202504

Lv2.观梦者

会吐槽的画师

梦石
0
星屑
782
在线时间
3431 小时
注册时间
2011-6-10
帖子
6535
来自 2楼
发表于 2013-7-24 11:39:40 | 只看该作者
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/ ◆ 物品合成 - KGC_ComposeItem ◆ VX ◆
  3. #_/ ◇ Last update : 2008/01/25 ◇
  4. #_/----------------------------------------------------------------------------
  5. #_/ 可制作合成物品。
  6. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  7. #==============================================================================
  8. # ★ 定做項目 - Customize ★
  9. #==============================================================================
  10. module KGC
  11. module ComposeItem
  12. # ◆ 将合成画面调用的开关号码
  13. # 把这个开关设定为 ON 的话,可代替通常的店铺并使用合成功能。
  14. COMPOSE_CALL_SWITCH = 13
  15. # ◆ 合成物素材设定,通常格式:
  16. # ?费用,"物品类型:ID,个数",... ?
  17. # 【 费用 】合成物品所需的费用
  18. # 【 物品种类 】合成素材的种类 (I..物品 W..武器 A..防具)
  19. # 【 ID 】合成素材的ID (↑要与以上相对应)
  20. # 【 个数 】合成物品所需素材的数目
  21. # "物品种类:ID,個数" 。多个的时候也可以这样设定。
  22. # 可省略数目。写成 "物品类型:ID" 。如果没写的话,将用默认设定个数为1。
  23. # 如果把个数设定为0的话,持有1个以上时也可以合成,但是合成成功的话,将
  24. #不会扣除所设定的物品。
  25. # 按一下设定的排列,添加的顺序与物品?武器?防具的ID相对应。
  26. RECIPE_ITEM = [] # 物品
  27. RECIPE_WEAPON = [] # 武器
  28. RECIPE_ARMOR = [] # 防具
  29. # 从这里开始,自定义合成公式(找不到好的词)。
  30. # <例如>
  31. # 物品ID为8的合成公式
  32. # 物品ID 2, 4, 7 各消耗1个,免费合成。
  33. RECIPE_ITEM[8] = [0, "I:2", "I:4", "I:7"]
  34. # 武器ID:16 的合成公式
  35. # 武器ID:10 消耗1个、物品ID:16 消耗 2 个,合成费用800 G。
  36. RECIPE_WEAPON[16] = [800, "W:10", "I:16,2"]
  37. RECIPE_WEAPON[1] = [0,"I:1,2"]
  38. # ◆ 合成指令名
  39. # 可替代普通商店的购买指令。
  40. # ※ 想要修改指令名字的话,可在下面的[Vocab]后做修改。
  41. VOCAB_COMPOSE_ITEM = "合成"
  42. # ◆ 合成物品的信息转换按键
  43. # 「所需材料 <=转换=> 角色能力值変化(为装备品时)」信息变换按键。
  44. # 不使用的时候,请设定成 nil。
  45. SWITCH_INFO_BUTTON = Input::X
  46. # ◆ 必要设定
  47. # 当合成的材料为较多数时,请设定成 true。(其实就是合成素材的行距与字的大小)
  48. COMPACT_MATERIAL_LIST = true
  49. # ◆ 不显示命令窗口。
  50. # 这与XP是相似的。
  51. HIDE_COMMAND_WINDOW = true
  52. # ◆ 不显示所持金钱数
  53. HIDE_GOLD_WINDOW = false
  54. # ◆ 当合成费用是0时, 不显示费用。
  55. HIDE_ZERO_COST = true
  56. # ◆ 不表示费用与素材不足的合成列表。
  57. # 之前合成过的物品的显名表示。
  58. HIDE_SHORTAGE_RECIPE = false
  59. # ◆ 没有合成的物品隐藏物品名字, true为隐藏。
  60. MASK_UNKNOWN_RECIPE_NAME = true
  61. # ◆ 没有合成过的物品在列表上的表示方法
  62. # 以下设定隐藏名,当物品名字为多个时,按以下设定扩展名字。
  63. UNKNOWN_NAME_MASK = "?"
  64. # ◆ 没有合成过的物品,隐藏帮助信息。
  65. HIDE_UNKNOWN_RECIPE_HELP = true
  66. # ◆ 没有合成过在物品在列表上的帮助 信息。
  67. UNKNOWN_RECIPE_HELP = "合成列表"
  68. end
  69. end
  70. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  71. $imported = {} if $imported == nil
  72. $imported["ComposeItem"] = true
  73. module KGC::ComposeItem
  74. # 定义正则表达式
  75. module Regexp
  76. # 合成列表
  77. RECIPE = /([IWA])[ ]*:[ ]*(\d+)([ ]*,[ ]*\d+)?/i
  78. end
  79. end
  80. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  81. #==============================================================================
  82. # ■ Vocab
  83. #==============================================================================
  84. module Vocab
  85. # 合成画面
  86. ComposeItem = KGC::ComposeItem::VOCAB_COMPOSE_ITEM
  87. end
  88. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  89. #==============================================================================
  90. # ■ RPG::BaseItem
  91. #==============================================================================
  92. class RPG::BaseItem
  93. #--------------------------------------------------------------------------
  94. # ○ 变量
  95. #--------------------------------------------------------------------------
  96. @@__masked_name =
  97. KGC::ComposeItem::UNKNOWN_NAME_MASK # 隐藏名
  98. @@__expand_masked_name = false # 隐藏名的扩展表示
  99. if @@__masked_name != nil
  100. @@__expand_masked_name = (@@__masked_name.scan(/./).size == 1)
  101. end
  102. #--------------------------------------------------------------------------
  103. # ○ 物品合成费用
  104. #--------------------------------------------------------------------------
  105. def create_compose_item_cache
  106. @__compose_cost = 0
  107. @__compose_materials = []
  108. # 合成列表取得
  109. recipe = nil
  110. case self
  111. when RPG::Item # 物品
  112. recipe = KGC::ComposeItem::RECIPE_ITEM[self.id]
  113. when RPG::Weapon # 武器
  114. recipe = KGC::ComposeItem::RECIPE_WEAPON[self.id]
  115. when RPG::Armor # 防具
  116. recipe = KGC::ComposeItem::RECIPE_ARMOR[self.id]
  117. end
  118. return if recipe == nil
  119. recipe = recipe.dup
  120. @__compose_cost = recipe.shift
  121. # 合成材料名单
  122. recipe.each { |r|
  123. if r =~ KGC::ComposeItem::Regexp::RECIPE
  124. material = Game_ComposeMaterial.new
  125. material.kind = $1.upcase # 取得材料的种类
  126. material.id = $2.to_i # 取得材料的ID
  127. if $3 != nil
  128. material.number = [$3[/\d+/].to_i, 0].max # 取得必要合成个数
  129. end
  130. @__compose_materials << material
  131. end
  132. }
  133. end
  134. #--------------------------------------------------------------------------
  135. # ○ 隐藏名
  136. #--------------------------------------------------------------------------
  137. def masked_name
  138. if KGC::ComposeItem::MASK_UNKNOWN_RECIPE_NAME
  139. if @@__expand_masked_name
  140. # 隐藏名的扩展表示
  141. return @@__masked_name * self.name.scan(/./).size
  142. else
  143. return @@__masked_name
  144. end
  145. else
  146. return self.name
  147. end
  148. end
  149. #--------------------------------------------------------------------------
  150. # ○ 合成费用
  151. #--------------------------------------------------------------------------
  152. def compose_cost
  153. create_compose_item_cache if @__compose_cost == nil
  154. return @__compose_cost
  155. end
  156. #--------------------------------------------------------------------------
  157. # ○ 合成用材料名单
  158. #--------------------------------------------------------------------------
  159. def compose_materials
  160. create_compose_item_cache if @__compose_materials == nil
  161. return @__compose_materials
  162. end
  163. #--------------------------------------------------------------------------
  164. # ○ 合成列表
  165. #--------------------------------------------------------------------------
  166. def is_compose?
  167. return !compose_materials.empty?
  168. end
  169. end
  170. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  171. #==============================================================================
  172. # ■ Game_Party
  173. #==============================================================================
  174. class Game_Party < Game_Unit
  175. #--------------------------------------------------------------------------
  176. # ○ 合成済みフラグをクリア
  177. #--------------------------------------------------------------------------
  178. def clear_composed_flag
  179. @item_composed = {}
  180. @weapon_composed = {}
  181. @armor_composed = {}
  182. end
  183. #--------------------------------------------------------------------------
  184. # ○ アイテムの合成済みフラグを設定
  185. # item : アイテム
  186. # flag : true..合成済み false..未合成
  187. #--------------------------------------------------------------------------
  188. def set_item_composed(item, flag = true)
  189. return false unless item.is_a?(RPG::BaseItem) # アイテム以外
  190. return false unless item.is_compose? # 合成アイテム以外
  191. # 合成済みフラグを格納するハッシュを作成
  192. clear_composed_flag if @item_composed == nil
  193. # 合成済みフラグをセット
  194. case item
  195. when RPG::Item # アイテム
  196. @item_composed[item.id] = flag
  197. when RPG::Weapon # 武器
  198. @weapon_composed[item.id] = flag
  199. when RPG::Armor # 防具
  200. @armor_composed[item.id] = flag
  201. end
  202. end
  203. #--------------------------------------------------------------------------
  204. # ○ アイテムの合成済み判定
  205. # item : アイテム
  206. #--------------------------------------------------------------------------
  207. def item_composed?(item)
  208. return false unless item.is_a?(RPG::BaseItem) # アイテム以外
  209. return false unless item.is_compose? # 合成アイテム以外
  210. # 合成済みフラグを格納するハッシュを作成
  211. clear_composed_flag if @item_composed == nil
  212. # 合成済み判定
  213. case item
  214. when RPG::Item # アイテム
  215. return @item_composed[item.id]
  216. when RPG::Weapon # 武器
  217. return @weapon_composed[item.id]
  218. when RPG::Armor # 防具
  219. return @armor_composed[item.id]
  220. end
  221. return false
  222. end
  223. #--------------------------------------------------------------------------
  224. # ○ アイテムの合成可能判定
  225. # item : アイテム
  226. #--------------------------------------------------------------------------
  227. def item_can_compose?(item)
  228. return false unless item.is_a?(RPG::BaseItem) # アイテム以外は不可
  229. return false unless item.is_compose? # 合成アイテム以外は不可
  230. return false if gold < item.compose_cost # 資金不足なら不可
  231. item.compose_materials.each { |material|
  232. num = item_number(material.item)
  233. # 素材不足なら不可
  234. return false if num < material.number || num == 0
  235. }
  236. return true
  237. end
  238. #--------------------------------------------------------------------------
  239. # ○ アイテムの合成可能数を取得
  240. # item : アイテム
  241. #--------------------------------------------------------------------------
  242. def number_of_composable(item)
  243. return 0 unless item.is_a?(RPG::BaseItem) # アイテム以外
  244. return 0 unless item.is_compose? # 合成アイテム以外
  245. number = ($imported["LimitBreak"] ? item.number_limit : 99)
  246. if item.compose_cost > 0
  247. number = [number, gold / item.compose_cost].min
  248. end
  249. # 素材数判定
  250. item.compose_materials.each { |material|
  251. next if material.number == 0 # 必要数 0 は無視
  252. n = item_number(material.item) / material.number
  253. number = [number, n].min
  254. }
  255. return number
  256. end
  257. end
  258. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  259. #==============================================================================
  260. # □ Game_ComposeMaterial
  261. #------------------------------------------------------------------------------
  262. # 合成素材の情報を格納するクラスです。
  263. #==============================================================================
  264. class Game_ComposeMaterial
  265. #--------------------------------------------------------------------------
  266. # ○ 公開インスタンス変数
  267. #--------------------------------------------------------------------------
  268. attr_accessor :kind # アイテムの種類 (/[IWA]/)
  269. attr_accessor :id # アイテムの ID
  270. attr_accessor :number # 必要数
  271. #--------------------------------------------------------------------------
  272. # ○ オブジェクト初期化
  273. #--------------------------------------------------------------------------
  274. def initialize
  275. @kind = "I"
  276. @id = 0
  277. [url=home.php?mod=space&uid=27178]@Number[/url] = 1
  278. end
  279. #--------------------------------------------------------------------------
  280. # ○ アイテム取得
  281. #--------------------------------------------------------------------------
  282. def item
  283. case @kind
  284. when "I" # アイテム
  285. return $data_items[@id]
  286. when "W" # 武器
  287. return $data_weapons[@id]
  288. when "A" # 防具
  289. return $data_armors[@id]
  290. else
  291. return nil
  292. end
  293. end
  294. end
  295. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  296. #==============================================================================
  297. # ■ Window_Base
  298. #==============================================================================
  299. class Window_Base < Window
  300. #--------------------------------------------------------------------------
  301. # ○ 合成アイテム名の描画
  302. # item : アイテム (スキル、武器、防具でも可)
  303. # x : 描画先 X 座標
  304. # y : 描画先 Y 座標
  305. # enabled : 有効フラグ。false のとき半透明で描画
  306. #--------------------------------------------------------------------------
  307. def draw_compose_item_name(item, x, y, enabled = true)
  308. return if item == nil
  309. draw_icon(item.icon_index, x, y, enabled)
  310. self.contents.font.color = normal_color
  311. self.contents.font.color.alpha = enabled ? 255 : 128
  312. self.contents.draw_text(x + 24, y, 172, WLH,
  313. $game_party.item_composed?(item) ? item.name : item.masked_name)
  314. end
  315. end
  316. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  317. #==============================================================================
  318. # □ Window_ComposeNumber
  319. #------------------------------------------------------------------------------
  320. # 合成画面で、合成するアイテムの個数を入力するウィンドウです。
  321. #==============================================================================
  322. class Window_ComposeNumber < Window_ShopNumber
  323. #--------------------------------------------------------------------------
  324. # ● リフレッシュ
  325. #--------------------------------------------------------------------------
  326. def refresh
  327. y = 96
  328. self.contents.clear
  329. draw_compose_item_name(@item, 0, y)
  330. self.contents.font.color = normal_color
  331. self.contents.draw_text(212, y, 20, WLH, "×")
  332. self.contents.draw_text(248, y, 20, WLH, @number, 2)
  333. self.cursor_rect.set(244, y, 28, WLH)
  334. if !KGC::ComposeItem::HIDE_ZERO_COST || @price > 0
  335. draw_currency_value(@price * @number, 4, y + WLH * 2, 264)
  336. end
  337. end
  338. end
  339. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  340. #==============================================================================
  341. # □ Window_ComposeItem
  342. #------------------------------------------------------------------------------
  343. # 合成画面で、合成できる商品の一覧を表示するウィンドウです。
  344. #==============================================================================
  345. class Window_ComposeItem < Window_ShopBuy
  346. #--------------------------------------------------------------------------
  347. # ● リフレッシュ
  348. #--------------------------------------------------------------------------
  349. def refresh
  350. @data = []
  351. for goods_item in @shop_goods
  352. case goods_item[0]
  353. when 0
  354. item = $data_items[goods_item[1]]
  355. when 1
  356. item = $data_weapons[goods_item[1]]
  357. when 2
  358. item = $data_armors[goods_item[1]]
  359. end
  360. # 合成アイテムのみ追加
  361. @data.push(item) if include?(item)
  362. end
  363. @item_max = @data.size
  364. create_contents
  365. for i in 0...@item_max
  366. draw_item(i)
  367. end
  368. end
  369. #--------------------------------------------------------------------------
  370. # ○ アイテムをリストに含めるかどうか
  371. # item : アイテム
  372. #--------------------------------------------------------------------------
  373. def include?(item)
  374. return false if item == nil # アイテムが nil なら含めない
  375. return false unless item.is_compose? # 合成アイテムでなければ含めない
  376. if KGC::ComposeItem::HIDE_SHORTAGE_RECIPE # 費用?素材不足を隠す場合
  377. if !$game_party.item_composed?(item) && !enable?(item)
  378. return false # 未合成かつ合成不可なら含めない
  379. end
  380. end
  381. return true
  382. end
  383. #--------------------------------------------------------------------------
  384. # ○ アイテムを許可状態で表示するかどうか
  385. # item : アイテム
  386. #--------------------------------------------------------------------------
  387. def enable?(item)
  388. return $game_party.item_can_compose?(item)
  389. end
  390. #--------------------------------------------------------------------------
  391. # ● 項目の描画
  392. # index : 項目番号
  393. #--------------------------------------------------------------------------
  394. def draw_item(index)
  395. item = @data[index]
  396. number = $game_party.item_number(item)
  397. limit = ($imported["LimitBreak"] ? item.number_limit : 99)
  398. rect = item_rect(index)
  399. self.contents.clear_rect(rect)
  400. draw_compose_item_name(item, rect.x, rect.y, enable?(item))
  401. # 費用を描画
  402. if !KGC::ComposeItem::HIDE_ZERO_COST || item.compose_cost > 0
  403. rect.width -= 4
  404. self.contents.draw_text(rect, item.compose_cost, 2)
  405. end
  406. end
  407. if KGC::ComposeItem::HIDE_UNKNOWN_RECIPE_HELP
  408. #--------------------------------------------------------------------------
  409. # ● ヘルプテキスト更新
  410. #--------------------------------------------------------------------------
  411. def update_help
  412. item = (index >= 0 ? @data[index] : nil)
  413. if item == nil || $game_party.item_composed?(item)
  414. # アイテムが nil か、合成済みなら [Window_ShopBuy] に任せる
  415. super
  416. else
  417. @help_window.set_text(KGC::ComposeItem::UNKNOWN_RECIPE_HELP)
  418. end
  419. end
  420. end
  421. end
  422. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  423. #==============================================================================
  424. # □ Window_ComposeStatus
  425. #------------------------------------------------------------------------------
  426. #  合成画面で、素材の所持数や必要数を表示するウィンドウです。
  427. #==============================================================================
  428. class Window_ComposeStatus < Window_ShopStatus
  429. #--------------------------------------------------------------------------
  430. # ○ 表示モード
  431. #--------------------------------------------------------------------------
  432. MODE_MATERIAL = 0 # 素材リスト
  433. MODE_STATUS = 1 # パーティのステータス
  434. #--------------------------------------------------------------------------
  435. # ● オブジェクト初期化
  436. # x : ウィンドウの X 座標
  437. # y : ウィンドウの Y 座標
  438. #--------------------------------------------------------------------------
  439. def initialize(x, y)
  440. @mode = MODE_MATERIAL
  441. super(x, y)
  442. end
  443. #--------------------------------------------------------------------------
  444. # ○ モード変更
  445. #--------------------------------------------------------------------------
  446. def change_mode
  447. case @mode
  448. when MODE_MATERIAL
  449. @mode = MODE_STATUS
  450. when MODE_STATUS
  451. @mode = MODE_MATERIAL
  452. end
  453. self.oy = 0
  454. refresh
  455. end
  456. #--------------------------------------------------------------------------
  457. # ● ウィンドウ内容の作成
  458. #--------------------------------------------------------------------------
  459. def create_contents
  460. if @mode == MODE_STATUS
  461. super
  462. return
  463. end
  464. self.contents.dispose
  465. ch = height - 32
  466. if @item != nil
  467. mag = (KGC::ComposeItem::COMPACT_MATERIAL_LIST ? 1 : 2)
  468. ch = [ch, WLH * (mag + @item.compose_materials.size * mag)].max
  469. end
  470. self.contents = Bitmap.new(width - 32, ch)
  471. end
  472. #--------------------------------------------------------------------------
  473. # ● リフレッシュ
  474. #--------------------------------------------------------------------------
  475. def refresh
  476. create_contents
  477. self.contents.font.size = Font.default_size
  478. case @mode
  479. when MODE_MATERIAL
  480. draw_material_list
  481. when MODE_STATUS
  482. super
  483. end
  484. end
  485. #--------------------------------------------------------------------------
  486. # ○ 素材リストを描画
  487. #--------------------------------------------------------------------------
  488. def draw_material_list
  489. return if @item == nil
  490. number = $game_party.item_number(@item)
  491. self.contents.font.color = system_color
  492. self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession)
  493. self.contents.font.color = normal_color
  494. self.contents.draw_text(4, 0, 200, WLH, number, 2)
  495. self.contents.font.size = 16 if KGC::ComposeItem::COMPACT_MATERIAL_LIST
  496. mag = (KGC::ComposeItem::COMPACT_MATERIAL_LIST ? 1 : 2)
  497. @item.compose_materials.each_with_index { |material, i|
  498. y = WLH * (mag + i * mag)
  499. draw_material_info(0, y, material)
  500. }
  501. end
  502. #--------------------------------------------------------------------------
  503. # ○ 素材情報を描画
  504. #--------------------------------------------------------------------------
  505. def draw_material_info(x, y, material)
  506. m_item = material.item
  507. return if m_item == nil
  508. number = $game_party.item_number(m_item)
  509. enabled = (number > 0 && number >= material.number)
  510. draw_item_name(m_item, x, y, enabled)
  511. if KGC::ComposeItem::COMPACT_MATERIAL_LIST
  512. m_number = (material.number == 0 ? "-" : sprintf("%d", material.number))
  513. self.contents.draw_text(x, y, width - 32, WLH,
  514. sprintf("%s/%d", m_number, number), 2)
  515. else
  516. m_number = (material.number == 0 ? "-" : sprintf("%2d", material.number))
  517. self.contents.draw_text(x, y + WLH, width - 32, WLH,
  518. sprintf("%2s/%2d", m_number, number), 2)
  519. end
  520. end
  521. end
  522. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  523. #==============================================================================
  524. # ■ Scene_Map
  525. #==============================================================================
  526. class Scene_Map < Scene_Base
  527. #--------------------------------------------------------------------------
  528. # ● ショップ画面への切り替え
  529. #--------------------------------------------------------------------------
  530. alias call_shop_KGC_ComposeItem call_shop
  531. def call_shop
  532. # 合成画面を呼び出した場合
  533. if $game_switches[KGC::ComposeItem::COMPOSE_CALL_SWITCH]
  534. # 合成画面に移行
  535. $game_temp.next_scene = nil
  536. $game_switches[KGC::ComposeItem::COMPOSE_CALL_SWITCH] = false
  537. $scene = Scene_ComposeItem.new
  538. else
  539. call_shop_KGC_ComposeItem
  540. end
  541. end
  542. end
  543. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  544. #==============================================================================
  545. # □ Scene_ComposeItem
  546. #------------------------------------------------------------------------------
  547. #  合成画面の処理を行うクラスです。
  548. #==============================================================================
  549. class Scene_ComposeItem < Scene_Shop
  550. #--------------------------------------------------------------------------
  551. # ● 開始処理
  552. #--------------------------------------------------------------------------
  553. def start
  554. super
  555. # コマンドウィンドウ非表示
  556. if KGC::ComposeItem::HIDE_COMMAND_WINDOW
  557. @command_window.visible = false
  558. @gold_window.y = Graphics.height - @gold_window.height
  559. @gold_window.z = @status_window.z + 100
  560. @gold_window.visible = !KGC::ComposeItem::HIDE_GOLD_WINDOW
  561. @dummy_window.y = @command_window.y
  562. @dummy_window.height += @command_window.height
  563. end
  564. # [Scene_Shop] 再利用のため、合成リストに @buy_window を使用
  565. @buy_window.dispose
  566. @buy_window = Window_ComposeItem.new(0, @dummy_window.y)
  567. @buy_window.height = @dummy_window.height
  568. @buy_window.active = false
  569. @buy_window.visible = false
  570. @buy_window.help_window = @help_window
  571. # その他のウィンドウを再構成
  572. @number_window.dispose
  573. @number_window = Window_ComposeNumber.new(0, @buy_window.y)
  574. @number_window.height = @buy_window.height
  575. @number_window.create_contents
  576. @number_window.active = false
  577. @number_window.visible = false
  578. @status_window.dispose
  579. @status_window = Window_ComposeStatus.new(@buy_window.width, @buy_window.y)
  580. @status_window.height = @buy_window.height
  581. @status_window.create_contents
  582. @status_window.visible = false
  583. # コマンドウィンドウ非表示の場合、合成ウィンドウに切り替え
  584. if KGC::ComposeItem::HIDE_COMMAND_WINDOW
  585. @command_window.active = false
  586. @dummy_window.visible = false
  587. @buy_window.active = true
  588. @buy_window.visible = true
  589. @buy_window.update_help
  590. @status_window.visible = true
  591. @status_window.item = @buy_window.item
  592. end
  593. end
  594. #--------------------------------------------------------------------------
  595. # ● コマンドウィンドウの作成
  596. #--------------------------------------------------------------------------
  597. def create_command_window
  598. s1 = Vocab::ComposeItem
  599. s2 = Vocab::ShopSell
  600. s3 = Vocab::ShopCancel
  601. @command_window = Window_Command.new(384, [s1, s2, s3], 3)
  602. @command_window.y = 56
  603. if $game_temp.shop_purchase_only
  604. @command_window.draw_item(1, false)
  605. end
  606. end
  607. #--------------------------------------------------------------------------
  608. # ● フレーム更新
  609. #--------------------------------------------------------------------------
  610. def update
  611. super
  612. if KGC::ComposeItem::SWITCH_INFO_BUTTON != nil &&
  613. Input.trigger?(KGC::ComposeItem::SWITCH_INFO_BUTTON)
  614. Sound.play_cursor
  615. @status_window.change_mode
  616. end
  617. end
  618. #--------------------------------------------------------------------------
  619. # ● 購入アイテム選択の更新
  620. #--------------------------------------------------------------------------
  621. def update_buy_selection
  622. # コマンドウィンドウ非表示で B ボタンが押された場合
  623. if KGC::ComposeItem::HIDE_COMMAND_WINDOW && Input.trigger?(Input::B)
  624. Sound.play_cancel
  625. $scene = Scene_Map.new
  626. return
  627. end
  628. @status_window.item = @buy_window.item
  629. if Input.trigger?(Input::C)
  630. @item = @buy_window.item
  631. # アイテムが無効なら選択不可
  632. if @item == nil
  633. Sound.play_buzzer
  634. return
  635. end
  636. # 合成不可能 or 限界数まで所持している場合は選択不可
  637. number = $game_party.item_number(@item)
  638. limit = ($imported["LimitBreak"] ? @item.number_limit : 99)
  639. if !$game_party.item_can_compose?(@item) || number == limit
  640. Sound.play_buzzer
  641. return
  642. end
  643. # 個数入力に切り替え
  644. Sound.play_decision
  645. max = $game_party.number_of_composable(@item)
  646. max = [max, limit - number].min
  647. @buy_window.active = false
  648. @buy_window.visible = false
  649. @number_window.set(@item, max, @item.compose_cost)
  650. @number_window.active = true
  651. @number_window.visible = true
  652. return
  653. end
  654. super
  655. end
  656. #--------------------------------------------------------------------------
  657. # ● 個数入力の決定
  658. #--------------------------------------------------------------------------
  659. def decide_number_input
  660. if @command_window.index != 0 # 「合成する」以外
  661. super
  662. return
  663. end
  664. Sound.play_shop
  665. @number_window.active = false
  666. @number_window.visible = false
  667. # 合成処理
  668. operation_compose
  669. @gold_window.refresh
  670. @buy_window.refresh
  671. @status_window.refresh
  672. @buy_window.active = true
  673. @buy_window.visible = true
  674. end
  675. #--------------------------------------------------------------------------
  676. # ○ 合成の処理
  677. #--------------------------------------------------------------------------
  678. def operation_compose
  679. $game_party.lose_gold(@number_window.number * @item.compose_cost)
  680. $game_party.gain_item(@item, @number_window.number)
  681. # 素材を減らす
  682. @item.compose_materials.each { |material|
  683. $game_party.lose_item(material.item,
  684. material.number * @number_window.number)
  685. }
  686. # 合成済みにする
  687. $game_party.set_item_composed(@item)
  688. end
  689. end
复制代码
这个脚本非常实用,能完成物品合成的要求,然后LZ自己定一个变量“消炎的炼药等级,在物品合成成功那一行增加一句:变量+1”

点评

277行有BUG。  发表于 2013-7-27 21:17

评分

参与人数 1星屑 +100 收起 理由
Luciffer + 100 认可答案

查看全部评分

长名公主玩家群:372588926 攻略娱乐应有尽有
了解更多新RM游戏,游戏制作请加入RPGmaker支援群:113622890
回复 支持 反对

使用道具 举报

Lv2.观梦者

会吐槽的画师

梦石
0
星屑
782
在线时间
3431 小时
注册时间
2011-6-10
帖子
6535
3
发表于 2013-7-24 11:29:50 | 只看该作者
善用搜索,“物品合成”
出于你这炼药时间一分钟的设定,我再推荐你看一篇名字叫做“你做的游戏是人玩的吗?”的帖子
长名公主玩家群:372588926 攻略娱乐应有尽有
了解更多新RM游戏,游戏制作请加入RPGmaker支援群:113622890
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
85 小时
注册时间
2012-8-9
帖子
102
4
 楼主| 发表于 2013-7-24 15:04:03 | 只看该作者
上贺茂润 发表于 2013-7-24 11:39
这个脚本非常实用,能完成物品合成的要求,然后LZ自己定一个变量“消炎的炼药等级,在物品合成成 ...

可不可以给一个范例呢?{:2_270:}

点评

帖过期,如有其它疑问请重新发帖  发表于 2013-8-9 15:46
《烈火契约》工作室招收美工,有意者进Q群:248202504
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-25 12:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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