查看: 2655|回复: 9

[已经过期] 这个脚本状态动画怎么弄一直循环 不闪烁 攻击时候也一直...

[复制链接]
梦石
0
星屑
208
在线时间
152 小时
注册时间
2011-4-22
回帖
25
发表于 2015-11-6 00:03:25 | 显示全部楼层 |阅读模式

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

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

×
这个脚本状态动画怎么弄一直循环 不闪烁 攻击时候也一直... {:4_130:}

  1. #==============================================================================
  2. # +++ MOG - Animation (1.5) +++
  3. # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4. #  By Moghunter
  5. #  [url]http://www.atelier-rgss.com/RGSS/RGSS_VX_ACE.html[/url]
  6. #==============================================================================
  7. # 使数据库中的动画用途更广
  8. #==============================================================================
  9. # 写在技能、物品、状态的备注中 ID = 动画ID
  10. # ----------------------------------------
  11. # ● 命中动画 ●
  12. #   <Hit Animation = ID> 当攻击命中目标后的动画
  13. # ----------------------------------------
  14. # ● 启动动画① ●
  15. #   <Use Animation = ID> 攻击前的动画 可以理解为准备动作
  16. #                        此动画以使用者自己为目标 可以设计成攻击动作
  17. # ----------------------------------------
  18. # ● 启动动画② ●
  19. #   <Wait Use Animation = ID> 播放完启动动画后才会显示技能动画
  20. # ----------------------------------------
  21. # ● 状态动画<循环> ●
  22. #   <Loop Animation = ID> 写在状态备注中 当附加了此状态后会循环播放的动画
  23. # ----------------------------------------
  24. # ● 死亡动画 ●
  25. #   <Death Animation = ID> 濒死时播放的动画
  26. #==============================================================================
  27. module MOG_ANIMATION_PLUS
  28.   # 忽略等待时间的动画ID。
  29.   IGNORE_WAIT_TIME_ANIMATION_ID = [
  30.     1, 3, 21, 50,

  31.   999]

  32.   # 状态动画循环速度
  33.   STATES_LOOP_SPEED = 30

  34.   # 升级动画
  35.   LEVEL_UP_ANIMATION = 2
  36. end
  37. #==============================================================================
  38. $imported = {} if $imported.nil?
  39. $imported[:mog_animation_plus] = true
  40. #==============================================================================
  41. # ■ Game Battler
  42. #==============================================================================
  43. class Game_Battler < Game_BattlerBase
  44.   attr_accessor :animation_loop
  45.   #--------------------------------------------------------------------------
  46.   # ● Initialize
  47.   #--------------------------------------------------------------------------
  48.   alias mog_animation_plus_initialize initialize
  49.   def initialize
  50.       mog_animation_plus_initialize
  51.       @animation_loop = []
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● Add New State
  55.   #--------------------------------------------------------------------------
  56.   alias mog_animation_plus_add_new_state add_new_state
  57.   def add_new_state(state_id)
  58.       mog_animation_plus_add_new_state(state_id)
  59.       check_loop_animation
  60.   end   
  61.   #--------------------------------------------------------------------------
  62.   # ● Erase State
  63.   #--------------------------------------------------------------------------
  64.   alias mog_animation_plus_erase_state erase_state
  65.   def erase_state(state_id)  
  66.       mog_animation_plus_erase_state(state_id)  
  67.       check_loop_animation
  68.   end  
  69.   #--------------------------------------------------------------------------
  70.   # ● Check Loop Animation
  71.   #--------------------------------------------------------------------------
  72.   def check_loop_animation
  73.       @animation_loop.clear
  74.       self.states.each_with_index do |i, index|
  75.       if i.note =~ /<Loop Animation = (\d+)>/i   
  76.          @animation_loop.push([$1.to_i,0, index + 1, true])
  77.       end
  78.       end
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # ● Item Apply
  82.   #--------------------------------------------------------------------------
  83.   alias mog_animation_plus_item_apply item_apply
  84.   def item_apply(user, item)
  85.       mog_animation_plus_item_apply(user, item)
  86.       execute_animation_plus_hit(item) if @result.success
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● Execute Animation Plus Hit
  90.   #--------------------------------------------------------------------------
  91.   def execute_animation_plus_hit(item)
  92.       return if item == nil
  93.       return if !SceneManager.scene_is?(Scene_Battle)
  94.       self.animation_id = $1.to_i if item.note =~ /<Hit Animation = (\d+)>/i   
  95.       if self.dead?
  96.          if self.is_a?(Game_Enemy)
  97.             battler = $data_enemies[self.enemy_id]
  98.          else
  99.             battler = $data_actors[self.id]
  100.          end  
  101.          self.animation_id = $1.to_i if
  102.                              battler.note =~ /<Death Animation = (\d+)>/i
  103.       end
  104.   end
  105. end
  106. #==============================================================================
  107. # ■ Sprite_Base
  108. #==============================================================================
  109. class Sprite_Base < Sprite  
  110.   #--------------------------------------------------------------------------
  111.   # ● Battle Animation?
  112.   #--------------------------------------------------------------------------
  113.   def battle_animation?
  114.       if @animation != nil
  115.          if MOG_ANIMATION_PLUS::
  116.             IGNORE_WAIT_TIME_ANIMATION_ID.include?(@animation.id)
  117.             return false
  118.          end
  119.          return true         
  120.       end  
  121.       return false
  122.   end
  123. end  
  124. #==============================================================================
  125. # ■ Sprite Battler
  126. #==============================================================================
  127. class Sprite_Battler < Sprite_Base
  128.   #--------------------------------------------------------------------------
  129.   # ● Update Position
  130.   #--------------------------------------------------------------------------
  131.   alias mog_animation_plus_update_position update_position
  132.   def update_position
  133.       mog_animation_plus_update_position
  134.       update_loop_animation if can_loop_animation?
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● Can Loop Animation?
  138.   #--------------------------------------------------------------------------
  139.   def can_loop_animation?
  140.       return false if BattleManager.in_turn?
  141.       return false if self.animation?
  142.       return false if @battler.animation_loop.empty? or @battler.dead?  
  143.       if $imported[:mog_battle_hud_ex]
  144.       return false if
  145.          $game_message.visible and MOG_BATTLE_HUD_EX::MESSAGE_WINDOW_FADE_HUD
  146.       return false if !$game_temp.battle_hud_visible
  147.       end         
  148.       return true
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● Update Loop Animation
  152.   #--------------------------------------------------------------------------
  153.   def update_loop_animation
  154.       for i in @battler.animation_loop
  155.           next if !i[3]
  156.           i[1] += 1
  157.           if i[1] >= MOG_ANIMATION_PLUS::STATES_LOOP_SPEED
  158.              i[1] = 0 ; @battler.animation_id = i[0] ; i[3] = false
  159.              if i[2] >= @battler.animation_loop.size
  160.                 for i in @battler.animation_loop
  161.                     i[1] = 0 ; i[3] = true
  162.                 end                 
  163.             end  
  164.           end
  165.           break           
  166.       end        
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● Update Z Correction
  170.   #--------------------------------------------------------------------------
  171.   def update_z_correction
  172.       return if !@animation
  173.       @ani_sprites.each do |sprite| sprite.z = self.z + 1 end
  174.   end  
  175. end
  176. #==============================================================================
  177. # ■ Spriteset_Battle
  178. #==============================================================================
  179. class Spriteset_Battle
  180.   #--------------------------------------------------------------------------
  181.   # ● Animation?
  182.   #--------------------------------------------------------------------------
  183.   def animation?
  184.       battler_sprites.any? {|sprite| sprite.battle_animation? }
  185.   end  
  186. end
  187. #==============================================================================
  188. # ■ Scene Battle
  189. #==============================================================================
  190. class Scene_Battle < Scene_Base
  191.   #--------------------------------------------------------------------------
  192.   # ● Start
  193.   #--------------------------------------------------------------------------
  194.   alias mog_animation_plus_start start
  195.   def start
  196.       $game_party.members.each {|actor| actor.check_loop_animation }   
  197.       mog_animation_plus_start
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ● Use Item
  201.   #--------------------------------------------------------------------------
  202.   alias mog_animation_plus_use_item use_item
  203.   def use_item
  204.       execute_cast_animation
  205.       mog_animation_plus_use_item        
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ● Execute Cast Animation
  209.   #--------------------------------------------------------------------------
  210.   def execute_cast_animation
  211.       return if @subject.current_action.item == nil rescue return
  212.       item = @subject.current_action.item
  213.       if item.note =~ /<Use Animation = (\d+)>/i
  214.          execute_animation(@subject, $1.to_i,false)   
  215.       elsif item.note =~ /<Wait Use Animation = (\d+)>/i  
  216.          execute_animation(@subject, $1.to_i,true)   
  217.       end  
  218.   end  
  219.   #--------------------------------------------------------------------------
  220.   # ● Execute Animation
  221.   #--------------------------------------------------------------------------
  222.   def execute_animation(subject , anime_id = 0, wait_animation = false)
  223.       return if anime_id <= 0 or subject == nil
  224.       subject.animation_id = anime_id rescue nil
  225.       if wait_animation
  226.          duration = ($data_animations[anime_id].frame_max * 4) + 1
  227.          for i in 0..duration
  228.              @spriteset.update ; Graphics.update
  229.          end      
  230.       end   
  231.   end  
  232. end   
  233. #==============================================================================
  234. # ■ Game Actor
  235. #==============================================================================
  236. class Game_Actor < Game_Battler
  237.   #--------------------------------------------------------------------------
  238.   # ● Level UP
  239.   #--------------------------------------------------------------------------
  240.   alias mog_animation_plus_level_up level_up
  241.   def level_up
  242.        mog_animation_plus_level_up
  243.        self.animation_id = MOG_ANIMATION_PLUS::LEVEL_UP_ANIMATION if
  244.                            can_lvup_animation?
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ● Can Lvup Animation
  248.   #--------------------------------------------------------------------------
  249.   def can_lvup_animation?
  250.       return false if !use_sprite?
  251.       return false if !SceneManager.scene_is?(Scene_Battle)
  252.       if $imported[:mog_battle_hud_ex]
  253.           return false if $game_message.visible and
  254.                           MOG_BATTLE_HUD_EX::MESSAGE_WINDOW_FADE_HUD
  255.           return false if !$game_temp.battle_hud_visible
  256.       end
  257.       return true
  258.   end
  259. end
