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

Project1

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

[已经过期] 请高手帮助我修改一下脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
9 小时
注册时间
2012-9-1
帖子
72
跳转到指定楼层
1
发表于 2012-9-2 19:50:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
把这个脚本变成也能显示敌人的伤害数值
  1. #==============================================================================
  2. # MOG VX - Combo Display V1.2
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com/
  6. #
  7. # ■ Apresenta a quantidade de acertos no alvo e o dano maximo.
  8. # ---------------------------------------------------------------------------
  9. # é necessário ter os arquivos imagens na pasta Graphics/Systems.
  10. # Combo_Damage.png
  11. # Combo_Hud.png
  12. # Combo_Number.png
  13. # ---------------------------------------------------------------------------
  14. module MOG
  15.   #Ativar tempo para fazer combo.
  16.   TIME_COUNT = true
  17.   # Tempo para fazer um combo. (60 = 1s) #180
  18.   COMBO_TIME = 300
  19.   # Cancelar a contagem de Combo caso o inimigo acertar o herói.
  20.   ENEMY_CANCEL_COMBO = true
  21.   # Posi??o geral das imagens. X Y
  22.   COMBO_POSITION = [350,20]
  23.   # Posi??o do número de HITS. X Y
  24.   HIT_POSITION = [15,23]
  25.   # Posi??o do número de dano. X Y
  26.   TOTAL_POSITION = [60,-17]
  27. end  
  28. #===============================================================================
  29. # ■ Game_Temp
  30. #===============================================================================
  31. class Game_Temp
  32.    attr_accessor :combo_hit
  33.    attr_accessor :max_damage   
  34.    attr_accessor :combo_time  
  35.   #--------------------------------------------------------------------------
  36.   # ● initialize
  37.   #--------------------------------------------------------------------------   
  38.    alias mog_combo_display_initialize initialize
  39.    def initialize
  40.        @combo_hit = 0
  41.        @max_damage = 0  
  42.        @combo_time = 0   
  43.        mog_combo_display_initialize
  44.    end
  45. end
  46. #===============================================================================
  47. # ■ Game_Battler
  48. #===============================================================================
  49. class Game_Battler
  50.   #--------------------------------------------------------------------------
  51.   # ● execute_damage
  52.   #--------------------------------------------------------------------------     
  53.   alias mog_combo_display_execute_damage execute_damage
  54.   def execute_damage(user)
  55.       mog_combo_display_execute_damage(user)
  56.       if @hp_damage > 0   
  57.           if user.is_a?(Game_Actor)  
  58.              $game_temp.combo_hit += 1
  59.              $game_temp.max_damage += @hp_damage   
  60.              $game_temp.combo_time = MOG::COMBO_TIME
  61.            else
  62.              $game_temp.combo_hit += 1
  63.              $game_temp.max_damage += @hp_damage   
  64.              $game_temp.combo_time = MOG::COMBO_TIME
  65.              $game_temp.combo_time = 0 if MOG::ENEMY_CANCEL_COMBO == true
  66.           end  
  67.       end  
  68.     end
  69. end  
  70. #===============================================================================
  71. # Combo_Sprite_Hud
  72. #===============================================================================
  73. class Combo_Sprite_Hud < Sprite
  74.    attr_accessor :combo_wait
  75.    include MOG
  76. #--------------------------------------------------------------------------
  77. # Initialize
  78. #--------------------------------------------------------------------------
  79.   def initialize
  80.      super  
  81.      @combo_wait = false
  82.      $game_temp.combo_time = 0
  83.      $game_temp.combo_hit = 0
  84.      $game_temp.max_damage = 0     
  85.      @combo_hit_old = 0
  86.      @animation_speed = 0
  87.      @pos_x = COMBO_POSITION[0]
  88.      @pos_x_fix = 0
  89.      @pos_y = COMBO_POSITION[1]
  90.      create_combo_sprite
  91.      create_total_damage_sprite     
  92.      create_hud_sprite     
  93.    end      
  94. #--------------------------------------------------------------------------
  95. # create_hud_sprite   
  96. #--------------------------------------------------------------------------
  97. def create_hud_sprite   
  98.      @hud = Sprite.new
  99.      @hud.bitmap = Cache.system("Combo_HUD")
  100.      @hud.z = 108
  101.      @hud.x = COMBO_POSITION[0]
  102.      @hud.y = COMBO_POSITION[1]
  103.      @hud.opacity = 250
  104.      @hud.visible = false
  105. end     
  106. #--------------------------------------------------------------------------
  107. # create_total_damage_sprite
  108. #--------------------------------------------------------------------------
  109. def create_total_damage_sprite   
  110.      @total_image = Cache.system("Combo_damage")
  111.      @total_bitmap = Bitmap.new(@combo_image.width,@combo_image.height)
  112.      @total = Sprite.new
  113.      @total.bitmap = @total_bitmap
  114.      @total_im_cw = @total_image.width / 10
  115.      @total_im_ch = @total_image.height+100     
  116.      @total_number_text = $game_temp.max_damage.abs.to_s.split(//)
  117.      for r in 0..@total_number_text.size - 1
  118.        @total_number_abs = @total_number_text[r].to_i
  119.        @total_src_rect = Rect.new(@total_im_cw * @total_number_abs, 0, @total_im_cw, @total_im_ch)
  120.        @total_bitmap.blt(40 + ((@total_im_cw - 12) *  r), 0, @total_image, @total_src_rect)        
  121.      end      
  122.      @total.z = 109
  123.      @total_orig_x = COMBO_POSITION[0] + TOTAL_POSITION[0]
  124.      @total_orig_y = COMBO_POSITION[1] + TOTAL_POSITION[1]
  125.      @total.x = @total_orig_x
  126.      @total.y = @total_orig_y
  127.      @total.zoom_x = 1.00
  128.      @total.zoom_y = 1.00
  129.      @total.opacity = 250  
  130.      @total.visible = false
  131. end     
  132. #--------------------------------------------------------------------------
  133. # create_combo_number  
  134. #--------------------------------------------------------------------------
  135. def create_combo_sprite
  136.      @combo_image = Cache.system("Combo_Number")
  137.      @combo_bitmap = Bitmap.new(@combo_image.width,@combo_image.height)
  138.      @combo = Sprite.new
  139.      @combo.bitmap = @combo_bitmap
  140.      @combo_im_cw = @combo_image.width / 10
  141.      @combo_im_ch = @combo_image.height     
  142.      @combo_number_text = $game_temp.combo_hit.abs.to_s.split(//)
  143.      for r in 0..@combo_number_text.size - 1
  144.        @combo_number_abs = @combo_number_text[r].to_i
  145.        @combo_src_rect = Rect.new(@combo_im_cw * @combo_number_abs, 0, @combo_im_cw, @combo_im_ch)
  146.        @combo_bitmap.blt(40 + ((@combo_im_cw - 12) *  r), 0, @combo_image, @combo_src_rect)        
  147.      end      
  148.      @combo.z = 109
  149.      @combo_orig_x = COMBO_POSITION[0] + HIT_POSITION[0]
  150.      @combo_orig_y = COMBO_POSITION[1] + HIT_POSITION[1]
  151.      @pos_x_fix = (@combo_im_cw / 2 * @combo_number_text.size)
  152.      @combo.x = @combo_orig_x - @pos_x_fix     
  153.      @combo.y = @combo_orig_y
  154.      @combo.zoom_x = 1.00
  155.      @combo.zoom_y = 1.00
  156.      @combo.opacity = 250
  157.      @combo.visible = false
  158. end  
  159. #--------------------------------------------------------------------------
  160. # Dispose
  161. #--------------------------------------------------------------------------
  162.    def dispose
  163.        @combo_bitmap.dispose
  164.        @combo.bitmap.dispose
  165.        @combo.dispose
  166.        @hud.bitmap.dispose
  167.        @hud.dispose
  168.        @total_bitmap.dispose
  169.        @total.bitmap.dispose
  170.        @total.dispose
  171.        super
  172.    end
  173. #--------------------------------------------------------------------------
  174. # Refresh
  175. #--------------------------------------------------------------------------
  176.    def refresh
  177.      @combo_hit_old = $game_temp.combo_hit
  178.      @combo.bitmap.clear
  179.      @total.bitmap.clear
  180.      @combo_number_text = $game_temp.combo_hit.abs.to_s.split(//)
  181.      for r in 0..@combo_number_text.size - 1
  182.        @combo_number_abs = @combo_number_text[r].to_i
  183.        @combo_src_rect = Rect.new(@combo_im_cw * @combo_number_abs, 0, @combo_im_cw, @combo_im_ch)
  184.        @combo_bitmap.blt(40 + ((@combo_im_cw - 12) *  r), 0, @combo_image, @combo_src_rect)        
  185.      end            
  186.      @total_number_text = $game_temp.max_damage.abs.to_s.split(//)
  187.      for r in 0..@total_number_text.size - 1
  188.        @total_number_abs = @total_number_text[r].to_i
  189.        @total_src_rect = Rect.new(@total_im_cw * @total_number_abs, 0, @total_im_cw, @total_im_ch)
  190.        @total_bitmap.blt(40 + ((@total_im_cw - 12) *  r), 20, @total_image, @total_src_rect)        
  191.      end
  192.        #Combo Position
  193.        @pos_x_fix = (@combo_im_cw / 2 * @combo_number_text.size)
  194.        @combo.x = @combo_orig_x - @pos_x_fix
  195.        @combo.y = @combo_orig_y
  196.        @combo.zoom_x = 2
  197.        @combo.zoom_y = 2
  198.        @combo.opacity = 70
  199.        @combo.visible = true
  200.        #Total Position      
  201.        @total.x = @total_orig_x + 20
  202.        @total.y = @total_orig_y     
  203.        @total.opacity = 100
  204.        @total.visible = true            
  205.        #Hud Position
  206.        @hud.x = COMBO_POSITION[0]
  207.        @hud.y = COMBO_POSITION[1]
  208.        @hud.opacity = 255
  209.        @hud.visible = true
  210. end   
  211. #--------------------------------------------------------------------------
  212. # Slide Update
  213. #--------------------------------------------------------------------------
  214.   def slide_update
  215.     return if @combo.visible == false
  216.     if $game_temp.combo_time > 0 and @combo_wait == false
  217.        $game_temp.combo_time -= 1 if TIME_COUNT == true
  218.     end
  219.     if $game_temp.combo_time > 0 and $game_temp.combo_hit > 0   
  220.          #Total Damage
  221.          if @total.x > @total_orig_x
  222.             @total.x -= 1
  223.             @total.opacity += 8
  224.          else   
  225.             @total.x = @total_orig_x
  226.             @total.opacity = 255
  227.          end  
  228.          #Combo
  229.          if @combo.zoom_x > 1.00
  230.             @combo.zoom_x -= 0.05
  231.             @combo.zoom_y -= 0.05      
  232.             @combo.opacity += 8
  233.          else
  234.             @combo.zoom_x = 1
  235.             @combo.zoom_y = 1
  236.             @combo.opacity = 255
  237.             @combo.x = @combo_orig_x - @pos_x_fix
  238.             @combo.y = @combo_orig_y
  239.          end           
  240.      elsif $game_temp.combo_time == 0 and @combo.visible == true
  241.            @combo.x -= 5
  242.            @combo.opacity -= 10
  243.            @total.x -= 3
  244.            @total.opacity -= 10
  245.            @hud.x += 5
  246.            @hud.opacity -= 10     
  247.            $game_temp.combo_hit = 0
  248.            @combo_hit_old = $game_temp.combo_hit
  249.            $game_temp.max_damage = 0
  250.            if @combo.opacity <= 0
  251.               @combo.visible = false
  252.               @total.visible = false
  253.               @hud.visible = false
  254.            end  
  255.      end   
  256.   end
  257. #--------------------------------------------------------------------------
  258. # Cancel
  259. #--------------------------------------------------------------------------   
  260.   def cancel
  261.       $game_temp.combo_hit = 0
  262.       $game_temp.max_damage = 0
  263.       $game_temp.combo_time = 0      
  264.       @combo_hit_old = $game_temp.combo_hit
  265.   end  
  266. #--------------------------------------------------------------------------
  267. # Clear
  268. #--------------------------------------------------------------------------     
  269.   def clear
  270.       $game_temp.combo_time = 0
  271.   end      
  272. #--------------------------------------------------------------------------
  273. # Update
  274. #--------------------------------------------------------------------------
  275.   def update
  276.     super
  277.     refresh if $game_temp.combo_hit != @combo_hit_old
  278.     slide_update
  279.   end   
  280. end

  281. #===============================================================================
  282. # Scene_Battle
  283. #===============================================================================
  284. class Scene_Battle < Scene_Base
  285.   #--------------------------------------------------------------------------
  286.   # ● start
  287.   #--------------------------------------------------------------------------
  288.   alias mog_combo_start start
  289.   def start
  290.     create_cb_sprite
  291.     mog_combo_start
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # ● create_cb_sprite
  295.   #--------------------------------------------------------------------------  
  296.   def create_cb_sprite
  297.      @combo_sprite = Combo_Sprite_Hud.new
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● dispose_info_viewport
  301.   #--------------------------------------------------------------------------  
  302.   alias mog_combo_dispose_info_viewport dispose_info_viewport  
  303.   def dispose_info_viewport
  304.      mog_combo_dispose_info_viewport
  305.      @combo_sprite.dispose
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # ● update_basic
  309.   #--------------------------------------------------------------------------
  310.   alias mog_combo_update_basic update_basic
  311.   def update_basic(main = false)
  312.     mog_combo_update_basic(main)
  313.     @combo_sprite.update      
  314.   end      
  315.   #--------------------------------------------------------------------------
  316.   # ● wait_for_animation
  317.   #--------------------------------------------------------------------------
  318.   alias mog_combo_wait_for_animation wait_for_animation
  319.   def wait_for_animation
  320.     mog_combo_wait_for_animation
  321.     while @spriteset.animation?
  322.           @combo_sprite.combo_wait = true
  323.     end
  324.           @combo_sprite.combo_wait = false
  325.   end   
  326.   #--------------------------------------------------------------------------
  327.   # ● mog_combo_process_victory
  328.   #--------------------------------------------------------------------------   
  329.   alias mog_combo_process_victory process_victory
  330.   def process_victory
  331.       @combo_sprite.clear  
  332.       mog_combo_process_victory
  333.   end   
  334. end  

  335. $mog_rgssvx_combo_display = true
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-11-20 11:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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