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

Project1

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

[已经解决] 可不可以帮忙加个String?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
145
在线时间
81 小时
注册时间
2010-12-28
帖子
11
跳转到指定楼层
1
发表于 2015-8-2 20:10:18 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这是Hime大的脚本,
原址
因为界面很阳春,
库存和售价难免有点混淆。
希望可以改成这样,



希望不会太难才好?
请求各位大神帮忙,谢谢。
  1. =begin
  2. #===============================================================================
  3. Title: Shop Stock
  4. Author: Hime
  5. Date: Feb 22, 2013
  6. --------------------------------------------------------------------------------
  7. ** Change log
  8. Feb 22, 2013
  9.    - Initial release
  10. --------------------------------------------------------------------------------   
  11. ** Terms of Use
  12. * Free to use in non-commercial projects
  13. * Contact me for commercial use
  14. * No real support. The script is provided as-is
  15. * Will do bug fixes, but no compatibility patches
  16. * Features may be requested but no guarantees, especially if it is non-trivial
  17. * Preserve this header
  18. --------------------------------------------------------------------------------
  19. ** Required

  20. -Shop Manager
  21. (http://himeworks.com/2013/02/22/shop-manager/)
  22. --------------------------------------------------------------------------------
  23. ** Description

  24. This script adds a "stock" count to each shop good.
  25. Once a good's stock reaches 0, it will no longer be available in the shop.

  26. --------------------------------------------------------------------------------
  27. ** Usage

  28. In your event, before the Shop Processing command, use a script call

  29.    @shop_stock[id] = amount
  30.    
  31. Where
  32.    `id` is the ID of the shop good, which is the index they appear in the
  33.         shop list. The first item has ID of 1.
  34.    
  35.    `amount` is how much of the item they have in stock
  36.    
  37. --------------------------------------------------------------------------------
  38. ** Developers   

  39. How much stock that a shop has remaining of a shop good is stored in the
  40. "stock" attribute of that good. There are three cases

  41.    stock < 0, then there is no limit
  42.    stock == 0, then there is none left
  43.    stock > 0, then there is that much left

  44. #===============================================================================
  45. =end
  46. $imported = {} if $imported.nil?
  47. $imported["TH_ShopStock"] = true
  48. #===============================================================================
  49. # ** Configuration
  50. #===============================================================================
  51. module TH
  52.   module Shop_Stock
  53.   end
  54. end
  55. #===============================================================================
  56. # ** Rest of the Script
  57. #===============================================================================
  58. class Game_Interpreter
  59.   
  60.   alias :th_shop_stock_clear :clear
  61.   def clear
  62.     th_shop_stock_clear
  63.     @shop_stock = []
  64.   end
  65.   
  66.   alias :th_shop_stock_setup_good :setup_good
  67.   def setup_good(good, id)
  68.     th_shop_stock_setup_good(good, id)
  69.     stock = @shop_stock[id]
  70.     return unless stock
  71.     good.stock = stock
  72.   end
  73. end
  74. class Game_ShopGood
  75.   attr_reader :stock
  76.   
  77.   alias :th_shop_stock_init :initialize
  78.   def initialize(*args)
  79.     th_shop_stock_init(*args)
  80.     @stock = -1
  81.     @unlimited = true
  82.   end
  83.   
  84.   def stock=(amount)
  85.     @stock = amount
  86.     @unlimited = (amount < 0)
  87.   end
  88.   
  89.   def unlimited?
  90.     @unlimited
  91.   end
  92.   
  93.   def increase_stock(amount)
  94.     @stock += amount
  95.   end
  96.   
  97.   def decrease_stock(amount)
  98.     return if @unlimited
  99.     @stock = [@stock - amount, 0].max
  100.   end
  101. end

  102. class Game_Shop
  103.   
  104.   alias :th_shop_stock_include? :include?
  105.   def include?(index)
  106.     return false if stock(index) == 0
  107.     th_shop_stock_include?(index)
  108.   end
  109.   
  110.   def stock(index)
  111.     @shop_goods[index].stock
  112.   end
  113. end

  114. class Window_ShopBuy < Window_Selectable
  115.   
  116.   alias :th_shop_stock_include? :include?
  117.   def include?(shopGood)
  118.     return false if shopGood.stock == 0
  119.     th_shop_stock_include?(shopGood)
  120.   end
  121.   
  122.   alias :th_shop_stock_draw_item :draw_item
  123.   def draw_item(index)
  124.     th_shop_stock_draw_item(index)
  125.     rect = item_rect(index)
  126.     item = @data[index]
  127.     shopGood = @goods[item]
  128.     draw_text(rect, shopGood.stock, 1) unless shopGood.unlimited?
  129.   end

  130.   alias :th_shop_stock_process_ok :process_ok
  131.   def process_ok
  132.     unless @data[index]
  133.       Sound.play_buzzer
  134.       return
  135.     end
  136.     th_shop_stock_process_ok
  137.   end
  138. end

  139. class Scene_Shop < Scene_MenuBase
  140.   
  141.   #--------------------------------------------------------------------------
  142.   # Get amount you could buy, compared to the amount in-stock
  143.   #--------------------------------------------------------------------------
  144.   alias :th_shop_stock_max_buy :max_buy
  145.   def max_buy
  146.     party_max = th_shop_stock_max_buy
  147.     @selected_good.unlimited? ? party_max : [party_max, @selected_good.stock].min
  148.   end
  149.   
  150.   #--------------------------------------------------------------------------
  151.   # Decrease the amount of stock of the selected good
  152.   #--------------------------------------------------------------------------
  153.   alias :th_shop_stock_do_buy :do_buy
  154.   def do_buy(number)
  155.     th_shop_stock_do_buy(number)
  156.     @selected_good.decrease_stock(number)
  157.   end
  158. end
复制代码

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21631
在线时间
9415 小时
注册时间
2012-6-19
帖子
7118

开拓者短篇九导演组冠军

2
发表于 2015-8-2 20:41:12 | 只看该作者
未测试

138行改成这样:draw_text(rect, "x#{shopGood.stock}", 1) unless shopGood.unlimited?

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
145
在线时间
81 小时
注册时间
2010-12-28
帖子
11
3
 楼主| 发表于 2015-8-2 22:20:28 | 只看该作者
动作真快啊!太感谢了!{:2_280:}
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-16 13:02

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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