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

Project1

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

[原创发布] 第二货币商店

 关闭 [复制链接]

Lv1.梦旅人

冰王子

梦石
0
星屑
50
在线时间
34 小时
注册时间
2008-1-27
帖子
1875
跳转到指定楼层
1
发表于 2008-7-19 05:41:45 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
脚本内容
  1. SG_ID = 100#存储第二货币的变量
  2. SG_NA = "灵魂"#第二货币的单位
  3. module RPG
  4.   class Weapon
  5.     def sgprice
  6.       arr = @description.split(/SG/)
  7.       return arr[1].to_i if arr[1] != nil
  8.       return 0
  9.     end
  10.     def description
  11.       arr = @description.split(/SG/)
  12.       return arr[0] if arr[1] != nil
  13.       return @description
  14.     end
  15.   end
  16.   class Armor
  17.     def sgprice
  18.       arr = @description.split(/SG/)
  19.       return arr[1].to_i if arr[1] != nil
  20.       return 0
  21.     end
  22.     def description
  23.       arr = @description.split(/SG/)
  24.       return arr[0] if arr[1] != nil
  25.       return @description
  26.     end
  27.   end
  28.   class Item
  29.     def sgprice
  30.       arr = @description.split(/SG/)
  31.       return arr[1].to_i if arr[1] != nil
  32.       return 0
  33.     end
  34.     def description
  35.       arr = @description.split(/SG/)
  36.       return arr[0] if arr[1] != nil
  37.       return @description
  38.     end
  39.   end
  40. end
  41. class Scene_SGShop < Scene_Shop
  42.   def main
  43.     # 生成帮助窗口
  44.     @help_window = Window_Help.new
  45.     # 生成指令窗口
  46.     @command_window = Window_ShopCommand.new
  47.     # 生成金钱窗口
  48.     @gold_window = Window_SGold.new
  49.     @gold_window.x = 480
  50.     @gold_window.y = 64
  51.     # 生成时间窗口
  52.     @dummy_window = Window_Base.new(0, 128, 640, 352)
  53.     # 生成购买窗口
  54.     @buy_window = Window_SGShopBuy.new($game_temp.shop_goods)
  55.     @buy_window.active = false
  56.     @buy_window.visible = false
  57.     @buy_window.help_window = @help_window
  58.     # 生成卖出窗口
  59.     @sell_window = Window_SGShopSell.new
  60.     @sell_window.active = false
  61.     @sell_window.visible = false
  62.     @sell_window.help_window = @help_window
  63.     # 生成数量输入窗口
  64.     @number_window = Window_ShopNumber.new
  65.     @number_window.active = false
  66.     @number_window.visible = false
  67.     # 生成状态窗口
  68.     @status_window = Window_ShopStatus.new
  69.     @status_window.visible = false
  70.     # 执行过渡
  71.     Graphics.transition
  72.     # 主循环
  73.     loop do
  74.       # 刷新游戏画面
  75.       Graphics.update
  76.       # 刷新输入信息
  77.       Input.update
  78.       # 刷新画面
  79.       update
  80.       # 如果画面切换的话就中断循环
  81.       if $scene != self
  82.         break
  83.       end
  84.     end
  85.     # 准备过渡
  86.     Graphics.freeze
  87.     # 释放窗口
  88.     @help_window.dispose
  89.     @command_window.dispose
  90.     @gold_window.dispose
  91.     @dummy_window.dispose
  92.     @buy_window.dispose
  93.     @sell_window.dispose
  94.     @number_window.dispose
  95.     @status_window.dispose
  96.   end
  97.   def update_buy
  98.     # 设置状态窗口的物品
  99.     @status_window.item = @buy_window.item
  100.     # 按下 B 键的情况下
  101.     if Input.trigger?(Input::B)
  102.       # 演奏取消 SE
  103.       $game_system.se_play($data_system.cancel_se)
  104.       # 窗口状态转向初期模式
  105.       @command_window.active = true
  106.       @dummy_window.visible = true
  107.       @buy_window.active = false
  108.       @buy_window.visible = false
  109.       @status_window.visible = false
  110.       @status_window.item = nil
  111.       # 删除帮助文本
  112.       @help_window.set_text("")
  113.       return
  114.     end
  115.     # 按下 C 键的情况下
  116.     if Input.trigger?(Input::C)
  117.       # 获取物品
  118.       @item = @buy_window.item
  119.       # 物品无效的情况下、或者价格在所持金以上的情况下
  120.       if @item == nil or @item.sgprice > $game_variables[SG_ID]
  121.         # 演奏冻结 SE
  122.         $game_system.se_play($data_system.buzzer_se)
  123.         return
  124.       end
  125.       # 获取物品所持数
  126.       case @item
  127.       when RPG::Item
  128.         number = $game_party.item_number(@item.id)
  129.       when RPG::Weapon
  130.         number = $game_party.weapon_number(@item.id)
  131.       when RPG::Armor
  132.         number = $game_party.armor_number(@item.id)
  133.       end
  134.       # 如果已经拥有了 99 个情况下
  135.       if number == 99
  136.         # 演奏冻结 SE
  137.         $game_system.se_play($data_system.buzzer_se)
  138.         return
  139.       end
  140.       # 演奏确定 SE
  141.       $game_system.se_play($data_system.decision_se)
  142.       # 计算可以最多购买的数量
  143.       max = @item.sgprice == 0 ? 99 : $game_variables[SG_ID] / @item.sgprice
  144.       max = [max, 99 - number].min
  145.       # 窗口状态转向数值输入模式
  146.       @buy_window.active = false
  147.       @buy_window.visible = false
  148.       @number_window.set(@item, max, @item.sgprice)
  149.       @number_window.active = true
  150.       @number_window.visible = true
  151.     end
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● 画面更新 (卖出窗口激活的情况下)
  155.   #--------------------------------------------------------------------------
  156.   def update_sell
  157.     # 按下 B 键的情况下
  158.     if Input.trigger?(Input::B)
  159.       # 演奏取消 SE
  160.       $game_system.se_play($data_system.cancel_se)
  161.       # 窗口状态转向初期模式
  162.       @command_window.active = true
  163.       @dummy_window.visible = true
  164.       @sell_window.active = false
  165.       @sell_window.visible = false
  166.       @status_window.item = nil
  167.       # 删除帮助文本
  168.       @help_window.set_text("")
  169.       return
  170.     end
  171.     # 按下 C 键的情况下
  172.     if Input.trigger?(Input::C)
  173.       # 获取物品
  174.       @item = @sell_window.item
  175.       # 设置状态窗口的物品
  176.       @status_window.item = @item
  177.       # 物品无效的情况下、或者价格为 0 (不能卖出) 的情况下
  178.       if @item == nil or @item.sgprice == 0
  179.         # 演奏冻结 SE
  180.         $game_system.se_play($data_system.buzzer_se)
  181.         return
  182.       end
  183.       # 演奏确定 SE
  184.       $game_system.se_play($data_system.decision_se)
  185.       # 获取物品的所持数
  186.       case @item
  187.       when RPG::Item
  188.         number = $game_party.item_number(@item.id)
  189.       when RPG::Weapon
  190.         number = $game_party.weapon_number(@item.id)
  191.       when RPG::Armor
  192.         number = $game_party.armor_number(@item.id)
  193.       end
  194.       # 最大卖出个数 = 物品的所持数
  195.       max = number
  196.       # 窗口状态转向个数输入模式
  197.       @sell_window.active = false
  198.       @sell_window.visible = false
  199.       @number_window.set(@item, max, @item.sgprice / 2)
  200.       @number_window.active = true
  201.       @number_window.visible = true
  202.       @status_window.visible = true
  203.     end
  204.   end
  205.   def update_number
  206.     # 按下 B 键的情况下
  207.     if Input.trigger?(Input::B)
  208.       # 演奏取消 SE
  209.       $game_system.se_play($data_system.cancel_se)
  210.       # 设置个数输入窗口为不活动·非可视状态
  211.       @number_window.active = false
  212.       @number_window.visible = false
  213.       # 命令窗口光标位置分支
  214.       case @command_window.index
  215.       when 0  # 购买
  216.         # 窗口状态转向购买模式
  217.         @buy_window.active = true
  218.         @buy_window.visible = true
  219.       when 1  # 卖出
  220.         # 窗口状态转向卖出模式
  221.         @sell_window.active = true
  222.         @sell_window.visible = true
  223.         @status_window.visible = false
  224.       end
  225.       return
  226.     end
  227.     # 按下 C 键的情况下
  228.     if Input.trigger?(Input::C)
  229.       # 演奏商店 SE
  230.       $game_system.se_play($data_system.shop_se)
  231.       # 设置个数输入窗口为不活动·非可视状态
  232.       @number_window.active = false
  233.       @number_window.visible = false
  234.       # 命令窗口光标位置分支
  235.       case @command_window.index
  236.       when 0  # 购买
  237.         # 购买处理
  238.         $game_variables[SG_ID] -= (@number_window.number * @item.sgprice)
  239.         case @item
  240.         when RPG::Item
  241.           $game_party.gain_item(@item.id, @number_window.number)
  242.         when RPG::Weapon
  243.           $game_party.gain_weapon(@item.id, @number_window.number)
  244.         when RPG::Armor
  245.           $game_party.gain_armor(@item.id, @number_window.number)
  246.         end
  247.         # 刷新各窗口
  248.         @gold_window.refresh
  249.         @buy_window.refresh
  250.         @status_window.refresh
  251.         # 窗口状态转向购买模式
  252.         @buy_window.active = true
  253.         @buy_window.visible = true
  254.       when 1  # 卖出
  255.         # 卖出处理
  256.         $game_variables[SG_ID] += (@number_window.number * (@item.sgprice/2))
  257.         case @item
  258.         when RPG::Item
  259.           $game_party.lose_item(@item.id, @number_window.number)
  260.         when RPG::Weapon
  261.           $game_party.lose_weapon(@item.id, @number_window.number)
  262.         when RPG::Armor
  263.           $game_party.lose_armor(@item.id, @number_window.number)
  264.         end
  265.         # 刷新各窗口
  266.         @gold_window.refresh
  267.         @sell_window.refresh
  268.         @status_window.refresh
  269.         # 窗口状态转向卖出模式
  270.         @sell_window.active = true
  271.         @sell_window.visible = true
  272.         @status_window.visible = false
  273.       end
  274.       return
  275.     end
  276.   end
  277. end
  278. #=============
  279. #窗口
  280. #=============
  281. class Window_SGold < Window_Base
  282.   def initialize
  283.     super(0, 0, 160, 64)
  284.     self.contents = Bitmap.new(width - 32, height - 32)
  285.     refresh
  286.   end
  287.   def refresh
  288.     self.contents.clear
  289.     cx = contents.text_size(SG_NA).width
  290.     self.contents.font.color = normal_color
  291.     self.contents.draw_text(4, 0, 120-cx-2, 32, $game_variables[SG_ID].to_s, 2)
  292.     self.contents.font.color = system_color
  293.     self.contents.draw_text(124-cx, 0, cx, 32, SG_NA, 2)
  294.   end
  295. end
  296. class Window_SGShopBuy < Window_ShopBuy
  297.   def draw_item(index)
  298.     item = @data[index]
  299.     # 获取物品所持数
  300.     case item
  301.     when RPG::Item
  302.       number = $game_party.item_number(item.id)
  303.     when RPG::Weapon
  304.       number = $game_party.weapon_number(item.id)
  305.     when RPG::Armor
  306.       number = $game_party.armor_number(item.id)
  307.     end
  308.     # 价格在所持金以下、并且所持数不是 99 的情况下为普通文字颜色
  309.     # 除此之外的情况设置为无效文字色
  310.     if item.sgprice <= $game_variables[SG_ID] and number < 99
  311.       self.contents.font.color = normal_color
  312.     else
  313.       self.contents.font.color = disabled_color
  314.     end
  315.     x = 4
  316.     y = index * 32
  317.     rect = Rect.new(x, y, self.width - 32, 32)
  318.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  319.     bitmap = RPG::Cache.icon(item.icon_name)
  320.     opacity = self.contents.font.color == normal_color ? 255 : 128
  321.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  322.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  323.     self.contents.draw_text(x + 240, y, 88, 32, item.sgprice.to_s, 2)
  324.   end
  325. end
  326. class Window_SGShopSell < Window_ShopSell
  327.   def draw_item(index)
  328.     item = @data[index]
  329.     case item
  330.     when RPG::Item
  331.       number = $game_party.item_number(item.id)
  332.     when RPG::Weapon
  333.       number = $game_party.weapon_number(item.id)
  334.     when RPG::Armor
  335.       number = $game_party.armor_number(item.id)
  336.     end
  337.     # 可以卖掉的显示为普通文字颜色、除此之外设置成无效文字颜色
  338.     if item.sgprice > 0
  339.       self.contents.font.color = normal_color
  340.     else
  341.       self.contents.font.color = disabled_color
  342.     end
  343.     x = 4 + index % 2 * (288 + 32)
  344.     y = index / 2 * 32
  345.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  346.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  347.     bitmap = RPG::Cache.icon(item.icon_name)
  348.     opacity = self.contents.font.color == normal_color ? 255 : 128
  349.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  350.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  351.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  352.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  353.   end
  354. end
  355. class Window_SGShopNumber < Window_ShopNumber
  356.   def refresh
  357.     self.contents.clear
  358.     draw_item_name(@item, 4, 96)
  359.     self.contents.font.color = normal_color
  360.     self.contents.draw_text(272, 96, 32, 32, "×")
  361.     self.contents.draw_text(308, 96, 24, 32, @number.to_s, 2)
  362.     self.cursor_rect.set(304, 96, 32, 32)
  363.     # 描绘合计价格和货币单位
  364.     domination = SG_NA
  365.     cx = contents.text_size(domination).width
  366.     total_price = @price * @number
  367.     self.contents.font.color = normal_color
  368.     self.contents.draw_text(4, 160, 328-cx-2, 32, total_price.to_s, 2)
  369.     self.contents.font.color = system_color
  370.     self.contents.draw_text(332-cx, 160, cx, 32, domination, 2)
  371.   end
  372. end
  373. class Scene_Map
  374.   def call_shop
  375.     # 清除商店调用标志
  376.     $game_temp.shop_calling = false
  377.     # 矫正主角姿势
  378.     $game_player.straighten
  379.     # 切换到商店画面
  380.     if $game_temp.sgshop_calling
  381.       $scene = Scene_SGShop.new
  382.     else
  383.       $scene = Scene_Shop.new
  384.     end
  385.     $game_temp.sgshop_calling = false
  386.   end
  387. end
  388. class Interpreter
  389.   def command_sgshop
  390.     $game_temp.sgshop_calling = true
  391.   end
  392. end
  393. class Game_Temp
  394.   attr_accessor:sgshop_calling
  395.   alias initialize_new initialize
  396.   def initialize
  397.     initialize_new
  398.     @sgshop_calling = false
  399.   end
  400. end
