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

Project1

 找回密码
 注册会员
搜索
查看: 1481|回复: 3

[已经解决] 脚本查错

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
212 小时
注册时间
2012-3-5
帖子
228
发表于 2012-12-18 23:48:28 | 显示全部楼层 |阅读模式
2星屑
使用下面的敌人动作脚本在角色被怪物打败时会跳出如下错误,我工程的分辨率是640×480,请帮我修复脚本错误,谢谢。需要提供其他信息的请留言!
QQ截图20121218233848.jpg

RUBY 代码复制
  1. #==============================================================================
  2. # +++ MOG - BATTLER MOTION (v1.3) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]http://www.atelier-rgss.com/[/url]
  6. #==============================================================================
  7. # Adiciona efeitos de animações nos sprites dos battlers.
  8. # ● Animação inicial (entrada)de batalha.
  9. # ● Animação de espera.
  10. # ● Animação de ação.
  11. # ● Animação de dano.
  12. # ● Animação de collapso.
  13. #==============================================================================
  14.  
  15. #==============================================================================
  16. # ● Histórico (Version History)
  17. #==============================================================================
  18. # v 1.3 - Correção na posição do battler após receber o dano. (Actor)
  19. # v 1.2 - Melhoria na codificação do script. (Melhor compatibilidade.)
  20. #       - Adição do colapso tipo 6.
  21. #       - Adição do efeito de ação tipo 6 e 7.
  22. #       - Adição do efeito de animação inicial tipo 5.
  23. # v 1.1 - Ativar animação em battler abatidos. (Ex - Animações de Reviver.)
  24. #       - Opção de ativar ou não efeito de colapso para os personagens.
  25. # v 1.0 - Primeiro lançamento.
  26. #==============================================================================
  27.  
  28.  
  29. #==============================================================================
  30. # ● CONFIGURAÇÃO
  31. #==============================================================================
  32. # ■ Animação inicial de entrada ao começar a batalha.
  33. #==============================================================================
  34. # Coloque as seguintes Tags na caixa de notas dos inimigos ou personagens.
  35. #
  36. # <Motion Appear = X>
  37. #
  38. # X = 0
  39. # Battler desliza horizontalmente.
  40. #
  41. # X = 1
  42. # Battler desliza verticalmente.
  43. #
  44. # X = 2
  45. # Battler rola (Cambalhota O_o) pela tela.
  46. #
  47. # X = 3
  48. # Zoom IN
  49. #
  50. # X = 4
  51. # Zoom Out
  52. #
  53. # X = 5
  54. # Efeito de emergir do solo.
  55. #
  56. #==============================================================================
  57. # ■ Animações dos battlers em modo espera.
  58. #==============================================================================
  59. # Coloque as seguintes Tags na caixa de notas dos inimigos ou personagens.
  60. #
  61. # <Motion Standby = X>
  62. #
  63. # X = 0
  64. # Ativa o efeito do battler respirando.
  65. #
  66. # X = 1
  67. # Ativa o efeito do battler levitando.
  68. #
  69. # X = 2
  70. # Ativa o efeito do battler movimentando para os lados.
  71. #
  72. #==============================================================================
  73. # ■ Animações dos battlers em modo de ação.
  74. #==============================================================================
  75. # Coloque as seguintes Tags na caixa de notas de itens ou habilidades.
  76. #
  77. # <Motion Action = X>
  78. #
  79. # X = 0
  80. # Ativa o efeito de ação de zoom.
  81. #
  82. # X = 1
  83. # Ativa o efeito de ação de pular.
  84. #
  85. # X = 2
  86. # Ativa o efeito de girar para a esquerda.
  87. #
  88. # X = 3
  89. # Ativa o efeito de girar para a direita.
  90. #
  91. # X = 4
  92. # Ativa o efeito de tremer.
  93. #
  94. # X = 5
  95. # Ativa o efeito de ação frontal.
  96. #
  97. # X = 6
  98. # Ativa o efeito de dar um passo para esquerda.
  99. #
  100. # X = 7
  101. # Ativa o efeito de de dar um passo para direita.
  102. #
  103. #==============================================================================
  104. # ■ Animações dos battlers em Colapso.
  105. #==============================================================================
  106. # Coloque as seguintes Tags na caixa de notas dos inimigos ou personagens.
  107. #
  108. # <Motion Collapse = X>
  109. #
  110. # X = 0
  111. # Ativa colapso na vertical.
  112. #
  113. # X = 1
  114. # Ativa o colapso na horizontal.
  115. #
  116. # X = 2
  117. # Ativa o colapso em Zoom OUT.
  118. #
  119. # X = 3
  120. # Ativa o colapso em Zoom IN.
  121. #
  122. # X = 4
  123. # Ativa o colapso em Zoom IN e Zoom OUT.
  124. #
  125. # X = 5
  126. # Ativa o colapso em Modo Boss.
  127. #
  128. # X = 6
  129. # Não ativa colapso.(Do nothing)
  130. #
  131. #==============================================================================
  132. # ■ Ativar animação de dano em condições maléficas.
  133. #==============================================================================
  134. # Coloque a seguinte Tag na caixa de notas de condições para ativar o efeito
  135. # de dano.
  136. #
  137. # <Bad State>
  138. #
  139. #==============================================================================
  140.  
  141.  
  142. #==============================================================================
  143. # ■ Game_Battler
  144. #==============================================================================
  145. class Game_Battler < Game_BattlerBase
  146.  
  147.    attr_accessor :motion_start
  148.    attr_accessor :motion_stand
  149.    attr_accessor :motion_action
  150.    attr_accessor :motion_damage
  151.    attr_accessor :motion_collapse
  152.  
  153.   #--------------------------------------------------------------------------
  154.   # ● Initialize
  155.   #--------------------------------------------------------------------------      
  156.    alias mog_motion_animation_initialize initialize
  157.    def initialize
  158.        mog_motion_animation_initialize
  159.        @motion_start = -1
  160.        @motion_stand = [-1,0]
  161.        @motion_action = [-1,0]
  162.        @motion_collapse = [7,0]
  163.        @motion_damage = [0,0]
  164.    end     
  165.  
  166.   #--------------------------------------------------------------------------
  167.   # ● Added New State
  168.   #--------------------------------------------------------------------------  
  169.   alias mog_motion_animation_add_new_state add_new_state
  170.   def add_new_state(state_id)
  171.       mog_motion_animation_add_new_state(state_id)
  172.       self.motion_damage[0] = 1 if $data_states[state_id].note =~ /<Bad State>/
  173.   end   
  174.  
  175. end
  176.  
  177. #==============================================================================
  178. # ■ Game_Enemy
  179. #==============================================================================
  180. class Game_Enemy < Game_Battler
  181.  
  182.   #--------------------------------------------------------------------------
  183.   # ● Initialize
  184.   #--------------------------------------------------------------------------
  185.   alias mog_motion_animation_enemy_initialize initialize
  186.   def initialize(index, enemy_id)
  187.       mog_motion_animation_enemy_initialize(index, enemy_id)
  188.       setup_motion_animation(enemy_id)
  189.   end
  190.  
  191.   #--------------------------------------------------------------------------
  192.   # ● Setup Motion Animation
  193.   #--------------------------------------------------------------------------  
  194.   def setup_motion_animation(enemy_id)
  195.       self.motion_stand[0] = $1.to_i if  enemy.note =~ /<Motion Standby = (\d+)>/i
  196.       self.motion_collapse[0] = $1.to_i if  enemy.note =~ /<Motion Collapse = (\d+)>/i
  197.       self.motion_start =  $1.to_i if  enemy.note =~ /<Motion Appear = (\d+)>/i
  198.   end
  199. end
  200.  
  201. #==============================================================================
  202. # ■ Game Actor
  203. #==============================================================================
  204. class Game_Actor < Game_Battler
  205.  
  206.   #--------------------------------------------------------------------------
  207.   # ● Setup
  208.   #--------------------------------------------------------------------------
  209.   alias mog_motion_animation_actor_setup setup
  210.   def setup(actor_id)
  211.       mog_motion_animation_actor_setup(actor_id)
  212.       self.motion_stand[0] = $1.to_i if  actor.note =~ /<Motion Standby = (\d+)>/i
  213.       self.motion_collapse[0] = $1.to_i if  actor.note =~ /<Motion Collapse = (\d+)>/i      
  214.       self.motion_start =  $1.to_i if  actor.note =~ /<Motion Appear = (\d+)>/i  
  215.   end
  216.  
  217. end
  218.  
  219. #==============================================================================
  220. # ■ Game_ActionResult
  221. #==============================================================================
  222. class Game_ActionResult
  223.  
  224.   #--------------------------------------------------------------------------
  225.   # ● HP Damage Text
  226.   #--------------------------------------------------------------------------
  227.   alias mog_motion_animation_hp_damage_text hp_damage_text
  228.   def hp_damage_text
  229.       mog_motion_animation_hp_damage_text
  230.       @battler.motion_damage[0] = 1 if @hp_damage > 0
  231.   end  
  232. end   
  233.  
  234. #==============================================================================
  235. # ■ Sprite Battler
  236. #==============================================================================
  237. class Sprite_Battler < Sprite_Base
  238.  
  239.   #--------------------------------------------------------------------------
  240.   # ● Update Position
  241.   #--------------------------------------------------------------------------  
  242.   alias mog_motion_animation_update_position update_position
  243.   def update_position
  244.       if @battler.use_sprite?
  245.          update_motion_animation
  246.          return
  247.       end   
  248.       mog_motion_animation_update_position
  249.   end  
  250.  
  251.   #--------------------------------------------------------------------------
  252.   # ● Update Motion Animation
  253.   #--------------------------------------------------------------------------   
  254.   def update_motion_animation
  255.       setup_initial_motion
  256.       execute_start_animation
  257.       return if @wait_motion_start
  258.       if can_execute_collapse?
  259.          execute_motion_collapse
  260.       else  
  261.          execute_motion_damage
  262.          execute_motion_animation
  263.          execute_motion_action
  264.       end
  265.   end
  266.  
  267.   #--------------------------------------------------------------------------
  268.   # ● Setup Initial Motion
  269.   #--------------------------------------------------------------------------      
  270.   def setup_initial_motion
  271.       return if @motion_initial != nil
  272.       @motion_initial = true
  273.       @collapse_done = false
  274.       @motion_speed = 0
  275.       @start_speed = [0,0]
  276.       @battler.motion_collapse[1] = 0
  277.       self.x = @battler.screen_x rescue 0
  278.       self.y = @battler.screen_y rescue 0
  279.       self.z = @battler.screen_z rescue 100
  280.       setup_motion_stand
  281.       @original_set = [self.x, self.y, self.zoom_x,self.zoom_y,self.mirror,self.angle,self.opacity]      
  282.       setup_motion_start
  283.       setup_motion_damage            
  284.       setup_motion_action
  285.   end  
  286.  
  287.   #--------------------------------------------------------------------------
  288.   # ● Return Set
  289.   #--------------------------------------------------------------------------         
  290.   def return_set(value)
  291.       self.x = value[0]
  292.       self.y = value[1]
  293.       self.zoom_x = value[2]
  294.       self.zoom_y = value[3]
  295.       self.mirror = value[4]
  296.       self.angle = value[5]
  297.       self.opacity = value[6]
  298.   end  
  299.  
  300.   #--------------------------------------------------------------------------
  301.   # ● setup_motion_start
  302.   #--------------------------------------------------------------------------            
  303.   def setup_motion_start
  304.       @wait_motion_start = true
  305.       @scr_rect_speed = 1
  306.       case @battler.motion_start
  307.          when 0  
  308.             self.x = 0 - (self.bitmap.width + rand(100))
  309.          when 1
  310.             self.y = 0 - (self.bitmap.height + rand(100))
  311.          when 2   
  312.             self.angle = 360
  313.             self.x = 0 - self.bitmap.width
  314.          when 3   
  315.             self.zoom_x = 1.5 + (rand(10) / 100.0)
  316.             self.zoom_y = self.zoom_x
  317.             self.opacity = 0
  318.          when 4
  319.             self.zoom_x = 0.2 + (rand(10) / 100.0)
  320.             self.zoom_y = self.zoom_x
  321.             self.opacity = 0
  322.          when 5   
  323.             self.src_rect.y = -self.bitmap.height
  324.             @scr_rect_speed = self.bitmap.height / 40
  325.             @scr_rect_speed = 1 if @scr_rect_speed <= 0
  326.          else   
  327.            @wait_motion_start = false
  328.       end   
  329.   end  
  330.  
  331.   #--------------------------------------------------------------------------
  332.   # ● Setup Motion Damage
  333.   #--------------------------------------------------------------------------        
  334.   def setup_motion_damage
  335.       @battler.motion_damage = [0,0]
  336.       @damage_pre_set = [self.x, self.y, self.zoom_x,self.zoom_y,self.mirror,self.angle,self.opacity]
  337.   end
  338.  
  339.   #--------------------------------------------------------------------------
  340.   # ● Execute Start Animation
  341.   #--------------------------------------------------------------------------         
  342.   def execute_start_animation
  343.       return if !@wait_motion_start
  344.       s_x = 1 + ((self.x - @original_set[0]).abs / (20 + @start_speed[0]))
  345.       s_y = 1 + ((self.y - @original_set[1]).abs / (20 + @start_speed[1]))      
  346.       if self.x < @original_set[0]
  347.          self.x += s_x
  348.          self.x = @original_set[0] if self.x >= @original_set[0]
  349.       elsif self.x > @original_set[0]
  350.          self.x -= s_x
  351.          self.x = @original_set[0] if self.x <= @original_set[0]
  352.       end
  353.       if self.y < @original_set[1]
  354.          self.y += s_y
  355.          self.y = @original_set[1] if self.y > @original_set[1]
  356.       elsif self.y > @original_set[1]
  357.          self.y -= s_y
  358.          self.y = @original_set[1] if self.y < @original_set[1]
  359.       end
  360.       if self.zoom_x != @original_set[2]
  361.          if self.zoom_x > @original_set[2]
  362.             self.zoom_x -= 0.01
  363.             self.zoom_x = @original_set[2] if self.zoom_x < @original_set[2]
  364.          elsif self.zoom_x < @original_set[2]
  365.             self.zoom_x += 0.01
  366.             self.zoom_x = @original_set[2] if self.zoom_x > @original_set[2]
  367.          end         
  368.       end  
  369.       if self.zoom_y != @original_set[3]
  370.          if self.zoom_y > @original_set[3]
  371.             self.zoom_y -= 0.01
  372.             self.zoom_y = @original_set[3] if self.zoom_y < @original_set[3]
  373.          elsif self.zoom_y < @original_set[3]
  374.             self.zoom_y += 0.01
  375.             self.zoom_y = @original_set[3] if self.zoom_y > @original_set[3]
  376.          end         
  377.       end        
  378.       self.opacity += 10
  379.       if self.angle > 0
  380.          self.angle -= 5
  381.          self.angle = @original_set[5] if self.angle < @original_set[5]
  382.       end
  383.       if self.src_rect.y != 0
  384.          self.src_rect.y += @scr_rect_speed
  385.          self.src_rect.y = 0 if self.src_rect.y > 0
  386.       end
  387.       if sprite_original_set?  
  388.          @wait_motion_start = false
  389.          self.src_rect.y = 0
  390.       end   
  391.   end  
  392.  
  393.   #--------------------------------------------------------------------------
  394.   # ● Sprite original Set?
  395.   #--------------------------------------------------------------------------         
  396.   def sprite_original_set?
  397.       return false if self.x != @original_set[0]
  398.       return false if self.y != @original_set[1]
  399.       return false if self.zoom_x != @original_set[2]
  400.       return false if self.zoom_y != @original_set[3]      
  401.       return false if self.mirror != @original_set[4]
  402.       return false if self.angle != @original_set[5]
  403.       return false if self.opacity != @original_set[6]
  404.       return false if self.src_rect.y != 0
  405.       return true
  406.   end  
  407.  
  408.   #--------------------------------------------------------------------------
  409.   # ● Setup Initial Motion
  410.   #--------------------------------------------------------------------------        
  411.   def execute_motion_damage
  412.       damage_refresh
  413.       update_motion_damage
  414.   end
  415.  
  416.   #--------------------------------------------------------------------------
  417.   # ● Damage Refresh
  418.   #--------------------------------------------------------------------------         
  419.   def damage_refresh
  420.       return if @battler.motion_damage[0] == 0
  421.       if @battler.motion_damage[1] == 0
  422.          @damage_pre_set = [self.x, self.y, self.zoom_x,self.zoom_y,self.mirror,self.angle,self.opacity]
  423.       end
  424.       @battler.motion_damage[0] = 0
  425.       @battler.motion_damage[1] = 45
  426.   end
  427.  
  428.   #--------------------------------------------------------------------------
  429.   # ● Update Motion Damage
  430.   #--------------------------------------------------------------------------            
  431.   def update_motion_damage
  432.       return if @battler.motion_damage[1] == 0
  433.       self.x = @damage_pre_set[0] + rand(@battler.motion_damage[1])
  434.       @battler.motion_damage[1] -= 1
  435.       if @battler.motion_damage[1] == 0
  436.          if $mog_rgss3_battle_hud != nil and @battler.is_a?(Game_Actor)
  437.             return_set(@original_set)
  438.          else  
  439.             return_set(@damage_pre_set)
  440.          end   
  441.       end  
  442.   end  
  443.  
  444.   #--------------------------------------------------------------------------
  445.   # ● Setup Motion Stand
  446.   #--------------------------------------------------------------------------        
  447.   def setup_motion_stand      
  448.       @breath_range = [0.9, 1.0]
  449.       @float_range = [@battler.screen_y - 10, @battler.screen_y + 10]
  450.       @side_range = [@battler.screen_x - 10, @battler.screen_x + 10]
  451.       @battler.motion_stand[1] = 0
  452.       case @battler.motion_stand[0]
  453.          when 0
  454.              self.zoom_y = @breath_range[0] + (rand(10) / 100.0)
  455.              @battler.motion_stand[1] = rand(2)
  456.          when 1
  457.              self.y += 10 - rand(20)
  458.              @battler.motion_stand[1] = rand(2)
  459.          when 2
  460.              self.x += 10 - rand(20)
  461.              @battler.motion_stand[1] = rand(2)            
  462.       end   
  463.   end
  464.  
  465.   #--------------------------------------------------------------------------
  466.   # ● Execute Motion Animation
  467.   #--------------------------------------------------------------------------        
  468.   def execute_motion_animation
  469.       return if @old_motion_action != -1
  470.       return if @battler.motion_damage[1] > 0
  471.       case @battler.motion_stand[0]
  472.          when 0
  473.              update_motion_breath
  474.          when 1  
  475.              update_motion_float
  476.          when 2
  477.              update_motion_side
  478.       end        
  479.   end  
  480.  
  481.   #--------------------------------------------------------------------------
  482.   # ● Update Motion Breath
  483.   #--------------------------------------------------------------------------         
  484.   def update_motion_breath  
  485.       case @battler.motion_stand[1]
  486.          when 0
  487.            self.zoom_y -= 0.002
  488.            if self.zoom_y <= @breath_range[0]
  489.               @battler.motion_stand[1] = 1
  490.               self.zoom_y = @breath_range[0]
  491.            end   
  492.          when 1  
  493.            self.zoom_y += 0.002
  494.            if self.zoom_y >= @breath_range[1]
  495.               @battler.motion_stand[1] = 0
  496.               self.zoom_y = @breath_range[1]
  497.            end   
  498.       end
  499.   end  
  500.  
  501.   #--------------------------------------------------------------------------
  502.   # ● Update Motion Float
  503.   #--------------------------------------------------------------------------         
  504.   def update_motion_float
  505.       @motion_speed += 1
  506.       return if @motion_speed < 5
  507.       @motion_speed = 0
  508.       case @battler.motion_stand[1]
  509.            when 0
  510.                 self.y -= 1
  511.                 if self.y < @float_range[0]
  512.                    self.y = @float_range[0]
  513.                    @battler.motion_stand[1] = 1
  514.                 end   
  515.            when 1  
  516.                 self.y += 1
  517.                 if self.y > @float_range[1]
  518.                    self.y = @float_range[1]
  519.                    @battler.motion_stand[1] = 0
  520.                 end                  
  521.       end
  522.   end   
  523.  
  524.   #--------------------------------------------------------------------------
  525.   # ● Update Motion Side
  526.   #--------------------------------------------------------------------------         
  527.   def update_motion_side
  528.       @motion_speed += 1
  529.       return if @motion_speed < 5
  530.       @motion_speed = 0
  531.       case @battler.motion_stand[1]
  532.            when 0
  533.                 self.x -= 1
  534.                 if self.x < @side_range[0]
  535.                    self.x = @side_range[0]
  536.                    @battler.motion_stand[1] = 1
  537.                 end   
  538.            when 1  
  539.                 self.x += 1
  540.                 if self.x > @side_range[1]
  541.                    self.x = @side_range[1]
  542.                    @battler.motion_stand[1] = 0
  543.                 end                  
  544.       end
  545.   end     
  546.  
  547. end
  548.  
  549. #==============================================================================
  550. # ■ Game Action
  551. #==============================================================================
  552. class Game_Action
  553.  
  554.   #--------------------------------------------------------------------------
  555.   # ● Prepare
  556.   #--------------------------------------------------------------------------                  
  557.   alias mog_motion_action_prepare prepare
  558.   def prepare
  559.       mog_motion_action_prepare   
  560.       set_motion_action
  561.   end
  562.  
  563.   #--------------------------------------------------------------------------
  564.   # ● Set Motion Action
  565.   #--------------------------------------------------------------------------                    
  566.   def set_motion_action
  567.       return if @item.object == nil or subject == nil      
  568.       subject.motion_action[0] = $1.to_i if @item.object.note =~ /<Motion Action = (\d+)>/i
  569.   end
  570.  
  571. end
  572.  
  573. #==============================================================================
  574. # ■ Sprite Battler
  575. #==============================================================================
  576. class Sprite_Battler < Sprite_Base
  577.  
  578.   #--------------------------------------------------------------------------
  579.   # ● Setup Motion Action
  580.   #--------------------------------------------------------------------------        
  581.   def setup_motion_action
  582.       @battler.motion_action = [-1,0]
  583.       @old_motion_action = @battler.motion_action[0]
  584.       @pre_set = [self.x, self.y, self.zoom_x,self.zoom_y,self.mirror,self.angle,self.opacity]
  585.   end
  586.  
  587.   #--------------------------------------------------------------------------
  588.   # ● Refresh Action
  589.   #--------------------------------------------------------------------------         
  590.   def refresh_action
  591.       return if @old_motion_action == @battler.motion_action[0]
  592.       if @old_motion_action == -1
  593.          @pre_set = [self.x, self.y, self.zoom_x,self.zoom_y,self.mirror,self.angle,self.opacity]
  594.       end
  595.       @battler.motion_action[1] = 0  
  596.       return_set(@pre_set)
  597.       @old_motion_action = @battler.motion_action[0]
  598.       self.src_rect.y =  0
  599.   end  
  600.  
  601.   #--------------------------------------------------------------------------
  602.   # ● Execute Motion Action
  603.   #--------------------------------------------------------------------------            
  604.   def execute_motion_action
  605.       return if @battler.motion_damage[1] > 0
  606.       refresh_action
  607.       update_motion_action
  608.   end  
  609.  
  610.   #--------------------------------------------------------------------------
  611.   # ● Update Motion Action
  612.   #--------------------------------------------------------------------------              
  613.   def update_motion_action
  614.       return if @battler.motion_action[0] == -1
  615.       @battler.motion_action[1] += 1
  616.       case @battler.motion_action[0]
  617.            when 0
  618.               update_motion_zoom
  619.            when 1
  620.               update_motion_jump
  621.            when 2  
  622.               update_motion_round_right
  623.            when 3
  624.               update_motion_round_left
  625.            when 4
  626.               update_motion_shake
  627.            when 5
  628.               update_motion_front
  629.            when 6   
  630.               update_motion_step_left
  631.            when 7
  632.               update_motion_step_right              
  633.       end
  634.   end
  635.  
  636.   #--------------------------------------------------------------------------
  637.   # ● Update Motion Step Left
  638.   #--------------------------------------------------------------------------                  
  639.   def update_motion_step_left
  640.       case @battler.motion_action[1]
  641.            when 1..20
  642.                 self.x -= 2
  643.            when 21..40  
  644.                 self.x += 2           
  645.            else
  646.            end_action
  647.       end   
  648.  
  649.   end  
  650.  
  651.   #--------------------------------------------------------------------------
  652.   # ● Update Motion Step Right
  653.   #--------------------------------------------------------------------------                  
  654.   def update_motion_step_right
  655.       case @battler.motion_action[1]
  656.            when 1..20
  657.                 self.x += 2
  658.            when 21..40  
  659.                 self.x -= 2           
  660.            else
  661.         end_action   
  662.       end   
  663.   end   
  664.  
  665.   #--------------------------------------------------------------------------
  666.   # ● Update Motion Shake
  667.   #--------------------------------------------------------------------------               
  668.   def update_motion_shake
  669.       self.x = @pre_set[0] + rand(@battler.motion_action[1])
  670.       end_action if @battler.motion_action[1] > 40
  671.   end   
  672.  
  673.   #--------------------------------------------------------------------------
  674.   # ● Update Motion Zoom
  675.   #--------------------------------------------------------------------------               
  676.   def update_motion_zoom
  677.       case @battler.motion_action[1]
  678.         when 1..20
  679.            self.zoom_x += 0.01
  680.            self.zoom_y += 0.01
  681.         when 21..40
  682.            self.zoom_x -= 0.01
  683.            self.zoom_y -= 0.01         
  684.         else  
  685.         end_action   
  686.       end
  687.   end
  688.  
  689.   #--------------------------------------------------------------------------
  690.   # ● Update Motion Jump
  691.   #--------------------------------------------------------------------------                  
  692.   def update_motion_jump
  693.       case @battler.motion_action[1]
  694.         when 1..20
  695.             self.y -= 9
  696.             self.zoom_x += 0.01
  697.             self.zoom_y += 0.01
  698.             self.mirror = true
  699.             self.angle += 9
  700.         when 21..40
  701.             self.y += 9
  702.             self.zoom_x -= 0.01
  703.             self.zoom_y -= 0.01            
  704.             self.mirror = false
  705.             self.angle += 9
  706.         else  
  707.         self.angle = 0
  708.         end_action   
  709.       end      
  710.   end
  711.  
  712.   #--------------------------------------------------------------------------
  713.   # ● Update Motion Front
  714.   #--------------------------------------------------------------------------                  
  715.   def update_motion_front
  716.       case @battler.motion_action[1]
  717.         when 1..20
  718.             self.y += 3
  719.             self.zoom_x += 0.02
  720.             self.zoom_y += 0.02
  721.         when 21..40
  722.             self.y -= 3
  723.             self.zoom_x -= 0.02
  724.             self.zoom_y -= 0.02            
  725.         else  
  726.         end_action   
  727.       end      
  728.   end
  729.  
  730.   #--------------------------------------------------------------------------
  731.   # ● Update Motion Round Left
  732.   #--------------------------------------------------------------------------                    
  733.   def update_motion_round_left
  734.       case @battler.motion_action[1]
  735.         when 1..15
  736.             self.y += 3
  737.             self.x -= 3
  738.             self.mirror = false
  739.         when 16..30
  740.             self.x += 6
  741.             self.mirror = true
  742.         when 31..45
  743.             self.y -= 3
  744.             self.x -= 3
  745.             self.mirror = false
  746.         else  
  747.         end_action  
  748.       end        
  749.   end
  750.  
  751.   #--------------------------------------------------------------------------
  752.   # ● Update Motion Round Right
  753.   #--------------------------------------------------------------------------                    
  754.   def update_motion_round_right
  755.       case @battler.motion_action[1]
  756.         when 1..15
  757.             self.y += 3
  758.             self.x += 3
  759.             self.mirror = true            
  760.         when 16..30
  761.             self.x -= 6
  762.              self.mirror = false
  763.         when 31..45
  764.             self.y -= 3
  765.             self.x += 3
  766.             self.mirror = true
  767.         else  
  768.         end_action   
  769.       end   
  770.   end  
  771.  
  772.   #--------------------------------------------------------------------------
  773.   # ● End Action
  774.   #--------------------------------------------------------------------------                     
  775.   def end_action
  776.       if $mog_rgss3_battle_hud != nil and @battler.is_a?(Game_Actor)
  777.          return_set(@original_set)
  778.       else  
  779.          return_set(@pre_set)  
  780.       end
  781.       @battler.motion_action = [-1,0]
  782.   end  
  783.  
  784. end
  785.  
  786. #==============================================================================
  787. # ■ Sprite Battler
  788. #==============================================================================
  789. class Sprite_Battler < Sprite_Base
  790.  
  791.   #--------------------------------------------------------------------------
  792.   # ● Update Blink
  793.   #--------------------------------------------------------------------------      
  794.   alias mog_motion_animation_update_blink update_blink
  795.   def update_blink
  796.       return if @battler.dead?
  797.       mog_motion_animation_update_blink
  798.   end
  799.  
  800.   #--------------------------------------------------------------------------
  801.   # ● Update Collapse
  802.   #--------------------------------------------------------------------------
  803.   def update_collapse   
  804.   end
  805.  
  806.   #--------------------------------------------------------------------------
  807.   # ● Execute Motion Collapse
  808.   #--------------------------------------------------------------------------   
  809.   def execute_motion_collapse
  810.       collapse_end if self.opacity == 0
  811.       @battler.motion_collapse[1] += 1      
  812.       case @battler.motion_collapse[0]
  813.            when 0;     update_collapse_vertical
  814.            when 1;     update_collapse_horizontal
  815.            when 2;     update_collapse_zoom_out
  816.            when 3;     update_collapse_zoom_in
  817.            when 4;     update_collapse_zoom_in_out
  818.            when 5;     update_collapse_boss_2
  819.            when 6;     update_collpase_do_nothing
  820.            else ;      update_collapse_normal
  821.       end
  822.  
  823.   end
  824.  
  825.   #--------------------------------------------------------------------------
  826.   # ● Can Execute Collapse
  827.   #--------------------------------------------------------------------------      
  828.   def can_execute_collapse?
  829.       return false if !@battler.dead?
  830.       return false if @collapse_done
  831.       return true
  832.   end
  833.  
  834.   #--------------------------------------------------------------------------
  835.   # ● Update Collapse Vertical
  836.   #--------------------------------------------------------------------------        
  837.   def update_collapse_vertical
  838.       self.zoom_y += 0.1
  839.       self.zoom_x -= 0.02         
  840.       self.opacity -= 3   
  841.   end
  842.  
  843.   #--------------------------------------------------------------------------
  844.   # ● Update Collapse Horizontal
  845.   #--------------------------------------------------------------------------         
  846.   def update_collapse_horizontal
  847.       self.zoom_x += 0.1
  848.       self.zoom_y -= 0.02      
  849.       self.opacity -= 3      
  850.   end
  851.  
  852.   #--------------------------------------------------------------------------
  853.   # ● Update Collapse Zoom Out
  854.   #--------------------------------------------------------------------------            
  855.   def update_collapse_zoom_out     
  856.       self.zoom_x += 0.02
  857.       self.zoom_y += 0.02     
  858.       self.opacity -= 4   
  859.   end
  860.  
  861.   #--------------------------------------------------------------------------
  862.   # ● Update Collapse Zoom IN
  863.   #--------------------------------------------------------------------------              
  864.   def update_collapse_zoom_in
  865.       self.zoom_x -= 0.01
  866.       self.zoom_y -= 0.01      
  867.       self.opacity -= 4            
  868.   end
  869.  
  870.   #--------------------------------------------------------------------------
  871.   # ● Update Collapse Zoom IN OUT
  872.   #--------------------------------------------------------------------------               
  873.   def update_collapse_zoom_in_out
  874.       case @battler.motion_collapse[1]
  875.            when 0..30
  876.                 self.zoom_x += 0.1
  877.                 self.zoom_y -= 0.02
  878.                 self.opacity -= 2
  879.            else  
  880.                 self.zoom_y += 0.5
  881.                 self.zoom_x -= 0.2
  882.                 self.opacity -= 10
  883.       end      
  884.   end
  885.  
  886.   #--------------------------------------------------------------------------
  887.   # ● Update Collapse Boss 2
  888.   #--------------------------------------------------------------------------                  
  889.   def update_collapse_boss_2
  890.       self.x = @original_set[0] + rand(10)
  891.       self.src_rect.y -= 1
  892.       self.opacity = 0 if self.src_rect.y < -self.bitmap.height
  893.   end
  894.  
  895.   #--------------------------------------------------------------------------
  896.   # ● Update Collapse do nothing
  897.   #--------------------------------------------------------------------------                    
  898.   def update_collpase_do_nothing
  899.  
  900.   end  
  901.  
  902.   #--------------------------------------------------------------------------
  903.   # ● Update Collapse Normal
  904.   #--------------------------------------------------------------------------                    
  905.   def update_collapse_normal
  906.       self.opacity -= 3
  907.       self.blend_type = 1
  908.   end  
  909.  
  910.   #--------------------------------------------------------------------------
  911.   # ● Collapse End
  912.   #--------------------------------------------------------------------------      
  913.   def collapse_end
  914.       @collapse_done = true
  915.       return_set(@original_set)
  916.       self.src_rect.y = -self.bitmap.height unless @battler.motion_collapse[0] == 6
  917.   end  
  918.  
  919.   #--------------------------------------------------------------------------
  920.   # ● Revert to Normal
  921.   #--------------------------------------------------------------------------        
  922.   alias mog_battler_motion_revert_to_normal revert_to_normal
  923.   def revert_to_normal
  924.       if @collapse_done
  925.          @collapse_done = false
  926.          return_set(@original_set)
  927.       end
  928.       mog_battler_motion_revert_to_normal
  929.   end  
  930.  
  931. end
  932.  
  933. $mog_rgss3_battler_motion = true

