Project1

标题: ISA - 头顶的东西 请问这个脚本如何使用 [打印本页]

作者: j296196585    时间: 2017-5-22 01:19
标题: ISA - 头顶的东西 请问这个脚本如何使用
RUBY 代码复制
  1. #______________________________________________________________________________
  2. # * 此脚本归66RPG - Idiot Script Association(ISA)所有,谢绝任何形式转载。
  3. #______________________________________________________________________________
  4.  
  5. #==============================================================================
  6. # ■ 头顶的东西 - Put On The Thing
  7. #------------------------------------------------------------------------------
  8. #   遵守协议:66RPG - Idiot Script Association(ISA)
  9. #   初始脚本:忧雪の伤
  10. #   更新优化:无
  11. #   当前版本:1.0.0.0
  12. #------------------------------------------------------------------------------
  13. #   更新日记:忧雪の伤(2011.3.19)
  14. #             - 初始化对象
  15. #------------------------------------------------------------------------------
  16. #   功能介绍:创建一个可以跟随移动,指定文件,显示在Player头上的Icon。
  17. #   使用方法:插入接入包的下端处。
  18. #   存在问题:无
  19. #==============================================================================
  20.  
  21. #--------------------------------------------------------------------------
  22. # ● 资料记录
  23. #--------------------------------------------------------------------------
  24.  
  25. module ISA
  26.    Use["头顶的东西"] = [true, "1.0.0.0"]
  27.    System["头顶的东西"] = {}
  28. end
  29.  
  30. #--------------------------------------------------------------------------
  31. # ● 设定部分
  32. #--------------------------------------------------------------------------
  33.  
  34. module ISA
  35.   # 窗口的坐标修正设定
  36.   System["头顶的东西"]["坐标修正设定"] = [30, 82]
  37. end
  38.  
  39. #==============================================================================
  40. # ■ Game_Temp
  41. #------------------------------------------------------------------------------
  42. #  在没有存档的情况下,处理临时数据的类。这个类的实例请参考
  43. # $game_temp 。
  44. #==============================================================================
  45.  
  46. class Game_Temp
  47.   #--------------------------------------------------------------------------
  48.   # ● 定义实例变量
  49.   #--------------------------------------------------------------------------
  50.   attr_accessor :map_put_on                  # 地图头顶存在图标
  51.   attr_accessor :map_put_name                # 地图头顶存在图标文件名
  52. end
  53.  
  54. #==============================================================================
  55. # ■ Window_Put_On
  56. #------------------------------------------------------------------------------
  57. #  显示图标的窗口。
  58. #==============================================================================
  59.  
  60. class Window_Put_On < Window_Base
  61.   include ISA
  62.   #--------------------------------------------------------------------------
  63.   # ● 初始化窗口
  64.   #--------------------------------------------------------------------------
  65.   def initialize(name)
  66.     super(0, 0, 64, 64)
  67.     self.contents = Bitmap.new(width - 32, height - 32)
  68.     self.opacity = 0
  69.     self.x = $game_player.screen_x - System["头顶的东西"]["坐标修正设定"][0]
  70.     self.y = $game_player.screen_y - System["头顶的东西"]["坐标修正设定"][1]
  71.     self.z = 0
  72.     @name = name
  73.     refresh
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 刷新
  77.   #--------------------------------------------------------------------------
  78.   def refresh
  79.     self.contents.clear
  80.     bitmap = RPG::Cache.icon(@name)
  81.     self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 24, 24))
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 刷新画面
  85.   #--------------------------------------------------------------------------
  86.   def update
  87.     super
  88.     self.x = $game_player.screen_x - System["头顶的东西"]["坐标修正设定"][0]
  89.     self.y = $game_player.screen_y - System["头顶的东西"]["坐标修正设定"][1]
  90.   end
  91. end
  92.  
  93. #==============================================================================
  94. # ■ Scene_Map
  95. #------------------------------------------------------------------------------
  96. #  处理地图画面的类。
  97. #==============================================================================
  98.  
  99. class Scene_Map
  100.   include ISA  
  101.   #--------------------------------------------------------------------------
  102.   # ● 主处理
  103.   #--------------------------------------------------------------------------
  104.   alias :put_on_the_thing_main :main unless method_defined? :put_on_the_thing_main
  105.   def main
  106.     @put_on_window = Window_Put_On.new($game_temp.map_put_name) if $game_temp.map_put_on
  107.     put_on_the_thing_main
  108.     @put_on_window.dispose if @put_on_window != nil
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 刷新画面
  112.   #--------------------------------------------------------------------------
  113.   alias :put_on_the_thing_update :update unless method_defined? :put_on_the_thing_update
  114.   def update
  115.     @put_on_window.update if @put_on_window != nil
  116.     put_on_the_thing_update
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # ● 设置图标
  120.   #--------------------------------------------------------------------------
  121.   def set_icon(name)
  122.     @put_on_window = Window_Put_On.new(name)
  123.     @put_on_window.visible = true
  124.     $game_temp.map_put_on = true
  125.     $game_temp.map_put_name = name
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 图标关闭
  129.   #--------------------------------------------------------------------------
  130.   def set_icon_no
  131.     $game_temp.map_put_on = false
  132.     if @put_on_window != nil
  133.       @put_on_window.visible = false
  134.     end
  135.     return true
  136.   end
  137. end

打算打算打算打算的.png (59.08 KB, 下载次数: 15)

打算打算打算打算的.png

作者: guoxiaomi    时间: 2017-5-22 12:26
本帖最后由 guoxiaomi 于 2017-5-22 17:17 编辑

这个脚本,只能在角色头上顶1个东西。而且只能顶icon。

$scene.set_icon(“001-Weapon”) ,就会把剑顶在头上orz……



我居然打了中文引号……根本看不出来
  1. $scene.set_icon("001-Weapon")
复制代码

作者: j296196585    时间: 2017-5-22 17:12
guoxiaomi 发表于 2017-5-22 12:26
这个脚本,只能在角色头上顶1个东西。而且只能顶icon。

$scene.set_icon(“001-Weapon”) ,就会把剑顶在 ...

可是  我就是不明白这 是怎么回事儿  脚本错误{:2_271:}

360截图20170522171032317.jpg (74.15 KB, 下载次数: 16)

360截图20170522171032317.jpg

360截图20170522171038369.jpg (76.9 KB, 下载次数: 16)

360截图20170522171038369.jpg

作者: guoxiaomi    时间: 2017-5-22 17:18
j296196585 发表于 2017-5-22 17:12
可是  我就是不明白这 是怎么回事儿  脚本错误

36行修改图标偏移的位置
作者: j296196585    时间: 2017-5-22 17:23
guoxiaomi 发表于 2017-5-22 12:26
这个脚本,只能在角色头上顶1个东西。而且只能顶icon。

$scene.set_icon(“001-Weapon”) ,就会把剑顶在 ...

这电脑不会跟我有仇吧 一点反应都没有了

360截图20170522172228090.jpg (44.11 KB, 下载次数: 16)

360截图20170522172228090.jpg

作者: guoxiaomi    时间: 2017-5-22 21:16
本帖最后由 guoxiaomi 于 2017-5-23 00:45 编辑
j296196585 发表于 2017-5-22 17:23
这电脑不会跟我有仇吧 一点反应都没有了


在脚本最前面添加一下定义:
  1. module ISA
  2.    Use ||= {}
  3.    System ||= {}
  4.    Use["头顶的东西"] = [true, "1.0.0.0"]
  5.    System["头顶的东西"] = {}
  6. end
复制代码

然后按照你这一楼的做法就行




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