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

Project1

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

[已经过期] xp整合系统(20项脚本)中的16魔法商店的问题

[复制链接]

Lv3.寻梦者

梦石
3
星屑
261
在线时间
223 小时
注册时间
2012-8-18
帖子
143
跳转到指定楼层
1
发表于 2015-3-5 22:24:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  我用了这个脚本,发现有一个不足,就是所有人都可以学习任意技能
而我觉得应该限定一个技能只能让对应的职业学习
这样就不会有战士学魔法,魔法师学剑术了
虽然可以在游戏中告诉玩家按职业学习技能,但总觉得像是有漏洞……
请问怎么解决?
脚本
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5.  
  6. #==============================================================================
  7.  
  8. #——以下是一些自定义的内容
  9.  
  10. $mShop_use_1 = "魔法灵感"    #——这项是购买魔法特技的货币的名称,如“灵魄”、“金钱”
  11.  
  12. $mShop_use_2 = "点"  #——这项是购买魔法特技的货币单位,如“点”、“¥”
  13.  
  14. $mShop_use_variable = 7  #——这项是购买魔法特技时消耗的变量编号,如果=0 则是消耗金钱
  15.  
  16. $mShop_Window_Opacity = 200  #——这项是窗口透明度
  17.  
  18. #==============================================================================
  19. # ■ Window_MGold
  20. #------------------------------------------------------------------------------
  21. #  显示金钱的窗口。
  22. #==============================================================================
  23. class Window_MGold < Window_Base
  24.   #--------------------------------------------------------------------------
  25.   # ● 初始化窗口
  26.   #--------------------------------------------------------------------------
  27.   def initialize
  28.     super(0, 0, 272, 64)
  29.     self.contents = Bitmap.new(width - 32, height - 32)
  30.     refresh
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 刷新
  34.   #--------------------------------------------------------------------------
  35.   def refresh
  36.     self.contents.clear
  37.     self.contents.font.color = system_color
  38.     self.contents.draw_text(0, 0 , 240,32 ,$mShop_use_1)
  39.     self.contents.font.color = normal_color
  40.     self.contents.draw_text(0, 0, 240-contents.text_size($mShop_use_2).width-6, 32, $mShop_gold.to_s, 2)
  41.     self.contents.font.color = system_color
  42.     self.contents.draw_text(0, 0, 240, 32, $mShop_use_2, 2)
  43.   end
  44. end
  45. #==============================================================================
  46. # ■ Scene_MShop
  47. #------------------------------------------------------------------------------
  48. #  处理特技商店画面的类。
  49. #==============================================================================
  50. class Scene_MShop
  51.   #--------------------------------------------------------------------------
  52.   # ● 初始化
  53.   #--------------------------------------------------------------------------
  54.   def initialize(id)
  55.     @id = id
  56.   end  
  57.   #--------------------------------------------------------------------------
  58.   # ● 主处理
  59.   #--------------------------------------------------------------------------
  60.   def main
  61.     screen = Spriteset_Map.new
  62.     if $mShop_use_variable == 0
  63.       $mShop_gold = $game_party.gold
  64.     else
  65.       $mShop_gold = $game_variables[$mShop_use_variable]
  66.     end
  67.     # 生成帮助窗口
  68.     @help_window = Window_Help.new
  69.     @help_window.opacity = $mShop_Window_Opacity
  70.     # 生成金钱窗口
  71.     @gold_window = Window_MGold.new
  72.     @gold_window.x = 368
  73.     @gold_window.y = 416
  74.     @gold_window.opacity = $mShop_Window_Opacity
  75.     # 生成购买窗口
  76.     @buy_window = Window_MShopBuy.new(@id)
  77.     @buy_window.active = true
  78.     @buy_window.visible = true
  79.     @buy_window.help_window = @help_window
  80.     @buy_window.opacity = $mShop_Window_Opacity
  81.     # 生成状态窗口
  82.     @status_window = Window_MShopStatus.new
  83.     @status_window.visible = true
  84.     @status_window.active = false
  85.     @status_window.opacity = $mShop_Window_Opacity
  86.     # 执行过渡
  87.     Graphics.transition
  88.     # 主循环
  89.     loop do
  90.       # 刷新游戏画面
  91.       Graphics.update
  92.       # 刷新输入信息
  93.       Input.update
  94.       # 刷新画面
  95.       update
  96.       # 如果画面切换的话就中断循环
  97.       if $scene != self
  98.         break
  99.       end
  100.     end
  101.     # 准备过渡
  102.     Graphics.freeze
  103.     # 释放窗口
  104.     @help_window.dispose
  105.     #@mhelp_window.dispose
  106.     @gold_window.dispose
  107.     @buy_window.dispose
  108.     @status_window.dispose
  109.     screen.dispose
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # ● 刷新画面
  113.   #--------------------------------------------------------------------------
  114.   def update
  115.     # 刷新窗口
  116.     @help_window.update
  117.     #@mhelp_window.update
  118.     @gold_window.update
  119.     @buy_window.update
  120.     @status_window.update
  121.     # 购买窗口激活的情况下: 调用 update_buy
  122.     if @buy_window.active
  123.       update_buy
  124.       return
  125.     end
  126.     if @status_window.active
  127.       update_status
  128.       return
  129.     end
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 刷新画面 (购买窗口激活的情况下)
  133.   #--------------------------------------------------------------------------
  134.   def update_buy
  135.     @status_window.skill = @buy_window.skill
  136.     if Input.trigger?(Input::B)
  137.       $game_system.se_play($data_system.cancel_se)
  138.       $scene = Scene_Map.new
  139.       return
  140.     end
  141.     if Input.trigger?(Input::C)
  142.       @skill = @buy_window.skill
  143.       if @skill == nil or @skill.price > $mShop_gold
  144.         $game_system.se_play($data_system.buzzer_se)
  145.         return
  146.       end
  147.       $game_system.se_play($data_system.decision_se)
  148.       @buy_window.active = false
  149.       @status_window.index = 0
  150.       @status_window.active = true
  151.     end
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● 刷新画面 (状态窗口激活的情况下)
  155.   #--------------------------------------------------------------------------
  156.   def update_status
  157.     if Input.trigger?(Input::B)
  158.       $game_system.se_play($data_system.cancel_se)
  159.       @status_window.active = false
  160.       @status_window.index = -1
  161.       @buy_window.active = true
  162.     end
  163.     if Input.trigger?(Input::C)
  164.       if $game_party.actors[@status_window.index].skill_learn?(@skill.id)
  165.         $game_system.se_play($data_system.cancel_se)
  166.         return
  167.       else
  168.         $game_system.se_play($data_system.decision_se)
  169.         if $mShop_use_variable == 0
  170.           $game_party.gain_gold([email]-@skill.price[/email])
  171.           $mShop_gold -= @skill.price
  172.         else
  173.           $game_variables[$mShop_use_variable] -= @skill.price
  174.           $mShop_gold -= @skill.price
  175.         end
  176.         $game_party.actors[@status_window.index].learn_skill(@skill.id)
  177.         @gold_window.refresh
  178.         @buy_window.refresh
  179.         @status_window.refresh
  180.         @status_window.active = false
  181.         @status_window.index = -1
  182.         @buy_window.active = true
  183.       end      
  184.     end   
  185.   end
  186. end
  187. #==============================================================================
  188. # ■ Window_MShopStatus
  189. #------------------------------------------------------------------------------
  190. #  特技商店画面、显示物品所持数与角色装备的窗口。
  191. #==============================================================================
  192. class Window_MShopStatus < Window_Selectable
  193.   #--------------------------------------------------------------------------
  194.   # ● 初始化对像
  195.   #--------------------------------------------------------------------------
  196.   def initialize
  197.     super(368, 64, 272, 352)
  198.     self.contents = Bitmap.new(width - 32, height - 32)
  199.     self.contents.font.size = 18
  200.     @skill = nil
  201.     refresh
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 刷新
  205.   #--------------------------------------------------------------------------
  206.   def refresh
  207.     self.contents.clear
  208.     for i in 0...$game_party.actors.size
  209.       actor = $game_party.actors[i]
  210. #      draw_actor_graphic(actor,12,80*i+64)
  211.       self.contents.font.color = system_color
  212.       self.contents.draw_text(44, 80*i, 240, 32, actor.name)
  213.       self.contents.draw_text(0, 80*i , 240-20,32,"等级",2)
  214.       self.contents.font.color = normal_color
  215.       self.contents.draw_text(0, 80*i, 240, 32, actor.level.to_s , 2)
  216.       self.contents.font.color = system_color
  217.       self.contents.draw_text(44, 80*i+22, 45, 32, $data_system.words.hp)
  218.       self.contents.font.color = normal_color
  219.       self.contents.draw_text(44, 80*i+22, 90, 32, actor.maxhp.to_s,2)
  220.       self.contents.font.color = system_color
  221.       self.contents.draw_text(150, 80*i+22, 45, 32, $data_system.words.sp)
  222.       self.contents.font.color = normal_color
  223.       self.contents.draw_text(150, 80*i+22, 90, 32, actor.maxsp.to_s,2)      
  224.       if actor.skill_learn?(@skill.id)
  225.         self.contents.font.color = Color.new(255,255,255,128)
  226.         self.contents.draw_text(44, 80*i+44, 196, 32, "这种魔法已经学会",2)        
  227.       else
  228.         self.contents.font.color = Color.new(255,255,0,255)
  229.         self.contents.draw_text(44, 80*i+44, 240, 32, "这种魔法尚未掌握")
  230.       end
  231.     end
  232.     @item_max = $game_party.actors.size
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ● 设置物品
  236.   #     item : 新的物品
  237.   #--------------------------------------------------------------------------
  238.   def skill=(skill)
  239.     if @skill != skill
  240.       @skill = skill
  241.       refresh
  242.     end
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # ● 刷新光标矩形
  246.   #--------------------------------------------------------------------------
  247.   def update_cursor_rect
  248.     if @index < 0
  249.       self.cursor_rect.empty
  250.     else
  251.       self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
  252.     end
  253.   end
  254. end
  255. #==============================================================================
  256. # ■ Window_MShopBuy
  257. #------------------------------------------------------------------------------
  258. #  特技商店画面、浏览显示可以购买的商品的窗口。
  259. #==============================================================================
  260. class Window_MShopBuy < Window_Selectable
  261.   #--------------------------------------------------------------------------
  262.   # ● 初始化对像
  263.   #     shop_goods : 商品
  264.   #--------------------------------------------------------------------------
  265.   def initialize(id)
  266.     super(0, 64, 368, 416)
  267.     @id = id
  268.     refresh
  269.     self.index = 0
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ● 获取物品
  273.   #--------------------------------------------------------------------------
  274.   def skill
  275.     return @data[self.index]
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● 刷新
  279.   #--------------------------------------------------------------------------
  280.   def refresh
  281.     if self.contents != nil
  282.       self.contents.dispose
  283.       self.contents = nil
  284.     end
  285.     @data = []
  286.     for skill_id in @id
  287.       skill = $data_skills[skill_id]
  288.       if skill != nil
  289.         @data.push(skill)
  290.       end
  291.     end
  292.     @item_max = @data.size
  293.     if @item_max > 0
  294.       self.contents = Bitmap.new(width - 32, row_max * 32)
  295.       for i in 0...@item_max
  296.         draw_item(i)
  297.       end
  298.     end
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ● 描绘羡慕
  302.   #     index : 项目编号
  303.   #--------------------------------------------------------------------------
  304.   def draw_item(index)
  305.     skill = @data[index]
  306.     # 除此之外的情况设置为无效文字色
  307.     if skill.price <= $mShop_gold
  308.       self.contents.font.color = normal_color
  309.     else
  310.       self.contents.font.color = disabled_color
  311.     end
  312.     x = 4
  313.     y = index * 32
  314.     rect = Rect.new(x, y, self.width - 32, 32)
  315.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  316.     bitmap = RPG::Cache.icon(skill.icon_name)
  317.     opacity = self.contents.font.color == normal_color ? 255 : 128
  318.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  319.     self.contents.draw_text(x + 28, y, 212, 32, skill.name, 0)
  320.     self.contents.draw_text(x + 240, y, 88, 32, skill.price.to_s, 2)
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 刷新帮助文本
  324.   #--------------------------------------------------------------------------
  325.   def update_help
  326.     @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  327.   end
  328. end
  329. #==============================================================================
  330. # ■ RPG原装定义
  331. #==============================================================================
  332. module RPG
  333.   class Skill
  334.     def description
  335.       description = @description.split(/#/)[0]
  336.       return description != nil ? description : ''
  337.     end
  338.     def price
  339.       price = @description.split(/#/)[1]
  340.       return price != nil ? price.to_i : 0
  341.     end
  342.   end
  343. end
  344.  
  345.  
  346.  
  347. #==============================================================================
  348. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  349. #==============================================================================
取名不慎,我的名字是BobCheng,做游戏什么的,其实是安慰自己而已。
很烧脑的推理游戏
猜不到结局的故事
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-5-30 18:47

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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