最佳答案

查看完整内容

出错那行上面加一行return if self.bitmap.nil?

Lv1.梦旅人

梦石
0
星屑
50
在线时间
270 小时
注册时间
2010-2-4
帖子
1305
发表于 2012-12-18 23:48:29 | 显示全部楼层
布兰度西特 发表于 2012-12-19 10:39
def collapse_end
      @collapse_done = true
      return_set(@original_set)

出错那行上面加一行return if self.bitmap.nil?

点评

这是什么问题呢?  发表于 2012-12-19 11:54
可以了~谢谢你~  发表于 2012-12-19 11:54
好歹当年也当过大魔王过,orz
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
687 小时
注册时间
2012-10-29
帖子
1543
发表于 2012-12-19 06:49:07 | 显示全部楼层
本帖最后由 j433463 于 2012-12-19 06:50 编辑

错误讯息说没有 def height 或 height 的值为 nil

应该找一找什么原因造成得不到 bitmap.height 的值。

点评

def collapse_end @collapse_done = true return_set(@original_set) self.src_rect.y = -self.bitmap.height unless @battler.motion_collapse[0] == 6 (提示错误的地方) end   发表于 2012-12-19 10:39
修改劇本中,仔細審查原來的劇情大綱,覺得有點不太滿意,嘗試編寫不同主角不同主線的劇情,希望能寫得出來。
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
212 小时
注册时间
2012-3-5
帖子
228
 楼主| 发表于 2012-12-19 10:39:21 | 显示全部楼层
def collapse_end
      @collapse_done = true
      return_set(@original_set)
      self.src_rect.y = -self.bitmap.height unless @battler.motion_collapse[0] == 6     (提示错误的地方)
  end  
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-28 23:25

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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