复制代码
梦石
0
星屑
61
在线时间
251 小时
注册时间
2015-5-14
回帖
430
发表于 2015-11-6 18:50:02 | 显示全部楼层
什么鬼,你想问的是什么【・ヘ・?】
回复

使用道具 举报

梦石
10
星屑
39550
在线时间
1919 小时
注册时间
2010-11-14
回帖
3214

R考场第七期纪念奖

发表于 2015-11-7 23:07:13 | 显示全部楼层
这个好像是这段脚本无法避免的问题,可以试试我下面这个脚本。

点击展开/收起
  1. #==============================================================================
  2. #
  3. # �� Yanfly Engine Ace - State Animations v1.01
  4. # -- Last Updated: 2014.03.22
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. # -- Special Thanks:
  8. #    SoulPour777 for the Bug Fix for V1.01
  9. #==============================================================================

  10. $imported = {} if $imported.nil?
  11. $imported["YEA-StateAnimations"] = true

  12. #==============================================================================
  13. # �� Updates
  14. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  15. # 2014.03.22 - Some of the animations have been using the same reference count,
  16. #              which results to cancelling the animation.
  17. # 2011.12.23 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # �� Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # A missing feature from RPG Maker XP. Status effects had animations replaying
  23. # on them constantly to indicate that a user was affected by a state. Only the
  24. # state with the highest priority and possesses an animation will be played.
  25. #
  26. #==============================================================================
  27. # �� Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below �� Materials/�f�� but above �� Main. Remember to save.
  31. #
  32. # -----------------------------------------------------------------------------
  33. # State Notetags - These notetags go in the states notebox in the database.
  34. # -----------------------------------------------------------------------------
  35. # <state ani: x>
  36. # Causes the status effect to play battle animation x repeatedly on the battler
  37. # if the battler is affected by this state and if this state is the highest
  38. # priority state with an animation.
  39. #
  40. #==============================================================================
  41. # �� Compatibility
  42. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  43. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  44. # it will run with RPG Maker VX without adjusting.
  45. #
  46. #==============================================================================

  47. module YEA
  48.   module STATE_ANIMATION
  49.    
  50.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  51.     # - Adjust the state animation settings here. -
  52.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  53.     # These settings decide whether or not state animations will cause the
  54.     # screen to flash, play sound effects, and what kinds of zoom levels will
  55.     # be used on actors affected by states with animations.
  56.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  57.     PLAY_SOUND = false      # Play sounds for state animations?
  58.     PLAY_FLASH = false      # Use screen flash for state animations?
  59.    
  60.     PLAY_ACTOR = false       # Play animations on the actor?
  61.     ACTOR_ZOOM = 0.25       # Zoom level for animations on actors.
  62.    
  63.   end # STATE_ANIMATION
  64. end # YEA

  65. #==============================================================================
  66. # �� Editting anything past this point may potentially result in causing
  67. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  68. # halitosis so edit at your own risk.
  69. #==============================================================================

  70. module YEA
  71.   module REGEXP
  72.   module STATE
  73.    
  74.     STATEANI = /<(?:STATE_ANIMATION|state ani|animation|ani):[ ](\d+)>/i
  75.    
  76.   end # STATE
  77.   end # REGEXP
  78. end # YEA

  79. #==============================================================================
  80. # �� DataManager
  81. #==============================================================================

  82. module DataManager
  83.   
  84.   #--------------------------------------------------------------------------
  85.   # alias method: load_database
  86.   #--------------------------------------------------------------------------
  87.   class <<self; alias load_database_sani load_database; end
  88.   def self.load_database
  89.     load_database_sani
  90.     load_notetags_sani
  91.   end
  92.   
  93.   #--------------------------------------------------------------------------
  94.   # new method: load_notetags_sani
  95.   #--------------------------------------------------------------------------
  96.   def self.load_notetags_sani
  97.     for state in $data_states
  98.       next if state.nil?
  99.       state.load_notetags_sani
  100.     end
  101.   end
  102.   
  103. end # DataManager

  104. #==============================================================================
  105. # �� RPG::State
  106. #==============================================================================

  107. class RPG::State < RPG::BaseItem
  108.   
  109.   #--------------------------------------------------------------------------
  110.   # public instance variables
  111.   #--------------------------------------------------------------------------
  112.   attr_accessor :state_animation
  113.   
  114.   #--------------------------------------------------------------------------
  115.   # common cache: load_notetags_sani
  116.   #--------------------------------------------------------------------------
  117.   def load_notetags_sani
  118.     @state_animation = 0
  119.     #---
  120.     self.note.split(/[\r\n]+/).each { |line|
  121.       case line
  122.       #---
  123.       when YEA::REGEXP::STATE::STATEANI
  124.         @state_animation = $1.to_i
  125.       end
  126.     } # self.note.split
  127.     #---
  128.   end
  129.   
  130. end # RPG::State

  131. #==============================================================================
  132. # �� Sprite_Battler
  133. #==============================================================================

  134. class Sprite_Battler < Sprite_Base
  135.   
  136.   #--------------------------------------------------------------------------
  137.   # class variables
  138.   #--------------------------------------------------------------------------
  139.   @@state_ani_checker = []
  140.   @@state_ani_spr_checker = []
  141.   @@_reference_count = {}
  142.   
  143.   #--------------------------------------------------------------------------
  144.   # alias method: initialize
  145.   #--------------------------------------------------------------------------
  146.   alias sprite_battler_initialize_sani initialize
  147.   def initialize(viewport, battler = nil)
  148.     sprite_battler_initialize_sani(viewport, battler)
  149.     @state_ani_duration = 0
  150.   end
  151.   
  152.   #--------------------------------------------------------------------------
  153.   # alias method: dispose
  154.   #--------------------------------------------------------------------------
  155.   alias sprite_battler_dispose_sani dispose
  156.   def dispose
  157.     dispose_state_animation
  158.     sprite_battler_dispose_sani
  159.   end
  160.   
  161.   #--------------------------------------------------------------------------
  162.   # alias method: setup_new_effect
  163.   #--------------------------------------------------------------------------
  164.   alias sprite_battler_setup_new_effect_sani setup_new_effect
  165.   def setup_new_effect
  166.     sprite_battler_setup_new_effect_sani
  167.     setup_state_ani_effect
  168.   end
  169.   
  170.   #--------------------------------------------------------------------------
  171.   # new method: setup_state_ani_effect
  172.   #--------------------------------------------------------------------------
  173.   def setup_state_ani_effect
  174.     return if @battler.state_animation_id.nil?
  175.     if @battler.state_animation_id == 0
  176.       dispose_state_animation
  177.     else
  178.       animation = $data_animations[@battler.state_animation_id]
  179.       start_state_animation(animation)
  180.     end
  181.   end
  182.   
  183.   #--------------------------------------------------------------------------
  184.   # alias method: update
  185.   #--------------------------------------------------------------------------
  186.   alias sprite_battler_update_sani update
  187.   def update
  188.     sprite_battler_update_sani
  189.     update_state_animations
  190.   end
  191.   
  192.   #--------------------------------------------------------------------------
  193.   # new method: update_state_animations
  194.   #--------------------------------------------------------------------------
  195.   def update_state_animations
  196.     update_state_animation
  197.     @@state_ani_checker.clear
  198.     @@state_ani_spr_checker.clear
  199.   end
  200.   
  201.   #--------------------------------------------------------------------------
  202.   # new method: state_animation?
  203.   #--------------------------------------------------------------------------
  204.   def state_animation?
  205.     return !@state_animation.nil?
  206.   end
  207.   
  208.   #--------------------------------------------------------------------------
  209.   # new method: start_state_animation
  210.   #--------------------------------------------------------------------------
  211.   def start_state_animation(animation, mirror = false)
  212.     return if !@state_animation.nil? && @state_animation.id == animation.id
  213.     dispose_state_animation
  214.     @state_animation = animation
  215.     return if @state_animation.nil?
  216.     @state_ani_mirror = mirror
  217.     set_animation_rate
  218.     @state_ani_duration = @state_animation.frame_max * @ani_rate + 1
  219.     load_state_animation_bitmap
  220.     make_state_animation_sprites
  221.     set_state_animation_origin
  222.   end
  223.   
  224.   #--------------------------------------------------------------------------
  225.   # new method: load_state_animation_bitmap
  226.   #--------------------------------------------------------------------------
  227.   def load_state_animation_bitmap
  228.     animation1_name = @state_animation.animation1_name
  229.     animation1_hue = @state_animation.animation1_hue
  230.     animation2_name = @state_animation.animation2_name
  231.     animation2_hue = @state_animation.animation2_hue
  232.     @state_ani_bitmap1 = Cache.animation(animation1_name, animation1_hue)
  233.     @state_ani_bitmap2 = Cache.animation(animation2_name, animation2_hue)
  234.     if @@_reference_count.include?(@state_ani_bitmap1)
  235.       @@_reference_count[@state_ani_bitmap1] += 1
  236.     else
  237.       @@_reference_count[@state_ani_bitmap1] = 1
  238.     end
  239.     if @@_reference_count.include?(@ani_bitmap2)
  240.       @@_reference_count[@state_ani_bitmap2] += 1
  241.     else
  242.       @@_reference_count[@state_ani_bitmap2] = 1
  243.     end
  244.     Graphics.frame_reset
  245.   end
  246.   
  247.   #--------------------------------------------------------------------------
  248.   # new method: make_state_animation_sprites
  249.   #--------------------------------------------------------------------------
  250.   def make_state_animation_sprites
  251.     @state_ani_sprites = []
  252.     if @use_sprite && !@@state_ani_spr_checker.include?(@state_animation)
  253.       16.times do
  254.         sprite = ::Sprite.new(viewport)
  255.         sprite.visible = false
  256.         @state_ani_sprites.push(sprite)
  257.       end
  258.       if @state_animation.position == 3
  259.         @@state_ani_spr_checker.push(@animation)
  260.       end
  261.     end
  262.     @state_ani_duplicated = @@state_ani_checker.include?(@state_animation)
  263.     if !@state_ani_duplicated && @state_animation.position == 3
  264.       @@state_ani_checker.push(@state_animation)
  265.     end
  266.   end
  267.   
  268.   #--------------------------------------------------------------------------
  269.   # new method: set_state_animation_origin
  270.   #--------------------------------------------------------------------------
  271.   def set_state_animation_origin
  272.     if @state_animation.position == 3
  273.       if viewport == nil
  274.         @state_ani_ox = Graphics.width / 2
  275.         @state_ani_oy = Graphics.height / 2
  276.       else
  277.         @state_ani_ox = viewport.rect.width / 2
  278.         @state_ani_oy = viewport.rect.height / 2
  279.       end
  280.     else
  281.       @state_ani_ox = x - ox + width / 2
  282.       @state_ani_oy = y - oy + height / 2
  283.       if @state_animation.position == 0
  284.         @state_ani_oy -= height / 2
  285.       elsif @state_animation.position == 2
  286.         @state_ani_oy += height / 2
  287.       end
  288.     end
  289.   end
  290.   
  291.   #--------------------------------------------------------------------------
  292.   # new method: dispose_state_animation
  293.   #--------------------------------------------------------------------------
  294.   def dispose_state_animation
  295.     if @state_ani_bitmap1
  296.       @@_reference_count[@state_ani_bitmap1] -= 1
  297.       if @@_reference_count[@state_ani_bitmap1] == 0
  298.         @state_ani_bitmap1.dispose
  299.       end
  300.     end
  301.     if @state_ani_bitmap2
  302.       @@_reference_count[@state_ani_bitmap2] -= 1
  303.       if @@_reference_count[@state_ani_bitmap2] == 0
  304.         @state_ani_bitmap2.dispose
  305.       end
  306.     end
  307.     if @state_ani_sprites
  308.       @state_ani_sprites.each {|sprite| sprite.dispose }
  309.       @state_ani_sprites = nil
  310.       @state_animation = nil
  311.     end
  312.     @state_ani_bitmap1 = nil
  313.     @state_ani_bitmap2 = nil
  314.   end
  315.   
  316.   #--------------------------------------------------------------------------
  317.   # new method: update_state_animation
  318.   #--------------------------------------------------------------------------
  319.   def update_state_animation
  320.     return unless state_animation?
  321.     @state_ani_duration -= 1
  322.     if @state_ani_duration % @ani_rate == 0
  323.       if @state_ani_duration > 0
  324.         @state_frame_index = @state_animation.frame_max
  325.         change = (@state_ani_duration + @ani_rate - 1) / @ani_rate
  326.         @state_frame_index -= change
  327.         @state_animation.timings.each do |timing|
  328.           next unless timing.frame == @state_frame_index
  329.           state_animation_process_timing(timing)
  330.         end
  331.       else
  332.         @state_ani_duration = @state_animation.frame_max * @ani_rate + 1
  333.       end
  334.     end
  335.     return if @state_frame_index.nil?
  336.     state_animation_set_sprites(@state_animation.frames[@state_frame_index])
  337.     set_state_animation_origin
  338.   end
  339.   
  340.   #--------------------------------------------------------------------------
  341.   # new method: end_state_animation
  342.   #--------------------------------------------------------------------------
  343.   def end_state_animation
  344.     dispose_state_animation
  345.   end
  346.   
  347.   #--------------------------------------------------------------------------
  348.   # new method: state_animation_set_sprites
  349.   #--------------------------------------------------------------------------
  350.   def state_animation_set_sprites(frame)
  351.     return if @state_animation.nil?
  352.     return if frame.nil?
  353.     cell_data = frame.cell_data
  354.     @state_ani_sprites.each_with_index do |sprite, i|
  355.       next unless sprite
  356.       pattern = cell_data[i, 0]
  357.       if !pattern || pattern < 0
  358.         sprite.visible = false
  359.         next
  360.       end
  361.       sprite.bitmap = pattern < 100 ? @state_ani_bitmap1 : @state_ani_bitmap2
  362.       sprite.visible = true
  363.       sprite.src_rect.set(pattern % 5 * 192,
  364.         pattern % 100 / 5 * 192, 192, 192)
  365.       if @state_ani_mirror
  366.         sprite.x = @state_ani_ox - cell_data[i, 1]
  367.         sprite.y = @state_ani_oy + cell_data[i, 2]
  368.         sprite.angle = (360 - cell_data[i, 4])
  369.         sprite.mirror = (cell_data[i, 5] == 0)
  370.       else
  371.         sprite.x = @state_ani_ox + cell_data[i, 1]
  372.         sprite.y = @state_ani_oy + cell_data[i, 2]
  373.         sprite.angle = cell_data[i, 4]
  374.         sprite.mirror = (cell_data[i, 5] == 1)
  375.       end
  376.       sprite.z = self.z + 250 + i
  377.       sprite.ox = 96
  378.       sprite.oy = 96
  379.       sprite.zoom_x = cell_data[i, 3] / 100.0
  380.       sprite.zoom_y = cell_data[i, 3] / 100.0
  381.       if @battler.actor?
  382.         zoom = YEA::STATE_ANIMATION::ACTOR_ZOOM
  383.         sprite.zoom_x *= zoom
  384.         sprite.zoom_y *= zoom
  385.       end
  386.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  387.       sprite.blend_type = cell_data[i, 7]
  388.     end
  389.   end
  390.   
  391.   #--------------------------------------------------------------------------
  392.   # new method: state_animation_process_timing
  393.   #--------------------------------------------------------------------------
  394.   def state_animation_process_timing(timing)
  395.     timing.se.play if YEA::STATE_ANIMATION::PLAY_SOUND
  396.     case timing.flash_scope
  397.     when 1
  398.       self.flash(timing.flash_color, timing.flash_duration * @ani_rate)
  399.     when 2
  400.       return unless YEA::STATE_ANIMATION::PLAY_FLASH
  401.       if viewport && !@state_ani_duplicated
  402.         flash_amount = timing.flash_duration * @ani_rate
  403.         viewport.flash(timing.flash_color, flash_amount)
  404.       end
  405.     when 3
  406.       self.flash(nil, timing.flash_duration * @ani_rate)
  407.     end
  408.   end
  409.   
  410. end # Sprite_Battler

  411. #==============================================================================
  412. # �� Game_BattlerBase
  413. #==============================================================================

  414. class Game_BattlerBase
  415.   
  416.   #--------------------------------------------------------------------------
  417.   # public instance variables
  418.   #--------------------------------------------------------------------------
  419.   attr_accessor :state_animation_id
  420.   
  421.   #--------------------------------------------------------------------------
  422.   # alias method: refresh
  423.   #--------------------------------------------------------------------------
  424.   alias game_battlerbase_refresh_sani refresh
  425.   def refresh
  426.     game_battlerbase_refresh_sani
  427.     reload_state_animation
  428.   end
  429.   
  430.   #--------------------------------------------------------------------------
  431.   # new method: reload_state_animation
  432.   #--------------------------------------------------------------------------
  433.   def reload_state_animation
  434.     @state_animation_id = 0
  435.     return if actor? && !YEA::STATE_ANIMATION::PLAY_ACTOR
  436.     for state in states
  437.       next unless state.state_animation > 0
  438.       @state_animation_id = state.state_animation
  439.       break
  440.     end
  441.   end
  442.   
  443. end # Game_BattlerBase

  444. #==============================================================================
  445. #
  446. # �� End of File
  447. #
  448. #==============================================================================
