Project1

标题: RMXP如何像RMVX那样可以设置某个商店只能购买不能出售? [打印本页]

作者: daiboy12    时间: 2010-7-25 16:58
标题: RMXP如何像RMVX那样可以设置某个商店只能购买不能出售?
想做个餐厅,但能在餐厅出售东西不是很怪?所以想找个脚本可以做到商店不允许出售的。

记得以前好像看过但现在找不到了。望各位帮一下忙……!
作者: 冰舞蝶恋    时间: 2010-7-25 17:03
似乎...只有脚本行得通?
作者: daiboy12    时间: 2010-7-25 17:05
应该是了。自己有点思路,不过因为还是新手所以不会改。
就是设置另一种商店,把出售什么的章节删除掉,一点开就是购买的界面。
作者: kenchenrong    时间: 2010-7-25 17:22
提示: 作者被禁止或删除 内容自动屏蔽
作者: 逸豫    时间: 2010-7-25 22:17
  1. class Game_System
  2.   attr :shop_type,true
  3.   alias db initialize
  4.   def initialize
  5.     @shop_type = 0
  6.     db
  7.   end
  8. end
  9. class Window_ShopCommand
  10.   def draw_item(index)
  11.     if $game_system.shop_type == 1 and index == 0
  12.       self.contents.font.color = disabled_color
  13.     end
  14.     if $game_system.shop_type == 2 and index == 1
  15.       self.contents.font.color = disabled_color
  16.     end
  17.     x = 4 + index * 160
  18.     self.contents.draw_text(x, 0, 128, 32, @commands[index])
  19.     self.contents.font.color = normal_color
  20.   end
  21. end
  22. class Scene_Shop
  23.   alias daiboy_update_command update_command
  24.   def update_command
  25.     if Input.trigger?(Input::C)
  26.     # 命令窗口光标位置分支
  27.       case @command_window.index
  28.       when 0  # 购买
  29.         $game_system.se_play($data_system.buzzer_se) if $game_system.shop_type == 1
  30.         return if $game_system.shop_type == 1
  31.       when 1  # 卖出
  32.         $game_system.se_play($data_system.buzzer_se) if $game_system.shop_type == 2
  33.         return if $game_system.shop_type == 2
  34.       end
  35.     end
  36.     daiboy_update_command
  37.   end
  38. end
复制代码
使用商店处理之前插入脚本 $game_system.shop_type = X
X = 0 买卖均可
X = 1 仅卖
X = 2 仅买
作者: daiboy12    时间: 2010-7-26 09:30
喔 谢谢楼上的前辈。我搜索“出售”找不到,后来搜索一下“卖出”就找到了…………
作者: 789456qwe    时间: 2013-2-5 21:42
逸豫 发表于 2010-7-25 22:17
使用商店处理之前插入脚本 $game_system.shop_type = X
X = 0 买卖均可
X = 1 仅卖

怎么修改?




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