复制代码

用法如图:

在商店处理前加入脚本command_sgshop便是第二货币商店
不加便是普通商店
定义价格方法,在说明里面添加SGxxx,xxx为价格。即SG199就是价值199第二货币(你如果无聊的话,貌似可以设置成负数- -)

范例地址
http://rpg.blue/UP_PIC/200801/第二货币商店_96845380.rar






==========分割线·希望版主发布以上内容=============









顺便附上无聊版本,这个和普通版本最大的区别就是:没有占用游戏变量,貌似更正规一点
但却不能和站上默认的第二货币脚本以及魔法商店脚本关联,不适合新手使用(众人:其实区别也就几行,使你自己偷懒不愿意整合相关脚本。某冰:都说是无聊版本了,一般人用普通脚本就可以满足了- -)

  1. SG_NA = "灵魂"#第二货币的单位
  2. module RPG
  3.   class Weapon
  4.     def sgprice
  5.       arr = @description.split(/SG/)
  6.       return arr[1].to_i if arr[1] != nil
  7.       return 0
  8.     end
  9.     def description
  10.       arr = @description.split(/SG/)
  11.       return arr[0] if arr[1] != nil
  12.       return @description
  13.     end
  14.   end
  15.   class Armor
  16.     def sgprice
  17.       arr = @description.split(/SG/)
  18.       return arr[1].to_i if arr[1] != nil
  19.       return 0
  20.     end
  21.     def description
  22.       arr = @description.split(/SG/)
  23.       return arr[0] if arr[1] != nil
  24.       return @description
  25.     end
  26.   end
  27.   class Item
  28.     def sgprice
  29.       arr = @description.split(/SG/)
  30.       return arr[1].to_i if arr[1] != nil
  31.       return 0
  32.     end
  33.     def description
  34.       arr = @description.split(/SG/)
  35.       return arr[0] if arr[1] != nil
  36.       return @description
  37.     end
  38.   end
  39. end
  40. class Scene_SGShop < Scene_Shop
  41.   def main
  42.     # 生成帮助窗口
  43.     @help_window = Window_Help.new
  44.     # 生成指令窗口
  45.     @command_window = Window_ShopCommand.new
  46.     # 生成金钱窗口
  47.     @gold_window = Window_SGold.new
  48.     @gold_window.x = 480
  49.     @gold_window.y = 64
  50.     # 生成时间窗口
  51.     @dummy_window = Window_Base.new(0, 128, 640, 352)
  52.     # 生成购买窗口
  53.     @buy_window = Window_SGShopBuy.new($game_temp.shop_goods)
  54.     @buy_window.active = false
  55.     @buy_window.visible = false
  56.     @buy_window.help_window = @help_window
  57.     # 生成卖出窗口
  58.     @sell_window = Window_SGShopSell.new
  59.     @sell_window.active = false
  60.     @sell_window.visible = false
  61.     @sell_window.help_window = @help_window
  62.     # 生成数量输入窗口
  63.     @number_window = Window_ShopNumber.new
  64.     @number_window.active = false
  65.     @number_window.visible = false
  66.     # 生成状态窗口
  67.     @status_window = Window_ShopStatus.new
  68.     @status_window.visible = false
  69.     # 执行过渡
  70.     Graphics.transition
  71.     # 主循环
  72.     loop do
  73.       # 刷新游戏画面
  74.       Graphics.update
  75.       # 刷新输入信息
  76.       Input.update
  77.       # 刷新画面
  78.       update
  79.       # 如果画面切换的话就中断循环
  80.       if $scene != self
  81.         break
  82.       end
  83.     end
  84.     # 准备过渡
  85.     Graphics.freeze
  86.     # 释放窗口
  87.     @help_window.dispose
  88.     @command_window.dispose
  89.     @gold_window.dispose
  90.     @dummy_window.dispose
  91.     @buy_window.dispose
  92.     @sell_window.dispose
  93.     @number_window.dispose
  94.     @status_window.dispose
  95.   end
  96.   def update_buy
  97.     # 设置状态窗口的物品
  98.     @status_window.item = @buy_window.item
  99.     # 按下 B 键的情况下
  100.     if Input.trigger?(Input::B)
  101.       # 演奏取消 SE
  102.       $game_system.se_play($data_system.cancel_se)
  103.       # 窗口状态转向初期模式
  104.       @command_window.active = true
  105.       @dummy_window.visible = true
  106.       @buy_window.active = false
  107.       @buy_window.visible = false
  108.       @status_window.visible = false
  109.       @status_window.item = nil
  110.       # 删除帮助文本
  111.       @help_window.set_text("")
  112.       return
  113.     end
  114.     # 按下 C 键的情况下
  115.     if Input.trigger?(Input::C)
  116.       # 获取物品
  117.       @item = @buy_window.item
  118.       # 物品无效的情况下、或者价格在所持金以上的情况下
  119.       if @item == nil or @item.sgprice > $game_party.sgold
  120.         # 演奏冻结 SE
  121.         $game_system.se_play($data_system.buzzer_se)
  122.         return
  123.       end
  124.       # 获取物品所持数
  125.       case @item
  126.       when RPG::Item
  127.         number = $game_party.item_number(@item.id)
  128.       when RPG::Weapon
  129.         number = $game_party.weapon_number(@item.id)
  130.       when RPG::Armor
  131.         number = $game_party.armor_number(@item.id)
  132.       end
  133.       # 如果已经拥有了 99 个情况下
  134.       if number == 99
  135.         # 演奏冻结 SE
  136.         $game_system.se_play($data_system.buzzer_se)
  137.         return
  138.       end
  139.       # 演奏确定 SE
  140.       $game_system.se_play($data_system.decision_se)
  141.       # 计算可以最多购买的数量
  142.       max = @item.sgprice == 0 ? 99 : $game_party.sgold / @item.sgprice
  143.       max = [max, 99 - number].min
  144.       # 窗口状态转向数值输入模式
  145.       @buy_window.active = false
  146.       @buy_window.visible = false
  147.       @number_window.set(@item, max, @item.sgprice)
  148.       @number_window.active = true
  149.       @number_window.visible = true
  150.     end
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 画面更新 (卖出窗口激活的情况下)
  154.   #--------------------------------------------------------------------------
  155.   def update_sell
  156.     # 按下 B 键的情况下
  157.     if Input.trigger?(Input::B)
  158.       # 演奏取消 SE
  159.       $game_system.se_play($data_system.cancel_se)
  160.       # 窗口状态转向初期模式
  161.       @command_window.active = true
  162.       @dummy_window.visible = true
  163.       @sell_window.active = false
  164.       @sell_window.visible = false
  165.       @status_window.item = nil
  166.       # 删除帮助文本
  167.       @help_window.set_text("")
  168.       return
  169.     end
  170.     # 按下 C 键的情况下
  171.     if Input.trigger?(Input::C)
  172.       # 获取物品
  173.       @item = @sell_window.item
  174.       # 设置状态窗口的物品
  175.       @status_window.item = @item
  176.       # 物品无效的情况下、或者价格为 0 (不能卖出) 的情况下
  177.       if @item == nil or @item.sgprice == 0
  178.         # 演奏冻结 SE
  179.         $game_system.se_play($data_system.buzzer_se)
  180.         return
  181.       end
  182.       # 演奏确定 SE
  183.       $game_system.se_play($data_system.decision_se)
  184.       # 获取物品的所持数
  185.       case @item
  186.       when RPG::Item
  187.         number = $game_party.item_number(@item.id)
  188.       when RPG::Weapon
  189.         number = $game_party.weapon_number(@item.id)
  190.       when RPG::Armor
  191.         number = $game_party.armor_number(@item.id)
  192.       end
  193.       # 最大卖出个数 = 物品的所持数
  194.       max = number
  195.       # 窗口状态转向个数输入模式
  196.       @sell_window.active = false
  197.       @sell_window.visible = false
  198.       @number_window.set(@item, max, @item.sgprice / 2)
  199.       @number_window.active = true
  200.       @number_window.visible = true
  201.       @status_window.visible = true
  202.     end
  203.   end
  204.   def update_number
  205.     # 按下 B 键的情况下
  206.     if Input.trigger?(Input::B)
  207.       # 演奏取消 SE
  208.       $game_system.se_play($data_system.cancel_se)
  209.       # 设置个数输入窗口为不活动·非可视状态
  210.       @number_window.active = false
  211.       @number_window.visible = false
  212.       # 命令窗口光标位置分支
  213.       case @command_window.index
  214.       when 0  # 购买
  215.         # 窗口状态转向购买模式
  216.         @buy_window.active = true
  217.         @buy_window.visible = true
  218.       when 1  # 卖出
  219.         # 窗口状态转向卖出模式
  220.         @sell_window.active = true
  221.         @sell_window.visible = true
  222.         @status_window.visible = false
  223.       end
  224.       return
  225.     end
  226.     # 按下 C 键的情况下
  227.     if Input.trigger?(Input::C)
  228.       # 演奏商店 SE
  229.       $game_system.se_play($data_system.shop_se)
  230.       # 设置个数输入窗口为不活动·非可视状态
  231.       @number_window.active = false
  232.       @number_window.visible = false
  233.       # 命令窗口光标位置分支
  234.       case @command_window.index
  235.       when 0  # 购买
  236.         # 购买处理
  237.         $game_party.sgold -= (@number_window.number * @item.sgprice)
  238.         case @item
  239.         when RPG::Item
  240.           $game_party.gain_item(@item.id, @number_window.number)
  241.         when RPG::Weapon
  242.           $game_party.gain_weapon(@item.id, @number_window.number)
  243.         when RPG::Armor
  244.           $game_party.gain_armor(@item.id, @number_window.number)
  245.         end
  246.         # 刷新各窗口
  247.         @gold_window.refresh
  248.         @buy_window.refresh
  249.         @status_window.refresh
  250.         # 窗口状态转向购买模式
  251.         @buy_window.active = true
  252.         @buy_window.visible = true
  253.       when 1  # 卖出
  254.         # 卖出处理
  255.         $game_party.sgold += (@number_window.number * (@item.sgprice/2))
  256.         case @item
  257.         when RPG::Item
  258.           $game_party.lose_item(@item.id, @number_window.number)
  259.         when RPG::Weapon
  260.           $game_party.lose_weapon(@item.id, @number_window.number)
  261.         when RPG::Armor
  262.           $game_party.lose_armor(@item.id, @number_window.number)
  263.         end
  264.         # 刷新各窗口
  265.         @gold_window.refresh
  266.         @sell_window.refresh
  267.         @status_window.refresh
  268.         # 窗口状态转向卖出模式
  269.         @sell_window.active = true
  270.         @sell_window.visible = true
  271.         @status_window.visible = false
  272.       end
  273.       return
  274.     end
  275.   end
  276. end
  277. #=============
  278. #窗口
  279. #=============
  280. class Window_SGold < Window_Base
  281.   def initialize
  282.     super(0, 0, 160, 64)
  283.     self.contents = Bitmap.new(width - 32, height - 32)
  284.     refresh
  285.   end
  286.   def refresh
  287.     self.contents.clear
  288.     cx = contents.text_size(SG_NA).width
  289.     self.contents.font.color = normal_color
  290.     self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.sgold.to_s, 2)
  291.     self.contents.font.color = system_color
  292.     self.contents.draw_text(124-cx, 0, cx, 32, SG_NA, 2)
  293.   end
  294. end
  295. class Window_SGShopBuy < Window_ShopBuy
  296.   def draw_item(index)
  297.     item = @data[index]
  298.     # 获取物品所持数
  299.     case item
  300.     when RPG::Item
  301.       number = $game_party.item_number(item.id)
  302.     when RPG::Weapon
  303.       number = $game_party.weapon_number(item.id)
  304.     when RPG::Armor
  305.       number = $game_party.armor_number(item.id)
  306.     end
  307.     # 价格在所持金以下、并且所持数不是 99 的情况下为普通文字颜色
  308.     # 除此之外的情况设置为无效文字色
  309.     if item.sgprice <= $game_party.sgold and number < 99
  310.       self.contents.font.color = normal_color
  311.     else
  312.       self.contents.font.color = disabled_color
  313.     end
  314.     x = 4
  315.     y = index * 32
  316.     rect = Rect.new(x, y, self.width - 32, 32)
  317.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  318.     bitmap = RPG::Cache.icon(item.icon_name)
  319.     opacity = self.contents.font.color == normal_color ? 255 : 128
  320.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  321.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  322.     self.contents.draw_text(x + 240, y, 88, 32, item.sgprice.to_s, 2)
  323.   end
  324. end
  325. class Window_SGShopSell < Window_ShopSell
  326.   def draw_item(index)
  327.     item = @data[index]
  328.     case item
  329.     when RPG::Item
  330.       number = $game_party.item_number(item.id)
  331.     when RPG::Weapon
  332.       number = $game_party.weapon_number(item.id)
  333.     when RPG::Armor
  334.       number = $game_party.armor_number(item.id)
  335.     end
  336.     # 可以卖掉的显示为普通文字颜色、除此之外设置成无效文字颜色
  337.     if item.sgprice > 0
  338.       self.contents.font.color = normal_color
  339.     else
  340.       self.contents.font.color = disabled_color
  341.     end
  342.     x = 4 + index % 2 * (288 + 32)
  343.     y = index / 2 * 32
  344.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  345.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  346.     bitmap = RPG::Cache.icon(item.icon_name)
  347.     opacity = self.contents.font.color == normal_color ? 255 : 128
  348.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  349.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  350.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  351.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  352.   end
  353. end
  354. class Window_SGShopNumber < Window_ShopNumber
  355.   def refresh
  356.     self.contents.clear
  357.     draw_item_name(@item, 4, 96)
  358.     self.contents.font.color = normal_color
  359.     self.contents.draw_text(272, 96, 32, 32, "×")
  360.     self.contents.draw_text(308, 96, 24, 32, @number.to_s, 2)
  361.     self.cursor_rect.set(304, 96, 32, 32)
  362.     # 描绘合计价格和货币单位
  363.     domination = SG_NA
  364.     cx = contents.text_size(domination).width
  365.     total_price = @price * @number
  366.     self.contents.font.color = normal_color
  367.     self.contents.draw_text(4, 160, 328-cx-2, 32, total_price.to_s, 2)
  368.     self.contents.font.color = system_color
  369.     self.contents.draw_text(332-cx, 160, cx, 32, domination, 2)
  370.   end
  371. end
  372. class Scene_Map
  373.   def call_shop
  374.     # 清除商店调用标志
  375.     $game_temp.shop_calling = false
  376.     # 矫正主角姿势
  377.     $game_player.straighten
  378.     # 切换到商店画面
  379.     if $game_temp.sgshop_calling
  380.       $scene = Scene_SGShop.new
  381.     else
  382.       $scene = Scene_Shop.new
  383.     end
  384.     $game_temp.sgshop_calling = false
  385.   end
  386. end
  387. class Interpreter
  388.   def command_sgshop
  389.     $game_temp.sgshop_calling = true
  390.   end
  391.   def gain_sgold(n)
  392.     $game_party.gain_sgold(n)
  393.   end
  394.   def lose_sgold(n)
  395.     $game_party.lose_sgold(n)
  396.   end
  397. end
  398. class Game_Party
  399.   attr_accessor:sgold
  400.   alias initialize_new initialize
  401.   def initialize
  402.     initialize_new
  403.     @sgold = 0
  404.   end
  405.   def gain_sgold(n)
  406.     @sgold = [[@sgold + n, 0].max, 9999999].min
  407.   end
  408.   def lose_sgold(n)
  409.     gain_sgold(-n)
  410.   end
  411. end
  412. class Game_Temp
  413.   attr_accessor:sgshop_calling
  414.   alias initialize_new initialize
  415.   def initialize
  416.     initialize_new
  417.     @sgshop_calling = false
  418.   end
  419. end