复制代码

评分

参与人数 1星屑 +20 收起 理由
午睡的风铃 + 20 我很赞同

查看全部评分

用头画头像,用脚写脚本
回复

使用道具 举报

梦石
0
星屑
208
在线时间
152 小时
注册时间
2011-4-22
回帖
25
 楼主| 发表于 2015-11-8 21:55:15 | 显示全部楼层
KB.Driver 发表于 2015-11-7 23:07
这个好像是这段脚本无法避免的问题,可以试试我下面这个脚本。

[fold]#================================= ...

你这个脚本怎么用???
回复

使用道具 举报

梦石
10
星屑
39550
在线时间
1919 小时
注册时间
2010-11-14
回帖
3214

R考场第七期纪念奖

发表于 2015-11-9 18:08:55 | 显示全部楼层
lqly10 发表于 2015-11-8 21:55
你这个脚本怎么用???

看上面的注释:
# -----------------------------------------------------------------------------
# State Notetags - These notetags go in the states notebox in the database.
# -----------------------------------------------------------------------------
# <state ani: x>
# Causes the status effect to play battle animation x repeatedly on the battler
# if the battler is affected by this state and if this state is the highest
# priority state with an animation.
#
#==============================================================================
用头画头像,用脚写脚本
回复

使用道具 举报

