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

Project1

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

[已经过期] 如何在角色头顶显示一段文字后消失?

[复制链接]

Lv2.观梦者

梦石
0
星屑
685
在线时间
661 小时
注册时间
2012-10-21
帖子
350
跳转到指定楼层
1
发表于 2015-2-11 08:44:53 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
RT,就类似物品得失脚本那样,或者类似那些ARPG脚本,受到伤害在头顶显示受到的伤害一段时间后消失
但是我不做ARPG,不想整个脚本都要,只要里面的显示文字于头顶一段时间后消失的功能。
文字最好能自定义,并且支持图标
请问能否帮帮我呢?谢谢了

Lv5.捕梦者

梦石
0
星屑
22948
在线时间
8638 小时
注册时间
2011-12-31
帖子
3367
2
发表于 2015-2-11 09:55:16 | 只看该作者

点评

请问有别的吗?这个有点卡……  发表于 2015-2-11 10:01
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
685
在线时间
661 小时
注册时间
2012-10-21
帖子
350
3
 楼主| 发表于 2015-2-11 10:05:16 | 只看该作者
能否帮忙在获得物品提示的基础上改下?

RUBY 代码复制
  1. #Sleek Item Popup v1.12a
  2. #----------#
  3. #Features: A nice and sleek little pop up you can use to tell the player
  4. #           they received (or lost) an item! Now with automatic popups whenever
  5. #           you use the gain item commands in events!
  6. #
  7. #Usage:   Event Script Call:
  8. #           popup(type,item,amount,[duration],[xoff],[yoff])
  9. #
  10. #          Where: type is category of item (0 = item, 1 = weapon,
  11. #                                            2 = armor, 3 = gold)
  12. #                 item is the id number of the item
  13. #                 amount is the amount lost or gained
  14. #                 duration is the time the window is up and is optional
  15. #         
  16. #          Examples:
  17. #            popup(0,1,5)
  18. #            popup(2,12,1,120)
  19. #            $PU_AUTOMATIC_POPUP = false
  20. #            $PU_AUTOMATIC_POPUP = true
  21. #        
  22. #Customization: Everything down there under customization
  23. #
  24. #----------#
  25. #-- Script by: V.M of D.T
  26. #
  27. #- Questions or comments can be:
  28. #    posted on the thread for the script
  29. #    given by email: [email][email protected][/email]
  30. #    provided on facebook: [url]http://www.facebook.com/DaimoniousTailsGames[/url]
  31. #    posed on site: daimonioustails.wordpress.com
  32. #
  33. #--- Free to use in any project, commercial or non-commercial, with credit given
  34. # - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
  35.  
  36.  
  37. #Sound effect played on popup: # "Filename", Volume(0-100), Pitch(50-150)
  38. PU_SOUND_EFFECT_GAIN = ["Item1",100,50]
  39. PU_SOUND_EFFECT_LOSE = ["Item1",100,15]
  40.  
  41.  
  42. #Animation to be played on the player during popup
  43. PU_USE_ANIMATION = false
  44. PU_POPUP_ANIMATION = 2
  45.  
  46.  
  47. #Duration in frames of Item Popup fadein and fadeout
  48. PU_FADEIN_TIME = 8
  49. PU_FADEOUT_TIME = 8
  50.  
  51.  
  52. #Default duration of the popup
  53. PU_DEFAULT_DURATION = 40
  54.  
  55.  
  56. #Use automatic popup? Can be enabled/disabled in game, see examples
  57. $PU_AUTOMATIC_POPUP = true
  58.  
  59.  
  60. #Whether to use a custom or default font
  61. PU_USE_CUSTOM_FONT = false
  62.  
  63.  
  64. #Settings for custom item popup font
  65. PU_DEFAULT_FONT_NAME = ["Verdana"]
  66. PU_DEFAULT_FONT_SIZE = 14
  67. PU_DEFAULT_FONT_COLOR = Color.new(255,255,255,255)
  68. PU_DEFAULT_FONT_BOLD = false
  69. PU_DEFAULT_FONT_ITALIC = false
  70. PU_DEFAULT_FONT_SHADOW = false
  71. PU_DEFAULT_FONT_OUTLINE = true
  72.  
  73.  
  74. #Compact mode will hide the amount unless it's greater then 1
  75. PU_COMPACT_MODE = true
  76.  
  77.  
  78. #Background Icon to be displayed under item icon
  79. PU_USE_BACKGROUND_ICON = false
  80. PU_BACKGROUND_ICON = 102
  81.  
  82.  
  83. #Gold details:
  84. PU_GOLD_NAME = "魂"
  85. PU_GOLD_ICON = 466
  86.  
  87.  
  88. #True for single line, false for multi line
  89. PU_SINGLE_LINE = true
  90.  
  91.  
  92. class Item_Popup < Window_Base
  93.   def initialize(item, amount, duration, nosound,xoff,yoff)
  94.     super(0,0,100,96)
  95.     sedg = PU_SOUND_EFFECT_GAIN
  96.     sedl = PU_SOUND_EFFECT_LOSE
  97.     se = RPG::SE.new(sedg[0],sedg[1],sedg[2]) unless sedg.nil? or nosound
  98.     se2 = RPG::SE.new(sedl[0],sedl[1],sedl[2]) unless sedl.nil? or nosound
  99.     se.play if se and amount > 0
  100.     se2.play if se2 and amount < 0
  101.     self.opacity = 0
  102.     self.x = $game_player.screen_x - 16
  103.     self.y = $game_player.screen_y - 80
  104.     @xoff = 0
  105.     @yoff = 0
  106.     @duration = 40
  107.     @item = item
  108.     @amount = amount
  109.     @name = item.name.clone
  110.     @text = ""
  111.     @padding = ' '*@name.size
  112.     @timer = 0
  113.     @split = (PU_FADEIN_TIME) / @name.size
  114.     @split = 2 if @split < 2
  115.     amount > 0 ? @red = Color.new(0,255,0) : @red = Color.new(255,0,0)
  116.     if PU_USE_CUSTOM_FONT
  117.       contents.font.size = PU_DEFAULT_FONT_SIZE
  118.     else
  119.       contents.font.size = 16
  120.     end
  121.     @textsize = text_size(@name)
  122.     textsize2 = text_size("" + amount.to_s)
  123.     self.width = @textsize.width + standard_padding * 2 + 24
  124.     self.width += textsize2.width + 48 if PU_SINGLE_LINE
  125.     contents.font.size < 24 ? size = 24 : size = contents.font.size
  126.     self.height = size + standard_padding * 2
  127.     self.height += size if !PU_SINGLE_LINE
  128.     self.x -= self.width / 2
  129.     create_contents
  130.     if PU_USE_CUSTOM_FONT
  131.       contents.font.name = PU_DEFAULT_FONT_NAME
  132.       contents.font.size = PU_DEFAULT_FONT_SIZE
  133.       contents.font.color = PU_DEFAULT_FONT_COLOR
  134.       contents.font.bold = PU_DEFAULT_FONT_BOLD
  135.       contents.font.italic = PU_DEFAULT_FONT_ITALIC
  136.       contents.font.shadow = PU_DEFAULT_FONT_SHADOW
  137.       contents.font.outline = PU_DEFAULT_FONT_OUTLINE
  138.     end
  139.     self.contents_opacity = 0
  140.     $game_player.animation_id = PU_POPUP_ANIMATION if PU_USE_ANIMATION
  141.     update
  142.   end
  143.   def update
  144.     #super
  145.     return if self.disposed?
  146.     self.visible = true if !self.visible
  147.     self.x = $game_player.screen_x - contents.width/4 + 12
  148.     self.y = $game_player.screen_y - 80 + @yoff
  149.     self.x -= self.width / 3
  150.     open if @timer < (PU_FADEIN_TIME)
  151.     close if @timer > (PU_FADEOUT_TIME + @duration)
  152.     @timer += 1
  153.     return if @timer % @split != 0
  154.     @text += @name.slice!(0,1)
  155.     @padding.slice!(0,1)
  156.     contents.clear
  157.     contents.font.color = @red
  158.     stringamount = @amount
  159.     stringamount = "" + @amount.to_s if @amount > 0
  160.     if PU_SINGLE_LINE
  161.       width = text_size(@item.name).width#@textsize.width
  162.       draw_text(27 + width,0,36,24,stringamount) unless PU_COMPACT_MODE and @amount == 1
  163.       if Module.const_defined?(:AFFIXES)
  164.         contents.font.color = @item.color
  165.       else
  166.         contents.font.color = Font.default_color
  167.       end
  168.       draw_text(24,0,contents.width,contents.height,@text+@padding)
  169.       draw_icon(PU_BACKGROUND_ICON,0,0) if PU_USE_BACKGROUND_ICON
  170.       draw_icon(@item.icon_index,0,0)
  171.     else
  172.       draw_text(contents.width / 4 + 16,24,36,24,stringamount) unless PU_COMPACT_MODE and @amount == 1
  173.       if Module.const_defined?(:AFFIXES)
  174.         contents.font.color = @item.color
  175.       else
  176.         contents.font.color = Font.default_color
  177.       end
  178.       draw_icon(PU_BACKGROUND_ICON,contents.width / 2 - 24,24) if PU_USE_BACKGROUND_ICON
  179.       draw_icon(@item.icon_index,contents.width / 2 - 24,24)
  180.       draw_text(0,0,contents.width,line_height,@text+@padding)
  181.     end
  182.   end
  183.   def close
  184.     self.contents_opacity -= (255 / (PU_FADEOUT_TIME))
  185.   end
  186.   def open
  187.     self.contents_opacity += (255 / (PU_FADEIN_TIME))
  188.   end
  189. end
  190.  
  191.  
  192. class Game_Interpreter
  193.   alias pu_command_126 command_126
  194.   alias pu_command_127 command_127
  195.   alias pu_command_128 command_128
  196.   alias pu_command_125 command_125
  197.   def popup(type,item,amount,duration = PU_DEFAULT_DURATION,nosound = false, xo = 0, yo = 0)
  198.     data = $data_items[item] if type == 0
  199.     data = $data_weapons[item] if type == 1
  200.     data = $data_armors[item] if type == 2
  201.     if type == 3
  202.       data = RPG::Item.new
  203.       data.name = PU_GOLD_NAME
  204.       data.icon_index = PU_GOLD_ICON
  205.     end
  206.     Popup_Manager.add(data,amount,duration,nosound,xo,yo)
  207.   end
  208.   def command_126
  209.     pu_command_126
  210.     value = operate_value(@params[1], @params[2], @params[3])
  211.     popup(0,@params[0],value) if $PU_AUTOMATIC_POPUP
  212.   end
  213.   def command_127
  214.     pu_command_127
  215.     value = operate_value(@params[1], @params[2], @params[3])
  216.     popup(1,@params[0],value) if $PU_AUTOMATIC_POPUP
  217.   end
  218.   def command_128
  219.     pu_command_128
  220.     value = operate_value(@params[1], @params[2], @params[3])
  221.     popup(2,@params[0],value) if $PU_AUTOMATIC_POPUP
  222.   end
  223.   def command_125
  224.     pu_command_125
  225.     value = operate_value(@params[0], @params[1], @params[2])
  226.     popup(3,@params[0],value) if $PU_AUTOMATIC_POPUP
  227.   end
  228. end
  229.  
  230.  
  231. module Popup_Manager
  232.   def self.init
  233.     @queue = []
  234.   end
  235.   def self.add(item,value,dura,ns,xo,yo)
  236.     @queue.insert(0,[item,value,dura,ns,xo,yo])
  237.   end
  238.   def self.queue
  239.     @queue
  240.   end
  241. end  
  242.  
  243.  
  244. Popup_Manager.init
  245.  
  246.  
  247. class Scene_Map
  248.   alias popup_update update
  249.   alias popup_preterminate pre_terminate
  250.   def update
  251.     popup_update
  252.     update_popup_window unless $popupwindow.nil?
  253.     return if Popup_Manager.queue.empty?
  254.     if $popupwindow.nil? or $popupwindow.contents_opacity == 0
  255.       var = Popup_Manager.queue.pop
  256.       $popupwindow = Item_Popup.new(var[0],var[1],var[2],var[3],var[4],var[5])
  257.     end
  258.   end
  259.   def update_popup_window
  260.     $popupwindow.update
  261.     $popupwindow.dispose if !$popupwindow.disposed? and $popupwindow.contents_opacity == 0
  262.     $popupwindow = nil if $popupwindow.disposed?
  263.   end
  264.   def pre_terminate
  265.     popup_preterminate
  266.     $popupwindow.visible = false unless $popupwindow.nil?
  267.   end
  268. end

点评

两个几乎无关的脚本,怎么改...  发表于 2015-2-11 10:27
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-15 17:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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