Project1

标题: 关于商店价格变动,请教。 [打印本页]

作者: sd4232257    时间: 2014-4-12 23:11
标题: 关于商店价格变动,请教。
请问怎么让商店的卖出价格根据自己的设定变更,或者随机变动都行。

还有就是,怎么让敌人和主角的魔法为零时死掉。求教求教
作者: 名雪    时间: 2014-4-19 20:35
商店价格变动脚本
RUBY 代码复制
  1. #==============================================================================
  2. # ■ 物品价格比例
  3. #  作者:影月千秋
  4. #  版本:V 1.0
  5. #  最近更新:2013.12.15
  6. #  适用:VA
  7. #------------------------------------------------------------------------------
  8. # ● 简介
  9. #  提供物品交易时对价格的一系列处理,比如全体物品售价增加20%、全体物品回收(贩卖)价
  10. # 格增加原价的35%、某物品的贩卖价格占原价的70%等等
  11. #==============================================================================
  12. # ● 使用方法
  13. #   将此脚本插入到其他脚本以下,Main以上
  14. #   在下方设定脚本所使用的开关及变量ID
  15. #   数据库中,在物品的备注栏按照下方的正则式来填写匹配备注
  16. #   游戏中可以通过操作开关和变量来进行价格处理
  17. #
  18. #  * 物品的备注
  19. #   在备注中按照正则式填写,默认格式为 <贩卖 XX> ,XX为任意数字,代表着这个物品的
  20. #  售价将会是原价的 XX%
  21. #   例:
  22. #    <贩卖 65>
  23. #  * Buying变量
  24. #   游戏中更改这个变量的值,则物品售价(你付出的)将为【原价 乘以(1 + 变量值 %)】
  25. #  * Selling变量
  26. #   改变所有物品贩卖价格占售价的比例,新比例 = 原比例 + 变量值
  27. #   如果物品备注栏做了上述设置(脚本第18行) 则原比例即为设置的比例 如果没有
  28. #  则原比例为50
  29. #==============================================================================
  30. # ● 更新
  31. #   V 1.0 2013.12.15 新建
  32. #==============================================================================
  33. # ● 声明
  34. #   本脚本来自【影月千秋】,使用、修改和转载请保留此信息
  35. #==============================================================================
  36.  
  37. $smomo ||= {}
  38. if $smomo["ItemPriceRate"].nil?
  39. $smomo["ItemPriceRate"] = true
  40.  
  41. #===============================================================================
  42. # ■ Smomo
  43. #===============================================================================
  44. module Smomo
  45.   #=============================================================================
  46.   # ■ Smomo::ItemPriceRate
  47.   #=============================================================================
  48.   module ItemPriceRate
  49.     Using = 6
  50.     # 开关ID:启用/禁用脚本功能
  51.     Buying = 7
  52.     # 变量ID:控制 从商店购买物品时 价格增加的比例
  53.     Selling = 8
  54.     # 变量ID:控制 在商店卖出物品时 售价占原价比例的增量
  55.     Match_Reg = /<贩卖\s+(\d+)>/
  56.     # 匹配物品备注栏的正则式,如果懂的话可以自己改(不建议)
  57.     # 默认: /<贩卖\s+(\d+)>/   匹配举例: <贩卖 21>  其中21可以替换为任意数字
  58. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+#
  59. #------------------------------------------------------------------------------#
  60. #                               请勿跨过这块区域                                #
  61. #------------------------------------------------------------------------------#
  62. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=#
  63.   end
  64. end
  65. #==============================================================================
  66. # ■ Window_ShopBuy
  67. #==============================================================================
  68. class Window_ShopBuy
  69.   alias :item_price_rate_price :price
  70.   def price(item)
  71.     return item.price unless @price[item]
  72.     if $game_switches[Smomo::ItemPriceRate::Using]
  73.       @price[item] * (100 + $game_variables[Smomo::ItemPriceRate::Buying]) / 100
  74.     else
  75.       item_price_rate_price(item)
  76.     end
  77.   end
  78. end
  79. #==============================================================================
  80. # ■ Scene_Shop
  81. #==============================================================================
  82. class Scene_Shop
  83.   alias :item_price_rate_selling_price :selling_price
  84.   def selling_price
  85.     if $game_switches[Smomo::ItemPriceRate::Using]
  86.       rate = Smomo::ItemPriceRate::Match_Reg =~ @item.note ? $1.to_i : 50
  87.       rate += $game_variables[Smomo::ItemPriceRate::Selling]
  88.       @buy_window.make_item_list
  89.       prc = @item.price * rate / 100
  90.       prc > buying_price ? buying_price : prc
  91.     else
  92.       item_price_rate_selling_price
  93.     end
  94.   end
  95. end
  96.  
  97. else # if $smomo
  98.   msgbox "请不要重复加载此脚本 : )\n【物品价格比例 ItemPriceRate】"
  99. end
  100. #==============================================================================#
  101. #=====                        =================================================#
  102.            "■ 脚 本 尾"
  103. #=====                        =================================================#
  104. #==============================================================================#

作者: taroxd    时间: 2014-4-19 20:57
我来回答那个“还有就是”吧~

RUBY 代码复制
  1. class Game_BattlerBase
  2.   alias refresh_without_mp_death refresh
  3.   def refresh
  4.     refresh_without_mp_death
  5.     @mp == 0 ? add_state(death_state_id) : remove_state(death_state_id)
  6.   end
  7. end





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1