梦石
0
星屑
208
在线时间
152 小时
注册时间
2011-4-22
回帖
25
 楼主| 发表于 2015-11-9 22:32:16 | 显示全部楼层
KB.Driver 发表于 2015-11-9 18:08
看上面的注释:
# -----------------------------------------------------------------------------
# S ...

亲啊  我小学没有毕业  郁闷 看不懂英文  有没有范例  或者教我怎么设置 怎么用  

点评

……用百度翻译一句一句翻大概就能整明白个差不多了吧……别告诉我你不会复制粘贴……  发表于 2015-11-10 08:06
回复

使用道具 举报

梦石
0
星屑
208
在线时间
152 小时
注册时间
2011-4-22
回帖
25
 楼主| 发表于 2015-11-10 13:15:48 | 显示全部楼层
lqly10 发表于 2015-11-9 22:32
亲啊  我小学没有毕业  郁闷 看不懂英文  有没有范例  或者教我怎么设置 怎么用   ...


试过了  多数翻译不了  翻译出来什么国家  数据 就没有了
回复

使用道具 举报

梦石
10
星屑
39550
在线时间
1919 小时
注册时间
2010-11-14
回帖
3214

R考场第七期纪念奖

发表于 2015-11-10 13:43:56 | 显示全部楼层
lqly10 发表于 2015-11-9 22:32
亲啊  我小学没有毕业  郁闷 看不懂英文  有没有范例  或者教我怎么设置 怎么用   ...

比如,你希望在附加了2号状态时在角色身上显示1号动画。
就在状态002的备注栏里写上:
<state ani: 1>

情形拓展一下就是:
你希望在附加了Y号状态时在角色身上显示X号动画。
就在状态Y的备注栏里写上:
<state ani: X>
用头画头像,用脚写脚本
回复

使用道具 举报

梦石
0
星屑
208
在线时间
152 小时
注册时间
2011-4-22
回帖
25
 楼主| 发表于 2015-11-11 00:15:33 | 显示全部楼层
KB.Driver 发表于 2015-11-10 13:43
比如,你希望在附加了2号状态时在角色身上显示1号动画。
就在状态002的备注栏里写上:

为什么我的用不了  求解http://pan.baidu.com/s/1c0wjazI
回复

使用道具 举报

梦石
0
星屑
1883
在线时间
157 小时
注册时间
2016-1-29
回帖
216
发表于 2018-12-5 11:15:11 | 显示全部楼层
KB.Driver 发表于 2015-11-10 13:43
比如,你希望在附加了2号状态时在角色身上显示1号动画。
就在状态002的备注栏里写上:

KB哥 我复制了也没有用啊?
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部