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

Project1

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

[有事请教] 如何查看物品时,显示物品放大图片?

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7088
在线时间
885 小时
注册时间
2015-2-10
帖子
248
跳转到指定楼层
1
发表于 2019-1-27 16:12:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
50星屑
本帖最后由 fbeds 于 2019-1-30 14:51 编辑

如题,我搜索过相关关键字,但发现居然没有人问过类似的问题,有也不是mv上的,别的xp、vx、va什么的脚本应该不能直接套用过来对吧?反正我就是想在进入道具界面时,按下某个按键就可以显示该物品对应的图片(此时背景就显示另外的一张固定的图片),然后按一下取消键就可以退出来,而且这个功能也可以在事件“处理道具选择”中使用,好像不是很难……这里附上的脚本是有同样功能的,不过是xp里的,不知道能否用来参考……(这个脚本是拿物品分类脚本改的)
JAVASCRIPT 代码复制
  1. #==============================================================================
  2. #给物品分类,在物品的介绍后面加上@XXX,XXX可改为任意名字,同样后缀的物品获得
  3. #归为一类,没有后缀的某认为贵重物品一类
  4. #==============================================================================
  5. # ■ Harts_Window_ItemTitle
  6. #==============================================================================
  7.  
  8. class Harts_Window_ItemTitle < Window_Base
  9.   def initialize
  10.     super(0, 0, 160, 64)
  11.     self.contents = Bitmap.new(width - 32, height - 32)
  12.     self.contents.clear
  13.     self.contents.font.color = normal_color
  14.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  15.   end
  16. end
  17.  
  18. #==============================================================================
  19. # ■ Harts_Window_ItemCommand
  20. #==============================================================================
  21.  
  22. class Harts_Window_ItemCommand < Window_Selectable
  23.   attr_accessor :commands
  24.   #--------------------------------------------------------------------------
  25.   # ● 初始化,生成commands窗口
  26.   #--------------------------------------------------------------------------
  27.   def initialize
  28.     super(0, 64, 160, 352)
  29.     @commands = []
  30.     #————————生成commands窗口
  31.     for i in 1...$data_items.size
  32.       if $game_party.item_number(i) > 0
  33.         push = true
  34.         for com in @commands
  35.           if com == $data_items[i].desc
  36.             push = false
  37.           end
  38.         end
  39.         if push == true
  40.           @commands.push($data_items[i].desc)
  41.         end
  42.       end
  43.     end
  44.     for i in 1...$data_weapons.size
  45.       if $game_party.weapon_number(i) > 0
  46.         push = true
  47.         for com in @commands
  48.           if com == $data_weapons[i].desc
  49.             push = false
  50.           end
  51.         end
  52.         if push == true
  53.           @commands.push($data_weapons[i].desc)
  54.         end
  55.       end
  56.     end
  57.     for i in 1...$data_armors.size
  58.       if $game_party.armor_number(i) > 0
  59.         push = true
  60.         for com in @commands
  61.           if com == $data_armors[i].desc
  62.             push = false
  63.           end
  64.         end
  65.         if push == true
  66.           @commands.push($data_armors[i].desc)
  67.         end
  68.       end
  69.     end
  70.     if @commands == []
  71.       @commands.push("贵重物品")
  72.     end      
  73.     @item_max = @commands.size
  74.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  75.     refresh
  76.     self.index = 0
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   #--------------------------------------------------------------------------
  80.   def refresh
  81.     self.contents.clear
  82.     for i in 0...@item_max
  83.       draw_item(i, normal_color)
  84.     end
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   #--------------------------------------------------------------------------
  88.   def draw_item(index, color)
  89.     self.contents.font.color = color
  90.     y = index * 32
  91.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # 只描绘原文字
  95.   #--------------------------------------------------------------------------
  96.   def update_help
  97.     @help_window.set_text(@commands[self.index])
  98.   end
  99. end
  100.  
  101. #==============================================================================
  102. # ■ Window_Item
  103. #==============================================================================
  104.  
  105. class Harts_Window_ItemList < Window_Selectable
  106.   #--------------------------------------------------------------------------
  107.   #--------------------------------------------------------------------------
  108.   def initialize
  109.     super(160, 0, 480, 416)
  110.     refresh
  111.     self.index = 0
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   #--------------------------------------------------------------------------
  115.   def item
  116.     return @data[self.index]
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   #--------------------------------------------------------------------------
  120.   def refresh
  121.     if self.contents != nil
  122.       self.contents.dispose
  123.       self.contents = nil
  124.     end
  125.     @data = []
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   #--------------------------------------------------------------------------
  129.   def set_item(command)
  130.     refresh
  131.     for i in 1...$data_items.size
  132.       if $game_party.item_number(i) > 0 and $data_items[i].desc == command
  133.         @data.push($data_items[i])
  134.       end
  135.     end
  136.     for i in 1...$data_weapons.size
  137.       if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == command
  138.         @data.push($data_weapons[i])
  139.       end
  140.     end
  141.     for i in 1...$data_armors.size
  142.       if $game_party.armor_number(i) > 0 and $data_armors[i].desc == command
  143.         @data.push($data_armors[i])
  144.       end
  145.     end
  146.     @item_max = @data.size
  147.     if @item_max > 0
  148.       self.contents = Bitmap.new(width - 32, row_max * 32)
  149.       self.contents.clear
  150.       for i in 0...@item_max
  151.         draw_item(i)
  152.       end
  153.     end
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   #--------------------------------------------------------------------------
  157.   def item_number
  158.     return @item_max
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   #--------------------------------------------------------------------------
  162.   def draw_item(index)
  163.     item = @data[index]
  164.     case item
  165.     when RPG::Item
  166.       number = $game_party.item_number(item.id)
  167.     when RPG::Weapon
  168.       number = $game_party.weapon_number(item.id)
  169.     when RPG::Armor
  170.       number = $game_party.armor_number(item.id)
  171.     end
  172.     if item.is_a?(RPG::Item) and
  173.       $game_party.item_can_use?(item.id)
  174.       self.contents.font.color = normal_color
  175.     else
  176.       self.contents.font.color = disabled_color
  177.     end
  178.     x = 4
  179.     y = index * 32
  180.     bitmap = RPG::Cache.icon(item.icon_name)
  181.     opacity = self.contents.font.color == normal_color ? 255 : 128
  182.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  183.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  184.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  185.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   #--------------------------------------------------------------------------
  189.   def update_help
  190.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  191.   end
  192. end
  193.  
  194. #==============================================================================
  195. # ■ Harts_Scene_Item
  196. #==============================================================================
  197.  
  198. class Scene_Item
  199.   #--------------------------------------------------------------------------
  200.   #--------------------------------------------------------------------------
  201.   def main
  202.     @itemtitle_window = Harts_Window_ItemTitle.new
  203.     @itemcommand_window = Harts_Window_ItemCommand.new
  204.     @command_index = @itemcommand_window.index
  205.     @itemlist_window = Harts_Window_ItemList.new
  206.     @itemlist_window.active = false
  207.     @help_window = Window_Help.new
  208.     @help_window.x = 0
  209.     @help_window.y = 416
  210.     @itemcommand_window.help_window = @help_window
  211.     @itemlist_window.help_window = @help_window
  212.     @target_window = Window_Target.new
  213.     @big_picture = Big_Picture.new
  214.     @target_window.visible = false
  215.     @target_window.active = false
  216.     @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  217.     Graphics.transition
  218.     loop do
  219.       Graphics.update
  220.       Input.update
  221.       update
  222.       if $scene != self
  223.         break
  224.       end
  225.     end
  226.     Graphics.freeze
  227.     @itemtitle_window.dispose
  228.     @itemcommand_window.dispose
  229.     @itemlist_window.dispose
  230.     @help_window.dispose
  231.     @target_window.dispose
  232.     @big_picture.dispose
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   #--------------------------------------------------------------------------
  236.   def update
  237.     @itemtitle_window.update
  238.     @itemcommand_window.update
  239.     @itemlist_window.update
  240.     @help_window.update
  241.     @target_window.update
  242.     @big_picture.update
  243.     if @command_index != @itemcommand_window.index
  244.       @command_index = @itemcommand_window.index
  245.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  246.     end
  247.     if @itemcommand_window.active
  248.       update_itemcommand
  249.       return
  250.     end
  251.     if @itemlist_window.active
  252.       update_itemlist
  253.       return
  254.     end
  255.     if @target_window.active
  256.       update_target
  257.       return
  258.     end
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   #--------------------------------------------------------------------------
  262.   def update_itemcommand
  263.     if Input.trigger?(Input::B)
  264.       $game_system.se_play($data_system.cancel_se)
  265.       $scene = Scene_Map.new
  266.       return
  267.     end
  268.     if Input.trigger?(Input::C)
  269.       if @itemlist_window.item_number == 0
  270.         $game_system.se_play($data_system.buzzer_se)
  271.         return
  272.       end
  273.       $game_system.se_play($data_system.decision_se)
  274.       @itemcommand_window.active = false
  275.       @itemlist_window.active = true
  276.       @itemlist_window.index = 0
  277.       return
  278.     end
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   #--------------------------------------------------------------------------
  282.   def update_itemlist
  283.     if Input.trigger?(Input::B)
  284.       $game_system.se_play($data_system.cancel_se)
  285.       @itemcommand_window.active = true
  286.       @itemlist_window.active = false
  287.       @big_picture.visible = false
  288.       @itemlist_window.index = 0
  289.       @itemcommand_window.index = @command_index
  290.       return
  291.     end
  292.     if Input.trigger?(Input::A)
  293.       @big_picture.visible = ! @big_picture.visible
  294.       @big_picture.display(@itemlist_window.item)
  295.     end
  296.     return if @big_picture.visible
  297.     if Input.trigger?(Input::C)
  298.       @item = @itemlist_window.item
  299.       unless @item.is_a?(RPG::Item)
  300.         $game_system.se_play($data_system.buzzer_se)
  301.         return
  302.       end
  303.       unless $game_party.item_can_use?(@item.id)
  304.         $game_system.se_play($data_system.buzzer_se)
  305.         return
  306.       end
  307.       $game_system.se_play($data_system.decision_se)
  308.       $game_variables[5] = @item.id
  309.       if @item.scope >= 3
  310.         @itemlist_window.active = false
  311.         @target_window.x = 304
  312.         @target_window.visible = true
  313.         @target_window.active = true
  314.         if @item.scope == 4 || @item.scope == 6
  315.           @target_window.index = -1
  316.         else
  317.           @target_window.index = 0
  318.         end
  319.       else
  320.         if @item.common_event_id > 0
  321.           $game_temp.common_event_id = @item.common_event_id
  322.           $game_system.se_play(@item.menu_se)
  323.             if @item.consumable
  324.               $game_party.lose_item(@item.id, 1)
  325.               @itemlist_window.draw_item(@itemlist_window.index)
  326.             end
  327.           $scene = Scene_Map.new
  328.           return
  329.         end
  330.       end
  331.       return
  332.     end
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   #--------------------------------------------------------------------------
  336.   def update_target
  337.     if Input.trigger?(Input::B)
  338.       $game_system.se_play($data_system.cancel_se)
  339.       unless $game_party.item_can_use?(@item.id)
  340.         @itemlist_window.refresh
  341.       end
  342.       @itemlist_window.active = true
  343.       @target_window.visible = false
  344.       @target_window.active = false
  345.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  346.       return
  347.     end
  348.     if Input.trigger?(Input::C)
  349.       if $game_party.item_number(@item.id) == 0
  350.         $game_system.se_play($data_system.buzzer_se)
  351.         return
  352.       end
  353.       if @target_window.index == -1
  354.         used = false
  355.         for i in $game_party.actors
  356.           used |= i.item_effect(@item)
  357.         end
  358.       end
  359.       if @target_window.index >= 0
  360.         target = $game_party.actors[@target_window.index]
  361.         used = target.item_effect(@item)
  362.       end
  363.       if used
  364.         $game_system.se_play(@item.menu_se)
  365.         if @item.consumable
  366.           $game_party.lose_item(@item.id, 1)
  367.           @itemlist_window.draw_item(@itemlist_window.index)
  368.           @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  369.         end
  370.         @target_window.refresh
  371.         if $game_party.all_dead?
  372.           $scene = Scene_Gameover.new
  373.           return
  374.         end
  375.         if @item.common_event_id > 0
  376.           $game_temp.common_event_id = @item.common_event_id
  377.           $scene = Scene_Map.new
  378.           return
  379.         end
  380.       end
  381.       unless used
  382.         $game_system.se_play($data_system.buzzer_se)
  383.       end
  384.     return
  385.     end
  386.   end
  387. end
  388.  
  389. #==============================================================================
  390. # ■ RPG追加定义,使用@符号分类
  391. #==============================================================================
  392.  
  393. module RPG
  394.   class Weapon
  395.     def description
  396.       description = @description.split(/@/)[0]
  397.       return description != nil ? description : ''
  398.     end
  399.     def desc
  400.       desc = @description.split(/@/)[1]
  401.       return desc != nil ? desc : "贵重物品"
  402.     end
  403.   end
  404.   class Item
  405.     def description
  406.       description = @description.split(/@/)[0]
  407.       return description != nil ? description : ''
  408.     end
  409.     def desc
  410.       desc = @description.split(/@/)[1]
  411.       return desc != nil ? desc : "贵重物品"
  412.     end
  413.   end
  414.   class Armor
  415.     def description
  416.       description = @description.split(/@/)[0]
  417.       return description != nil ? description : ''
  418.     end
  419.     def desc
  420.       desc = @description.split(/@/)[1]
  421.       return desc != nil ? desc : "贵重物品"
  422.     end
  423.   end
  424. end
  425. #==============================================================================
  426. class Big_Picture < Window_Base
  427.   def initialize
  428.     super(0, 0, 640, 480)
  429.     self.contents = Bitmap.new(width - 32, height - 32)
  430.     self.z = 999
  431.     self.visible = false
  432.   end
  433.   def display(item)
  434.     self.contents.clear
  435.     b_name = case item
  436.     when RPG::Item   then "item#{item.id}.png"
  437.     when RPG::Weapon then "weapon#{item.id}.png"
  438.     when RPG::Armor  then "armor#{item.id}.png"
  439.     end
  440.     unless FileTest.exist?("Graphics/Icons/#{b_name}")
  441.       self.contents.draw_text(200, 224, 240, 32, "没有找到图片!", 1)
  442.       return
  443.     end
  444.     bitmap = RPG::Cache.icon(b_name)
  445.     x = 320 - bitmap.width / 2
  446.     y = 240 - bitmap.height / 2
  447.     self.contents.blt(x, y, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
  448.   end
  449. end
  450. #==============================================================================
  451. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  452. #==============================================================================

最佳答案

查看完整内容

mog的插件好像有你想要的功能,我发给你[fold=Drill_X_ItemImage]//============================================================================= // Drill_X_ItemImage.js //============================================================================= /*: * @plugindesc [v1.1] 主菜单 - 物品+技能详细图片[扩展] * @author Drill_up * * @help * =================================================== ...

评分

参与人数 1+1 收起 理由
马铃薯条 + 1 我很赞同

查看全部评分

Lv1.梦旅人

梦石
0
星屑
163
在线时间
20 小时
注册时间
2019-1-26
帖子
25
2
发表于 2019-1-27 16:12:08 | 只看该作者
mog的插件好像有你想要的功能,我发给你
Drill_X_ItemImage
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7512
在线时间
1227 小时
注册时间
2008-12-14
帖子
555
3
发表于 2019-1-27 17:56:36 | 只看该作者
可以自己写代码,一般做法是在每个物品项目里增加note备注,然后新建窗口去调用对应的图片。
对于想要现成脚本的。。。
YEP.123 – Item Picture Images – RPG Maker MV
http://yanfly.moe/2017/01/14/yep ... mages-rpg-maker-mv/
需要购买本人MV插件必须先加wx好友。加不上wx就是本人忙,没时间卖。原则上太久以前的插件也不想卖,因为我也忘了,维护上会不给力。wx名:alskyif    本人插件地址:
   LCK_SRPG梦幻模拟战、火焰纹章类系统
   究极立绘ADV系统

   究极换装统合系统
   究极! 回想与CG系统
   消息文字的距离调整  
   自动返回上一张地图
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7088
在线时间
885 小时
注册时间
2015-2-10
帖子
248
4
 楼主| 发表于 2019-1-27 20:49:10 | 只看该作者
if216 发表于 2019-1-27 17:56
可以自己写代码,一般做法是在每个物品项目里增加note备注,然后新建窗口去调用对应的图片。
对于想要现成 ...

我是脚本盲……而且你给的这个插件我不会用啊!看介绍好像是要下另外一个基础插件才能起作用,可是我下了还是不起作用……
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-11 00:04

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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