复制代码

用法:
召唤商店部分相同,区别在于如何获取第二货币。通过事件内嵌脚本gain_sgold(n)或者lose_gold(n)实现
范例同
不常在线,有事PM
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-7-17
帖子
41
2
发表于 2008-7-19 06:14:37 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-12-31
帖子
107
3
发表于 2008-7-21 00:27:52 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-7-10
帖子
106
4
发表于 2008-7-21 00:59:46 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
705 小时
注册时间
2007-12-23
帖子
874
5
发表于 2008-7-22 04:51:26 | 只看该作者
虽然我打开范例不能,但是我也很喜欢这个脚本
买了正版RMMV的同学进来看一下,谢谢~
https://rpg.blue/thread-393237-1-1.html
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
74
在线时间
117 小时
注册时间
2007-8-5
帖子
479
6
发表于 2008-7-22 04:54:22 | 只看该作者
不知道能开三不

有个问题

你在哪里赶灵魂呢?
偶是 传说逍遥
回复 支持 反对

使用道具 举报

Lv1.梦旅人

冰王子

梦石
0
星屑
50
在线时间
34 小时
注册时间
2008-1-27
帖子
1875
7
 楼主| 发表于 2008-7-22 05:03:07 | 只看该作者
以下引用q2571875于2008-7-21 20:54:22的发言:

