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

Project1

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

[已经过期] 怎么设置只能卖出不能买入的商店?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
88 小时
注册时间
2013-12-5
帖子
442
跳转到指定楼层
1
发表于 2014-9-20 17:19:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
VX默认没有这个功能请问怎么样帮助实现?

长名公主与妖精之剑二代公测进行中 欢迎加入测试群372588926  先睹为快
百度 长名公主与妖精之剑吧招募吧主 快乐星球核爆启示录拍摄组
了解更多新RM游戏,游戏制作请加入66RPG支援群:113622890

Lv2.观梦者

梦石
0
星屑
431
在线时间
403 小时
注册时间
2014-9-6
帖子
1231
2
发表于 2014-9-20 19:05:10 | 只看该作者
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================  
  4. class Scene_Shop
  5.   # --------------------------
  6.   def main
  7.     @help_window = Window_Help.new
  8.     @command_window = Window_ShopCommand.new
  9.     @gold_window = Window_Gold.new
  10.     @gold_window.x = 480
  11.     @gold_window.y = 64
  12.     @dummy_window = Window_Base.new(0, 128, 640, 352)
  13.     @buy_window = Window_ShopBuy.new($game_temp.shop_goods)
  14.     @buy_window.active = false
  15.     @buy_window.visible = false
  16.     @buy_window.help_window = @help_window
  17.     @sell_window = Window_ShopSell.new
  18.     @sell_window.active = false
  19.     @sell_window.visible = false
  20.     @sell_window.help_window = @help_window
  21.     @number_window = Window_ShopNumber.new
  22.     @number_window.active = false
  23.     @number_window.visible = false
  24.     @status_window = Window_ShopStatus.new
  25.     @status_window.visible = false
  26.     if $game_temp.shop_type == 1
  27.       @command_window.index = 0
  28.       @command_window.active = false
  29.       @dummy_window.visible = false
  30.       @buy_window.active = true
  31.       @buy_window.visible = true
  32.       @buy_window.refresh
  33.       @status_window.visible = true
  34.     end
  35.     if $game_temp.shop_type == 2
  36.       @command_window.index = 1
  37.       @command_window.active = false
  38.       @dummy_window.visible = false
  39.       @sell_window.active = true
  40.       @sell_window.visible = true
  41.       @sell_window.refresh
  42.     end
  43.     Graphics.transition
  44.     loop do
  45.       Graphics.update
  46.       Input.update
  47.       update
  48.       if $scene != self
  49.         break
  50.       end
  51.     end
  52.     Graphics.freeze
  53.     @status_window.item = nil
  54.     @status_window.refresh
  55.     @help_window.dispose
  56.     @command_window.dispose
  57.     @gold_window.dispose
  58.     @dummy_window.dispose
  59.     @buy_window.dispose
  60.     @sell_window.dispose
  61.     @number_window.dispose
  62.     @status_window.dispose
  63.     $game_temp.shop_type = 0
  64.   end
  65.   # --------------------------
  66.   def update
  67.     @help_window.update
  68.     @command_window.update
  69.     @gold_window.update
  70.     @dummy_window.update
  71.     @buy_window.update
  72.     @sell_window.update
  73.     @number_window.update
  74.     @status_window.update
  75.     if @command_window.active
  76.       update_command
  77.       return
  78.     end
  79.     if @buy_window.active
  80.       update_buy
  81.       return
  82.     end
  83.     if @sell_window.active
  84.       update_sell
  85.       return
  86.     end
  87.     if @number_window.active
  88.       update_number
  89.       return
  90.     end
  91.   end
  92.   # --------------------------
  93.   def update_command
  94.     if Input.trigger?(Input::B)
  95.       $game_system.se_play($data_system.cancel_se)
  96.       $scene = Scene_Map.new
  97.       return
  98.     end
  99.     if Input.trigger?(Input::C)
  100.       case @command_window.index
  101.       when 0
  102.         $game_system.se_play($data_system.decision_se)
  103.         @command_window.active = false
  104.         @dummy_window.visible = false
  105.         @buy_window.active = true
  106.         @buy_window.visible = true
  107.         @buy_window.refresh
  108.         @status_window.visible = true
  109.       when 1
  110.         $game_system.se_play($data_system.decision_se)
  111.         @command_window.active = false
  112.         @dummy_window.visible = false
  113.         @sell_window.active = true
  114.         @sell_window.visible = true
  115.         @sell_window.refresh
  116.       when 2
  117.         $game_system.se_play($data_system.decision_se)
  118.         $scene = Scene_Map.new
  119.       end
  120.       return
  121.     end
  122.   end
  123.   # --------------------------
  124.   def update_buy
  125.     @status_window.item = @buy_window.item
  126.     if Input.trigger?(Input::B)
  127.       if $game_temp.shop_type == 1
  128.          $game_system.se_play($data_system.cancel_se)
  129.          $scene = Scene_Map.new
  130.       else
  131.       $game_system.se_play($data_system.cancel_se)
  132.       @command_window.active = true
  133.       @dummy_window.visible = true
  134.       @buy_window.active = false
  135.       @buy_window.visible = false
  136.       @status_window.visible = false
  137.       @status_window.item = nil
  138.       @help_window.set_text("")
  139.       end
  140.       return
  141.     end
  142.     if Input.trigger?(Input::C)
  143.       @item = @buy_window.item
  144.       if @item == nil or @item.price > $game_party.gold
  145.         $game_system.se_play($data_system.buzzer_se)
  146.         return
  147.       end
  148.       case @item
  149.       when RPG::Item
  150.         number = $game_party.item_number(@item.id)
  151.       when RPG::Weapon
  152.         number = $game_party.weapon_number(@item.id)
  153.       when RPG::Armor
  154.         number = $game_party.armor_number(@item.id)
  155.       end
  156.       if number == 99
  157.         $game_system.se_play($data_system.buzzer_se)
  158.         return
  159.       end
  160.       $game_system.se_play($data_system.decision_se)
  161.       max = @item.price == 0 ? 99 : $game_party.gold / @item.price
  162.       max = [max, 99 - number].min
  163.       @buy_window.active = false
  164.       @buy_window.visible = false
  165.       @number_window.set(@item, max, @item.price)
  166.       @number_window.active = true
  167.       @number_window.visible = true
  168.     end
  169.   end
  170.   # --------------------------
  171.   def update_sell
  172.     if Input.trigger?(Input::B)
  173.       if $game_temp.shop_type == 2
  174.          $game_system.se_play($data_system.cancel_se)
  175.          $scene = Scene_Map.new
  176.       else
  177.       $game_system.se_play($data_system.cancel_se)
  178.       @command_window.active = true
  179.       @dummy_window.visible = true
  180.       @sell_window.active = false
  181.       @sell_window.visible = false
  182.       @status_window.item = nil
  183.       @help_window.set_text("")
  184.       return
  185.       end
  186.     end
  187.     if Input.trigger?(Input::C)
  188.       @item = @sell_window.item
  189.       @status_window.item = @item
  190.       if @item == nil or @item.price == 0
  191.         $game_system.se_play($data_system.buzzer_se)
  192.         return
  193.       end
  194.       $game_system.se_play($data_system.decision_se)
  195.       case @item
  196.       when RPG::Item
  197.         number = $game_party.item_number(@item.id)
  198.       when RPG::Weapon
  199.         number = $game_party.weapon_number(@item.id)
  200.       when RPG::Armor
  201.         number = $game_party.armor_number(@item.id)
  202.       end
  203.       max = number
  204.       @sell_window.active = false
  205.       @sell_window.visible = false
  206.       @number_window.set(@item, max, @item.price / 2)
  207.       @number_window.active = true
  208.       @number_window.visible = true
  209.       @status_window.visible = true
  210.     end
  211.   end
  212.   # --------------------------
  213.   def update_number
  214.     if Input.trigger?(Input::B)
  215.       $game_system.se_play($data_system.cancel_se)
  216.       @number_window.active = false
  217.       @number_window.visible = false
  218.       case @command_window.index
  219.       when 0
  220.         @buy_window.active = true
  221.         @buy_window.visible = true
  222.       when 1
  223.         @sell_window.active = true
  224.         @sell_window.visible = true
  225.         @status_window.visible = false
  226.       end
  227.       return
  228.     end
  229.     if Input.trigger?(Input::C)
  230.       $game_system.se_play($data_system.shop_se)
  231.       @number_window.active = false
  232.       @number_window.visible = false
  233.       case @command_window.index
  234.       when 0
  235.         $game_party.lose_gold(@number_window.number * @item.price)
  236.         case @item
  237.         when RPG::Item
  238.           $game_party.gain_item(@item.id, @number_window.number)
  239.         when RPG::Weapon
  240.           $game_party.gain_weapon(@item.id, @number_window.number)
  241.         when RPG::Armor
  242.           $game_party.gain_armor(@item.id, @number_window.number)
  243.         end
  244.         @gold_window.refresh
  245.         @buy_window.refresh
  246.         @status_window.refresh
  247.         @buy_window.active = true
  248.         @buy_window.visible = true
  249.       when 1
  250.         $game_party.gain_gold(@number_window.number * (@item.price / 2))
  251.         case @item
  252.         when RPG::Item
  253.           $game_party.lose_item(@item.id, @number_window.number)
  254.         when RPG::Weapon
  255.           $game_party.lose_weapon(@item.id, @number_window.number)
  256.         when RPG::Armor
  257.           $game_party.lose_armor(@item.id, @number_window.number)
  258.         end
  259.         @gold_window.refresh
  260.         @sell_window.refresh
  261.         @status_window.refresh
  262.         @sell_window.active = true
  263.         @sell_window.visible = true
  264.         @status_window.visible = false
  265.       end
  266.       return
  267.     end
  268.   end
  269. end
  270. class Window_ShopCommand < Window_Selectable
  271.   # ----------------------------------------
  272.   def initialize
  273.     super(0, 64, 480, 64)
  274.     self.contents = Bitmap.new(width - 32, height - 32)
  275.     @item_max = 3
  276.     @column_max = 3
  277.     @commands = ["购买", "卖出", "离开"]
  278.     self.contents.font.name = "黑体"
  279.     self.contents.font.size = 24
  280.     refresh
  281.     self.index = 0
  282.   end
  283.   # ----------------------------------------
  284.   def refresh
  285.     self.contents.clear
  286.     if $game_temp.shop_type == 0
  287.       for i in 0...@item_max
  288.       draw_item(i)
  289.       end
  290.     end
  291.     if $game_temp.shop_type == 1
  292.       self.contents.draw_text(4, 0, 324, 32, "这个商店里只能购买,不能卖出")
  293.       self.index = -1
  294.       update_cursor_rect
  295.     end
  296.     if $game_temp.shop_type == 2
  297.       self.contents.draw_text(4, 0, 324, 32, "这个商店里只能卖出,不能购买")
  298.       self.index = -1
  299.       update_cursor_rect
  300.     end
  301.   end
  302.   # ----------------------------------------
  303.   def draw_item(index)
  304.     x = 4 + index * 160
  305.     self.contents.draw_text(x, 0, 128, 32, @commands[index])
  306.   end
  307.   # ----------------------------------------
  308.   def update_cursor_rect
  309.     if $game_temp.shop_type == 0
  310.       super
  311.     end
  312.     if $game_temp.shop_type == 1 || $game_temp.shop_type == 2
  313.       self.cursor_rect.empty
  314.     end
  315.   end
  316. end
  317. class Game_Temp
  318.   # ----------------------------------------
  319.   attr_accessor :shop_type
  320.   alias ini initialize
  321.   def initialize
  322.     ini
  323.     @shop_type = 0
  324.   end
  325. end
  326. #==============================================================================
  327. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  328. #==============================================================================



XP的,不知道有沒有用?
大家好,我今年24岁,是学生
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv3.寻梦者 (禁止访问)

梦石
0
星屑
1340
在线时间
807 小时
注册时间
2012-10-19
帖子
588
3
发表于 2014-9-20 20:22:45 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
796
在线时间
72 小时
注册时间
2023-12-26
帖子
105
4
发表于 2024-3-17 15:54:52 | 只看该作者
我也需要这个,你这个脚本会出错,我要工程
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 05:34

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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