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

Project1

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

[已经过期] 谁帮我修改下这个脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
214
在线时间
66 小时
注册时间
2014-1-23
帖子
53
跳转到指定楼层
1
发表于 2014-8-12 18:38:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我新找了个多重货币的脚本,但在菜单中显示货币的数量时感觉与游戏特别不配,
我用的是找到的一个动态菜单脚本,谁能帮我把金币窗口变成透明、改变位置与颜色呀
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. module Currency
  5. #==============================================================================
  6. #                           设定部分
  7. #==============================================================================
  8.   # 货币名称 -- 在金钱窗口里使用
  9.   @name = ["金",   "银"]
  10.   
  11.   
  12.   # 货币名称 -- 在商店里选择时使用
  13.   @iname =["金币", "银币"]
  14.   
  15.   
  16.   # 货币汇率 -- 计算价钱用
  17.   @rate = [ 1,     0.5,]
  18.   
  19.   # 无法使用的货币
  20.   @cannot_use =  []
  21.   
  22.   # 不在金钱窗口显示的货币
  23.   @do_not_show = []
  24.   
  25.   # 货币文字 -- 商店画面选项理所显示的文字
  26.   def self.word
  27.     return "选择货币"
  28.   end
  29.    
  30.   # 只能用特定货币购买时显示的文字
  31.     # %s代表该货币
  32.   One_Currency = "只能用%s来购买!"
  33.    
  34.   # 金钱窗口设置:是否在菜单显示新的金钱窗口
  35.   SHOW_NEW_CURRENCY = true
  36.   
  37. #==============================================================================
  38. #  设定部分结束
  39. #==============================================================================
  40. #==============================================================================
  41. #                            使用方法
  42. #==============================================================================
  43. =begin
  44.   在事件中使用脚本:
  45.     gain_currency(类型, 数量)增加该类型货币
  46.     lose_currency(类型, 数量)减少该类型货币
  47.    
  48.     convert(类型, 变量ID) 将该变量内的数值转换为该类型并返回
  49.     currency_type(类型, 变量ID) 将该类型货币金额代入该变量
  50.     在物品(武器、防具亦可,技能尚未测试)的备注栏打上
  51.               
  52.     则该物品只能使用该类型货币购买
  53.     在物品(武器、防具亦可,技能尚未测试)的备注栏打上
  54.               
  55.     则该物品只能使用该类型以外的货币购买
  56.     两个同时定义时,会互相抵销
  57.     (例如:同一个物品同时定义了 和
  58.       也就是同时「只能使用1号货币」和「只能除用除1号以外的货币」
  59.       那麽就变成了全部都能使用)
  60.     类型为数字代号,就是在脚本中所设定好的顺序(从0开始算)
  61.     0为默认金钱(直接用事件命令就行了)
  62. =end
  63. #==============================================================================
  64. #  使用方法结束
  65. #==============================================================================
  66.   attr_accessor :name
  67.   attr_accessor :rate
  68.   def self.get_g_rate(i)
  69.     if  $game_party.gold != 0
  70.       p = @rate[i] * $game_party.gold
  71.       return p.to_i == 0? 1 : p.to_i
  72.     else
  73.       return 0
  74.     end
  75.   end
  76.   def self.get_n_rate(i, number)
  77.     if  number != 0
  78.       p = @rate[i] * number
  79.       return p.to_i == 0? 1 : p.to_i
  80.     else
  81.       return 0
  82.     end
  83.   end
  84.   def self.number
  85.     return @name.size
  86.   end
  87.   def self.name(i)
  88.     return @name[i]
  89.   end
  90.   def self.id(i)
  91.     return @iname[i]
  92.   end
  93.   def self.show?(id)
  94.     return !(@do_not_show.include?(id))
  95.   end
  96.   def self.can_use?(id, item=nil)
  97.     return false if @cannot_use.include?(id)
  98.     unless item==nil
  99.       if item.get_currency_use != nil
  100.         return true if item.get_currency_use.include?(id)
  101.       end
  102.       if item.get_currency_not_use != nil
  103.         return false if item.get_currency_not_use.include?(id)
  104.       end
  105.     end
  106.     return true
  107.   end
  108. end
  109. class Game_Party < Game_Unit
  110.   attr_accessor   :curr
  111.   alias c_ini initialize
  112.   def initialize
  113.     c_ini
  114.     @curr = []
  115.     for i in 0...Currency.number
  116.       if @curr[i] == nil
  117.         @curr[i] = 0
  118.       end
  119.     end
  120.     @curr[0] = @gold
  121.   end
  122.   # 获得和失去金钱
  123.   def gain_curr(type, amount)
  124.     @curr[type] = [[@curr[type] + amount, 0].max, 9999999].min
  125.     @gold = @curr[0]
  126.   end
  127.   def lose_curr(type, amount)
  128.     gain_curr(type, -amount)
  129.   end
  130.   def gain_gold(n)
  131.     gain_curr(0, n)
  132.   end
  133.   def curr(n)
  134.     return @curr[n] == nil ? 0 : @curr[n]
  135.   end
  136. end
  137. class Game_Interpreter
  138.   # 获取货币
  139.   def gain_currency(type, amount)
  140.     $game_party.gain_curr(type, amount)
  141.   end
  142.   # 失去货币
  143.   def lose_currency(type, amount)
  144.     $game_party.lose_curr(type, amount)
  145.   end
  146.   # 货币兑换
  147.   def convert(type, vid)
  148.     return Currency.get_n_rate(type, $game_variables[vid])
  149.   end
  150.   # 获取货币持有量
  151.   def currency_type(type, vid)
  152.     $game_variables[vid] = $game_party.curr(type)
  153.   end
  154. end
  155. class Scene_Menu < Scene_Base
  156.   alias c_menu_start start
  157.   def start
  158.     c_menu_start
  159.     if Currency::SHOW_NEW_CURRENCY
  160.       @gold_window.dispose
  161.       @gold_window = Window_SGold.new(0, 0)
  162.       @gold_window.y = 416-@gold_window.height
  163.     end
  164.   end
  165. end
  166. class RPG::BaseItem
  167.   def get_currency_use
  168.     e = []
  169.     self.note.split(/[\r\n]+/).each { |line|
  170.       if line =~ //
  171.         a = line.split(/ /)[1]
  172.         d = ""
  173.         while ((c = a.slice!(/./m)) != nil)
  174.           d += c if c != ">"
  175.         end
  176.         e.push(d.to_i)
  177.       end
  178.     }
  179.     return e==[] ? nil : e
  180.   end
  181.   def get_currency_not_use
  182.     e = []
  183.     self.note.split(/[\r\n]+/).each { |line|
  184.       if line =~ //
  185.         a = line.split(/ /)[1]
  186.         d = ""
  187.         while ((c = a.slice!(/./m)) != nil)
  188.           d += c if c != ">"
  189.         end
  190.         e.push(d.to_i)
  191.       end
  192.     }
  193.     return e==[] ? nil : e
  194.   end
  195. end
  196. #==============================================================================
  197. # ■ Window_SGold
  198. #------------------------------------------------------------------------------
  199. #  新的显示金钱窗口,可以显示多重货币。
  200. #==============================================================================
  201. class Window_SGold < Window_Base
  202.   def initialize(x, y, c=-1)
  203.     a = 1
  204.     [url=home.php?mod=space&uid=26101]@Money[/url] = []
  205.     for i in 0...Currency::number
  206.       @money.push(i) if Currency.show?(i)
  207.     end
  208.     a = @money.size if c == -1
  209.     super(x, y, 160, a * WLH + 32)
  210.     @currency = c
  211.     refresh
  212.   end
  213.   def refresh
  214.     self.contents.clear
  215.    
  216.     if @currency == -1
  217.       for i in @money
  218.         draw_scurrency_value(i, 4, i*WLH, 120)
  219.       end
  220.     else
  221.       draw_scurrency_value(@currency, 4, 0, 120)
  222.     end
  223.   end
  224.   def draw_scurrency_value(i, x, y, width)
  225.     cx = contents.text_size(Vocab::gold).width
  226.     self.contents.font.color = normal_color
  227.     self.contents.draw_text(x, y, width-cx-2, WLH, $game_party.curr(i), 2)
  228.     self.contents.font.color = system_color
  229.     self.contents.draw_text(x, y, width, WLH, Currency.name(i), 2)
  230.   end
  231. end
  232.   
  233. #==============================================================================
  234. # ■ Window_ShopBuy
  235. #------------------------------------------------------------------------------
  236. #  商店画面、浏览显示可以购买的商品的窗口。
  237. #==============================================================================
  238. class Window_ShopBuy < Window_Selectable
  239.   #--------------------------------------------------------------------------
  240.   # ● 初始化对像
  241.   #     x : 窗口 X 座标
  242.   #     y : 窗口 Y 座标
  243.   #     c : 货币类型
  244.   #--------------------------------------------------------------------------
  245.   def initialize(x, y, c=0)
  246.     super(x, y, 304, 304)
  247.     @shop_goods = $game_temp.shop_goods
  248.     @currency = c
  249.     refresh
  250.     self.index = 0
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # ● 绘制商品
  254.   #     index : 商品索引
  255.   #--------------------------------------------------------------------------
  256.   def draw_item(index)
  257.     item = @data[index]
  258.     number = $game_party.item_number(item)
  259.     price = Currency.get_n_rate(@currency, item.price)
  260.     gold  = Currency.get_g_rate(@currency)
  261.    
  262.     enabled = Currency.can_use?(@currency, item)
  263.     enabled = ( price <= gold and number < 99) if enabled
  264.    
  265.     rect = item_rect(index)
  266.     self.contents.clear_rect(rect)
  267.     draw_item_name(item, rect.x, rect.y, enabled)
  268.     rect.width -= 4
  269.     self.contents.draw_text(rect,price, 2)
  270.   end
  271. end
  272. class Window_ShopStatus < Window_Base
  273.   alias curr_refresh refresh
  274.   def refresh
  275.     curr_refresh
  276.     currency = []
  277.     money = ""
  278.     if @item != nil
  279.       for i in 0...Currency::number
  280.         currency.push(i) if Currency.can_use?(i, @item)
  281.       end
  282.       for i in currency
  283.         money += "、" if i>0 and i<=currency.size
  284.         money += Currency.name(i)
  285.       end
  286.       string = sprintf(Currency::One_Currency, money)
  287.       self.contents.draw_text(4, 24, 200, WLH, string,1)
  288.     end
  289.   end
  290. end
  291. #==============================================================================
  292. # ■ Scene_Shop
  293. #------------------------------------------------------------------------------
  294. #  处理商店画面的类。
  295. #==============================================================================
  296. class Scene_Shop < Scene_Base
  297.   #--------------------------------------------------------------------------
  298.   # ● 开始处理
  299.   #--------------------------------------------------------------------------
  300.   alias c_start start
  301.   def start
  302.     c_start
  303.     @currency = 0
  304.     @command = []
  305.     for i in 0...Currency::number
  306.       if Currency.can_use?(i)
  307.         @command.push(Currency::id(i))
  308.       end
  309.     end
  310.     @currency_window = Window_Command.new(160, @command, 1, 3)
  311.     @currency_window.x = 384
  312.     @currency_window.y = 56
  313.     @currency_window.active = false
  314.     @currency_window.visible = false
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● 结束处理
  318.   #--------------------------------------------------------------------------
  319.   alias c_term terminate
  320.   def terminate
  321.     c_term
  322.     @currency_window.dispose
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● 更新画面
  326.   #--------------------------------------------------------------------------
  327.   def update
  328.     super
  329.     update_menu_background
  330.     @help_window.update
  331.     @command_window.update
  332.     @gold_window.update
  333.     @dummy_window.update
  334.     @buy_window.update
  335.     @sell_window.update
  336.     @number_window.update
  337.     @status_window.update
  338.     @currency_window.update
  339.     if @command_window.active
  340.       update_command_selection
  341.     elsif @buy_window.active
  342.       update_buy_selection
  343.     elsif @sell_window.active
  344.       update_sell_selection
  345.     elsif @number_window.active
  346.       update_number_input
  347.     elsif @currency_window.active
  348.       update_currency_selection
  349.     end
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # ● 生成命令窗口
  353.   #--------------------------------------------------------------------------
  354.   def create_command_window
  355.     s1 = Vocab::ShopBuy
  356.     s2 = Vocab::ShopSell
  357.     s3 = Vocab::ShopCancel
  358.     s4 = Currency.word
  359.     @command_window = Window_Command.new(384, [s1, s2, s4, s3], 4)
  360.     @command_window.y = 56
  361.     if $game_temp.shop_purchase_only
  362.       @command_window.draw_item(1, false)
  363.     end
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # ● 更新命令窗口
  367.   #--------------------------------------------------------------------------
  368.   def update_command_selection
  369.     if Input.trigger?(Input::B)
  370.       Sound.play_cancel
  371.       $scene = Scene_Map.new
  372.     elsif Input.trigger?(Input::C)
  373.       case @command_window.index
  374.       when 0  # 买入
  375.         Sound.play_decision
  376.         @command_window.active = false
  377.         @dummy_window.visible = false
  378.         @buy_window.active = true
  379.         @buy_window.visible = true
  380.         @buy_window.refresh
  381.         @status_window.visible = true
  382.       when 1  # 卖出
  383.         if $game_temp.shop_purchase_only
  384.           Sound.play_buzzer
  385.         else
  386.           Sound.play_decision
  387.           @command_window.active = false
  388.           @dummy_window.visible = false
  389.           @sell_window.active = true
  390.           @sell_window.visible = true
  391.           @sell_window.refresh
  392.         end
  393.       when 3  # 离开
  394.         Sound.play_decision
  395.         $scene = Scene_Map.new
  396.       when 2  # 货币
  397.         @currency_window.active = true
  398.         @currency_window.visible = true
  399.         @command_window.active = false
  400.         @gold_window.visible = false
  401.       end
  402.     end
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ● 更新货币选择窗口
  406.   #--------------------------------------------------------------------------
  407.   def update_currency_selection
  408.     if Input.trigger?(Input::B)
  409.       Sound.play_cancel
  410.       @currency_window.active = false
  411.       @currency_window.visible = false
  412.       @command_window.active = true
  413.       @gold_window.visible = true
  414.     elsif Input.trigger?(Input::C)
  415.       Sound.play_decision
  416.       @currency_window.active = false
  417.       @currency_window.visible = false
  418.       @command_window.active = true
  419.       @currency = @currency_window.index
  420.       @buy_window.dispose
  421.       @buy_window = Window_ShopBuy.new(0, 112, @currency)
  422.       @buy_window.active = false
  423.       @buy_window.visible = false
  424.       @gold_window.dispose
  425.       @gold_window = Window_SGold.new(384, 56, @currency)
  426.     end
  427.   end
  428.   #--------------------------------------------------------------------------
  429.   # ● 更新买入选择
  430.   #--------------------------------------------------------------------------
  431.   def update_buy_selection
  432.     @status_window.item = @buy_window.item
  433.     if Input.trigger?(Input::B)
  434.       Sound.play_cancel
  435.       @command_window.active = true
  436.       @dummy_window.visible = true
  437.       @buy_window.active = false
  438.       @buy_window.visible = false
  439.       @status_window.visible = false
  440.       @status_window.item = nil
  441.       @help_window.set_text("")
  442.       return
  443.     end
  444.     if Input.trigger?(Input::C)
  445.       @item = @buy_window.item
  446.       number = $game_party.item_number(@item)
  447.       price = Currency.get_n_rate(@currency, @item.price)
  448.       gold  = Currency.get_g_rate(@currency)
  449.       enabled = Currency.can_use?(@currency, @item)
  450.       enabled = ( price <= gold and number < 99) if enable
  451.       
  452.       unless enabled
  453.         Sound.play_buzzer
  454.       else
  455.         Sound.play_decision
  456.         max = price == 0 ? 99 : gold / @item.price
  457.         max = [max, 99 - number].min
  458.         @buy_window.active = false
  459.         @buy_window.visible = false
  460.         @number_window.set(@item, max, @item.price)
  461.         @number_window.active = true
  462.         @number_window.visible = true
  463.       end
  464.     end
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # ● 确认数值输入
  468.   #--------------------------------------------------------------------------
  469.   def decide_number_input
  470.     Sound.play_shop
  471.     @number_window.active = false
  472.     @number_window.visible = false
  473.     case @command_window.index
  474.     when 0  # 买入
  475.       gold = @number_window.number * @item.price
  476.       $game_party.lose_curr(@currency_window.index, gold)
  477.       
  478.       $game_party.gain_item(@item, @number_window.number)
  479.       @gold_window.refresh
  480.       @buy_window.refresh
  481.       @status_window.refresh
  482.       @buy_window.active = true
  483.       @buy_window.visible = true
  484.     when 1  # 卖出
  485.       gold = @number_window.number * (@item.price / 2)
  486.       $game_party.gain_curr(@currency_window.index, gold)
  487.       $game_party.lose_item(@item, @number_window.number)
  488.       @gold_window.refresh
  489.       @sell_window.refresh
  490.       @status_window.refresh
  491.       @sell_window.active = true
  492.       @sell_window.visible = true
  493.       @status_window.visible = false
  494.     end
  495.   end
  496. end
  497. #==============================================================================
  498. #==============================================================================
  499. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  500. #==============================================================================

复制代码

Lv4.逐梦者 (版主)

聪仔

梦石
0
星屑
6182
在线时间
3077 小时
注册时间
2013-12-26
帖子
3145
2
发表于 2014-8-12 20:01:30 | 只看该作者
你想改成什么样,应该给个草图出来吧...
聪聪全国第三帅...
他们都叫我【人赢聪】
我的RM能力雷达图:

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-30 00:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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