不知道能开三不

有个问题

你在哪里赶灵魂呢?


[本贴由作者于 2008-7-21 20:55:36 最后编辑]


二做出来了,三就很简单了

第二货币相关教程

http://rpg.blue/web/htm/news520.htm
http://rpg.blue/web/htm/news173.htm
http://rpg.blue/web/htm/news175.htm
不常在线,有事PM
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-6-30
帖子
159
8
发表于 2008-8-2 01:07:13 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

冰王子

梦石
0
星屑
50
在线时间
34 小时
注册时间
2008-1-27
帖子
1875
9
 楼主| 发表于 2008-8-2 06:29:39 | 只看该作者
  1. TG_ID = 100#存储第三货币的变量
  2. TG_NA = "灵魂"#第三货币的单位
  3. module RPG
  4.   class Weapon
  5.     def tgprice
  6.       arr = @description.split(/TG/)
  7.       return arr[1].to_i if arr[1] != nil
  8.       return 0
  9.     end
  10.     def description
  11.       arr = @description.split(/TG/)
  12.       return arr[0] if arr[1] != nil
  13.       return @description
  14.     end
  15.   end
  16.   class Armor
  17.     def tgprice
  18.       arr = @description.split(/TG/)
  19.       return arr[1].to_i if arr[1] != nil
  20.       return 0
  21.     end
  22.     def description
  23.       arr = @description.split(/TG/)
  24.       return arr[0] if arr[1] != nil
  25.       return @description
  26.     end
  27.   end
  28.   class Item
  29.     def tgprice
  30.       arr = @description.split(/TG/)
  31.       return arr[1].to_i if arr[1] != nil
  32.       return 0
  33.     end
  34.     def description
  35.       arr = @description.split(/TG/)
  36.       return arr[0] if arr[1] != nil
  37.       return @description
  38.     end
  39.   end
  40. end
  41. class Scene_TGShop < Scene_Shop
  42.   def main
  43.     # 生成帮助窗口
  44.     @help_window = Window_Help.new
  45.     # 生成指令窗口
  46.     @command_window = Window_ShopCommand.new
  47.     # 生成金钱窗口
  48.     @gold_window = Window_TGold.new
  49.     @gold_window.x = 480
  50.     @gold_window.y = 64
  51.     # 生成时间窗口
  52.     @dummy_window = Window_Base.new(0, 128, 640, 352)
  53.     # 生成购买窗口
  54.     @buy_window = Window_TGShopBuy.new($game_temp.shop_goods)
  55.     @buy_window.active = false
  56.     @buy_window.visible = false
  57.     @buy_window.help_window = @help_window
  58.     # 生成卖出窗口
  59.     @sell_window = Window_TGShopSell.new
  60.     @sell_window.active = false
  61.     @sell_window.visible = false
  62.     @sell_window.help_window = @help_window
  63.     # 生成数量输入窗口
  64.     @number_window = Window_ShopNumber.new
  65.     @number_window.active = false
  66.     @number_window.visible = false
  67.     # 生成状态窗口
  68.     @status_window = Window_ShopStatus.new
  69.     @status_window.visible = false
  70.     # 执行过渡
  71.     Graphics.transition
  72.     # 主循环
  73.     loop do
  74.       # 刷新游戏画面
  75.       Graphics.update
  76.       # 刷新输入信息
  77.       Input.update
  78.       # 刷新画面
  79.       update
  80.       # 如果画面切换的话就中断循环
  81.       if $scene != self
  82.         break
  83.       end
  84.     end
  85.     # 准备过渡
  86.     Graphics.freeze
  87.     # 释放窗口
  88.     @help_window.dispose
  89.     @command_window.dispose
  90.     @gold_window.dispose
  91.     @dummy_window.dispose
  92.     @buy_window.dispose
  93.     @sell_window.dispose
  94.     @number_window.dispose
  95.     @status_window.dispose
  96.   end
  97.   def update_buy
  98.     # 设置状态窗口的物品
  99.     @status_window.item = @buy_window.item
  100.     # 按下 B 键的情况下
  101.     if Input.trigger?(Input::B)
  102.       # 演奏取消 SE
  103.       $game_system.se_play($data_system.cancel_se)
  104.       # 窗口状态转向初期模式
  105.       @command_window.active = true
  106.       @dummy_window.visible = true
  107.       @buy_window.active = false
  108.       @buy_window.visible = false
  109.       @status_window.visible = false
  110.       @status_window.item = nil
  111.       # 删除帮助文本
  112.       @help_window.set_text("")
  113.       return
  114.     end
  115.     # 按下 C 键的情况下
  116.     if Input.trigger?(Input::C)
  117.       # 获取物品
  118.       @item = @buy_window.item
  119.       # 物品无效的情况下、或者价格在所持金以上的情况下
  120.       if @item == nil or @item.tgprice > $game_variables[TG_ID]
  121.         # 演奏冻结 SE
  122.         $game_system.se_play($data_system.buzzer_se)
  123.         return
  124.       end
  125.       # 获取物品所持数
  126.       case @item
  127.       when RPG::Item
  128.         number = $game_party.item_number(@item.id)
  129.       when RPG::Weapon
  130.         number = $game_party.weapon_number(@item.id)
  131.       when RPG::Armor
  132.         number = $game_party.armor_number(@item.id)
  133.       end
  134.       # 如果已经拥有了 99 个情况下
  135.       if number == 99
  136.         # 演奏冻结 SE
  137.         $game_system.se_play($data_system.buzzer_se)
  138.         return
  139.       end
  140.       # 演奏确定 SE
  141.       $game_system.se_play($data_system.decision_se)
  142.       # 计算可以最多购买的数量
  143.       max = @item.tgprice == 0 ? 99 : $game_variables[TG_ID] / @item.tgprice
  144.       max = [max, 99 - number].min
  145.       # 窗口状态转向数值输入模式
  146.       @buy_window.active = false
  147.       @buy_window.visible = false
  148.       @number_window.set(@item, max, @item.tgprice)
  149.       @number_window.active = true
  150.       @number_window.visible = true
  151.     end
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● 画面更新 (卖出窗口激活的情况下)
  155.   #--------------------------------------------------------------------------
  156.   def update_sell
  157.     # 按下 B 键的情况下
  158.     if Input.trigger?(Input::B)
  159.       # 演奏取消 SE
  160.       $game_system.se_play($data_system.cancel_se)
  161.       # 窗口状态转向初期模式
  162.       @command_window.active = true
  163.       @dummy_window.visible = true
  164.       @sell_window.active = false
  165.       @sell_window.visible = false
  166.       @status_window.item = nil
  167.       # 删除帮助文本
  168.       @help_window.set_text("")
  169.       return
  170.     end
  171.     # 按下 C 键的情况下
  172.     if Input.trigger?(Input::C)
  173.       # 获取物品
  174.       @item = @sell_window.item
  175.       # 设置状态窗口的物品
  176.       @status_window.item = @item
  177.       # 物品无效的情况下、或者价格为 0 (不能卖出) 的情况下
  178.       if @item == nil or @item.tgprice == 0
  179.         # 演奏冻结 SE
  180.         $game_system.se_play($data_system.buzzer_se)
  181.         return
  182.       end
  183.       # 演奏确定 SE
  184.       $game_system.se_play($data_system.decision_se)
  185.       # 获取物品的所持数
  186.       case @item
  187.       when RPG::Item
  188.         number = $game_party.item_number(@item.id)
  189.       when RPG::Weapon
  190.         number = $game_party.weapon_number(@item.id)
  191.       when RPG::Armor
  192.         number = $game_party.armor_number(@item.id)
  193.       end
  194.       # 最大卖出个数 = 物品的所持数
  195.       max = number
  196.       # 窗口状态转向个数输入模式
  197.       @sell_window.active = false
  198.       @sell_window.visible = false
  199.       @number_window.set(@item, max, @item.tgprice / 2)
  200.       @number_window.active = true
  201.       @number_window.visible = true
  202.       @status_window.visible = true
  203.     end
  204.   end
  205.   def update_number
  206.     # 按下 B 键的情况下
  207.     if Input.trigger?(Input::B)
  208.       # 演奏取消 SE
  209.       $game_system.se_play($data_system.cancel_se)
  210.       # 设置个数输入窗口为不活动·非可视状态
  211.       @number_window.active = false
  212.       @number_window.visible = false
  213.       # 命令窗口光标位置分支
  214.       case @command_window.index
  215.       when 0  # 购买
  216.         # 窗口状态转向购买模式
  217.         @buy_window.active = true
  218.         @buy_window.visible = true
  219.       when 1  # 卖出
  220.         # 窗口状态转向卖出模式
  221.         @sell_window.active = true
  222.         @sell_window.visible = true
  223.         @status_window.visible = false
  224.       end
  225.       return
  226.     end
  227.     # 按下 C 键的情况下
  228.     if Input.trigger?(Input::C)
  229.       # 演奏商店 SE
  230.       $game_system.se_play($data_system.shop_se)
  231.       # 设置个数输入窗口为不活动·非可视状态
  232.       @number_window.active = false
  233.       @number_window.visible = false
  234.       # 命令窗口光标位置分支
  235.       case @command_window.index
  236.       when 0  # 购买
  237.         # 购买处理
  238.         $game_variables[TG_ID] -= (@number_window.number * @item.tgprice)
  239.         case @item
  240.         when RPG::Item
  241.           $game_party.gain_item(@item.id, @number_window.number)
  242.         when RPG::Weapon
  243.           $game_party.gain_weapon(@item.id, @number_window.number)
  244.         when RPG::Armor
  245.           $game_party.gain_armor(@item.id, @number_window.number)
  246.         end
  247.         # 刷新各窗口
  248.         @gold_window.refresh
  249.         @buy_window.refresh
  250.         @status_window.refresh
  251.         # 窗口状态转向购买模式
  252.         @buy_window.active = true
  253.         @buy_window.visible = true
  254.       when 1  # 卖出
  255.         # 卖出处理
  256.         $game_variables[TG_ID] += (@number_window.number * (@item.tgprice/2))
  257.         case @item
  258.         when RPG::Item
  259.           $game_party.lose_item(@item.id, @number_window.number)
  260.         when RPG::Weapon
  261.           $game_party.lose_weapon(@item.id, @number_window.number)
  262.         when RPG::Armor
  263.           $game_party.lose_armor(@item.id, @number_window.number)
  264.         end
  265.         # 刷新各窗口
  266.         @gold_window.refresh
  267.         @sell_window.refresh
  268.         @status_window.refresh
  269.         # 窗口状态转向卖出模式
  270.         @sell_window.active = true
  271.         @sell_window.visible = true
  272.         @status_window.visible = false
  273.       end
  274.       return
  275.     end
  276.   end
  277. end
  278. #=============
  279. #窗口
  280. #=============
  281. class Window_TGold < Window_Base
  282.   def initialize
  283.     super(0, 0, 160, 64)
  284.     self.contents = Bitmap.new(width - 32, height - 32)
  285.     refresh
  286.   end
  287.   def refresh
  288.     self.contents.clear
  289.     cx = contents.text_size(TG_NA).width
  290.     self.contents.font.color = normal_color
  291.     self.contents.draw_text(4, 0, 120-cx-2, 32, $game_variables[TG_ID].to_s, 2)
  292.     self.contents.font.color = system_color
  293.     self.contents.draw_text(124-cx, 0, cx, 32, TG_NA, 2)
  294.   end
  295. end
  296. class Window_TGShopBuy < Window_ShopBuy
  297.   def draw_item(index)
  298.     item = @data[index]
  299.     # 获取物品所持数
  300.     case item
  301.     when RPG::Item
  302.       number = $game_party.item_number(item.id)
  303.     when RPG::Weapon
  304.       number = $game_party.weapon_number(item.id)
  305.     when RPG::Armor
  306.       number = $game_party.armor_number(item.id)
  307.     end
  308.     # 价格在所持金以下、并且所持数不是 99 的情况下为普通文字颜色
  309.     # 除此之外的情况设置为无效文字色
  310.     if item.tgprice <= $game_variables[TG_ID] and number < 99
  311.       self.contents.font.color = normal_color
  312.     else
  313.       self.contents.font.color = disabled_color
  314.     end
  315.     x = 4
  316.     y = index * 32
  317.     rect = Rect.new(x, y, self.width - 32, 32)
  318.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  319.     bitmap = RPG::Cache.icon(item.icon_name)
  320.     opacity = self.contents.font.color == normal_color ? 255 : 128
  321.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  322.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  323.     self.contents.draw_text(x + 240, y, 88, 32, item.tgprice.to_s, 2)
  324.   end
  325. end
  326. class Window_TGShopSell < Window_ShopSell
  327.   def draw_item(index)
  328.     item = @data[index]
  329.     case item
  330.     when RPG::Item
  331.       number = $game_party.item_number(item.id)
  332.     when RPG::Weapon
  333.       number = $game_party.weapon_number(item.id)
  334.     when RPG::Armor
  335.       number = $game_party.armor_number(item.id)
  336.     end
  337.     # 可以卖掉的显示为普通文字颜色、除此之外设置成无效文字颜色
  338.     if item.tgprice > 0
  339.       self.contents.font.color = normal_color
  340.     else
  341.       self.contents.font.color = disabled_color
  342.     end
  343.     x = 4 + index % 2 * (288 + 32)
  344.     y = index / 2 * 32
  345.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  346.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  347.     bitmap = RPG::Cache.icon(item.icon_name)
  348.     opacity = self.contents.font.color == normal_color ? 255 : 128
  349.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  350.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  351.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  352.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  353.   end
  354. end
  355. class Window_TGShopNumber < Window_ShopNumber
  356.   def refresh
  357.     self.contents.clear
  358.     draw_item_name(@item, 4, 96)
  359.     self.contents.font.color = normal_color
  360.     self.contents.draw_text(272, 96, 32, 32, "×")
  361.     self.contents.draw_text(308, 96, 24, 32, @number.to_s, 2)
  362.     self.cursor_rect.set(304, 96, 32, 32)
  363.     # 描绘合计价格和货币单位
  364.     domination = TG_NA
  365.     cx = contents.text_size(domination).width
  366.     total_price = @price * @number
  367.     self.contents.font.color = normal_color
  368.     self.contents.draw_text(4, 160, 328-cx-2, 32, total_price.to_s, 2)
  369.     self.contents.font.color = system_color
  370.     self.contents.draw_text(332-cx, 160, cx, 32, domination, 2)
  371.   end
  372. end
  373. class Scene_Map
  374.   def call_shop
  375.     # 清除商店调用标志
  376.     $game_temp.shop_calling = false
  377.     # 矫正主角姿势
  378.     $game_player.straighten
  379.     # 切换到商店画面
  380.     if $game_temp.tgshop_calling
  381.       $scene = Scene_TGShop.new
  382.     else
  383.       $scene = Scene_Shop.new
  384.     end
  385.     $game_temp.tgshop_calling = false
  386.   end
  387. end
  388. class Interpreter
  389.   def command_tgshop
  390.     $game_temp.tgshop_calling = true
  391.   end
  392. end
  393. class Game_Temp
  394.   attr_accessor:tgshop_calling
  395.   alias initialize_new initialize
  396.   def initialize
  397.     initialize_new
  398.     @tgshop_calling = false
  399.   end
  400. end
复制代码


用法类似
在商店处理前加入脚本command_tgshop便是第三货币商店
不加便是普通商店
定义价格方法,在说明里面添加TGxxx,xxx为价格。即TG199就是价值199第三货币(你如果无聊的话,貌似可以设置成负数- -)
不常在线,有事PM
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-6-30
帖子
159
10
发表于 2008-8-2 19:57:00 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-14 18:07

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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