查看: 2422|回复: 8

[已经过期] 要如何修改这个脚本

[复制链接]
梦石
0
星屑
95
在线时间
62 小时
注册时间
2012-4-13
回帖
29
发表于 2015-3-26 18:35:48 | 显示全部楼层 |阅读模式

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

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

×
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 是否使用精灵
  #--------------------------------------------------------------------------
  def use_sprite?
    true
  end
  #--------------------------------------------------------------------------
  # ● 战斗画面 X 坐标
  #--------------------------------------------------------------------------
  def screen_x
    Graphics.width / 2
  end
  #--------------------------------------------------------------------------
  # ● 战斗画面 Y 坐标
  #--------------------------------------------------------------------------
  def screen_y
    Graphics.height / 1
  end
  #--------------------------------------------------------------------------
  # ● 战斗画面 Z 坐标
  #--------------------------------------------------------------------------
  def screen_z
    return 100
  end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
  #--------------------------------------------------------------------------
  # ● 设置动画的原点
  #--------------------------------------------------------------------------
  def set_animation_origin
    if @animation.position == 3
    # 数据库中设定的动画基础位置是 [画面] 时的坐标变更
      @ani_ox = viewport.rect.width / 2
      yy = viewport.rect.height / 5
      @ani_oy = @battler.actor? ? (yy * 4) : (yy * 2.5)
    else
      @ani_ox = x - ox + width / 2
      @ani_oy = y - oy + height / 2
      if @animation.position == 0
        @ani_oy -= height / 2
      elsif @animation.position == 2
        @ani_oy += height / 2
      end
    end
  end
end


这个脚本的作用是让RMVA的默认战斗系统中的敌人显示技能动画。

经过我自己的修改后(就加了个1而已= =),敌人的技能动画会显示在画面中间。

但是我方人员对我方人员使用道具或者技能显示的动画则会显示在屏幕底端

因为不方便截图,所以希望哪位大神帮忙修改一下,谢谢。

PS 脚本的作者是谁我也忘了,找那个贴子也没找到,不好意思
PS 如果哪位大神有更好的脚本希望能够授予
梦石
3
星屑
3605
在线时间
2492 小时
注册时间
2014-10-5
回帖
1694

开拓者剧作品鉴家

发表于 2015-3-27 10:38:59 | 显示全部楼层
[pre lang="ruby"]#==============================================================================
# +++ MOG - Animation + (V1.5) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# - O script adiciona algumas funções extras para apresentar as animações
# de batalha.
#==============================================================================
# Coloque as tags abaixo na caixa de notas das habilidades ou itens.
#
# ID = ID of Animation.
#
#------------------------------------------------------------------------------
# ● HIT ANIMATION ●
#
# <Hit Animation = ID>
#
#------------------------------------------------------------------------------
# ● USE ANIMATION (TYPE 1) ●
#
# <Use Animation = ID>
#
#------------------------------------------------------------------------------
# ● USE ANIMATION (TYPE 2) ● (Wait for animation to complete)
#
# <Wait Use Animation = ID>
#
#------------------------------------------------------------------------------
# ● STATES ANIMATION (LOOP) ● (States Tab)
#
# <Loop Animation = ID>
#
#------------------------------------------------------------------------------
# ● DEATH ANIMATION ● (Enemy or Actor Tab)
#
# <Death Animation = ID>
#
#==============================================================================
module MOG_ANIMATION_PLUS
   # Defina aqui as IDs das animações que irão ignorar o tempo de espera
   # para fluir a batalha, caso contrário o sistema de batalha vai
   # esperar todas as animações sem excessão terminarem para poder prosseguir
   # para o próximo estágio de batalha.
   #
   # É aconselhável colocar as animações das condições nesta opção para evitar
   # que o sistema espere a animação do loop terminar.
   #
   IGNORE_WAIT_TIME_ANIMATION_ID = [1,69,109,114,115,116,117,118,119,120]
   
   #Velocidade de loop entre as animações.
   STATES_LOOP_SPEED = 30
   
   #Definição da animação de level UP.
   LEVEL_UP_ANIMATION = 37
end

#==============================================================================
# Atualizações desta versão.
#============================================================================
# (Ver 1.4) - Melhoria na compatibilidade com o script Battle Hud EX.
#==============================================================================

$imported = {} if $imported.nil?
$imported[:mog_animation_plus] = true

#==============================================================================
# ■ Game Battler
#==============================================================================
class Game_Battler < Game_BattlerBase

  attr_accessor :animation_loop

  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------
  alias mog_animation_plus_initialize initialize
  def initialize
      mog_animation_plus_initialize
      @animation_loop = []
  end
  
  #--------------------------------------------------------------------------
  # ● Add New State
  #--------------------------------------------------------------------------               
  alias mog_animation_plus_add_new_state add_new_state
  def add_new_state(state_id)
      mog_animation_plus_add_new_state(state_id)
      check_loop_animation
  end   
  
  #--------------------------------------------------------------------------
  # ● Erase State
  #--------------------------------------------------------------------------            
  alias mog_animation_plus_erase_state erase_state
  def erase_state(state_id)  
      mog_animation_plus_erase_state(state_id)  
      check_loop_animation
  end  
  
  #--------------------------------------------------------------------------
  # ● Check Loop Animation
  #--------------------------------------------------------------------------               
  def check_loop_animation
      @animation_loop.clear
      self.states.each_with_index do |i, index|
      if i.note =~ /<Loop Animation = (\d+)>/i   
         @animation_loop.push([$1.to_i,0, index + 1, true])
      end
      end
  end
      
  #--------------------------------------------------------------------------
  # ● Item Apply
  #--------------------------------------------------------------------------           
  alias mog_animation_plus_item_apply item_apply
  def item_apply(user, item)
      mog_animation_plus_item_apply(user, item)
      execute_animation_plus_hit(item) if @result.success
  end
  
  #--------------------------------------------------------------------------
  # ● Execute Animation Plus Hit
  #--------------------------------------------------------------------------           
  def execute_animation_plus_hit(item)
      return if item == nil
      return if !SceneManager.scene_is?(Scene_Battle)
      self.animation_id = $1.to_i if item.note =~ /<Hit Animation = (\d+)>/i   
      if self.dead?
         if self.is_a?(Game_Enemy)
            battler = $data_enemies[self.enemy_id]
         else
            battler = $data_actors[self.id]
         end  
         self.animation_id = $1.to_i if battler.note =~ /<Death Animation = (\d+)>/i
      end
  end
  
end

#==============================================================================
# ■ Sprite_Base
#==============================================================================
class Sprite_Base < Sprite  

  #--------------------------------------------------------------------------
  # ● Battle Animation?
  #--------------------------------------------------------------------------            
  def battle_animation?
      if @animation != nil
         if MOG_ANIMATION_PLUS::IGNORE_WAIT_TIME_ANIMATION_ID.include?(@animation.id)
            return false
         end
         return true         
      end  
      return false
  end
  
end  


#==============================================================================
# ■ Sprite Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
  
  #--------------------------------------------------------------------------
  # ● Update Position
  #--------------------------------------------------------------------------            
  alias mog_animation_plus_update_position update_position
  def update_position
      mog_animation_plus_update_position
      update_loop_animation if can_loop_animation?
  end
  
  #--------------------------------------------------------------------------
  # ● Can Loop Animation?
  #--------------------------------------------------------------------------            
  def can_loop_animation?
      return false if BattleManager.in_turn?
      return false if self.animation?
      return false if @battler.animation_loop.empty? or @battler.dead?  
      if $imported[:mog_battle_hud_ex]
      return false if $game_message.visible and MOG_BATTLE_HUD_EX::MESSAGE_WINDOW_FADE_HUD
      return false if !$game_temp.battle_hud_visible
      end         
      return true
  end
  
  #--------------------------------------------------------------------------
  # ● Update Loop Animation
  #--------------------------------------------------------------------------               
  def update_loop_animation
      for i in @battler.animation_loop
          next if !i[3]
          i[1] += 1
          if i[1] >= MOG_ANIMATION_PLUS::STATES_LOOP_SPEED
             i[1] = 0 ; @battler.animation_id = i[0] ; i[3] = false
             if i[2] >= @battler.animation_loop.size
                for i in @battler.animation_loop
                    i[1] = 0 ; i[3] = true
                end                 
            end  
          end
          break           
      end        
  end
  
  #--------------------------------------------------------------------------
  # ● Update Z Correction
  #--------------------------------------------------------------------------                  
  def update_z_correction
      return if !@animation
      @ani_sprites.each do |sprite| sprite.z = self.z + 1 end
  end  
  
end

#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
  
  #--------------------------------------------------------------------------
  # ● Animation?
  #--------------------------------------------------------------------------                     
  def animation?
      battler_sprites.any? {|sprite| sprite.battle_animation? }
  end  
  
end

#==============================================================================
# ■ Scene Battle
#==============================================================================
class Scene_Battle < Scene_Base

  #--------------------------------------------------------------------------
  # ● Start
  #--------------------------------------------------------------------------
  alias mog_animation_plus_start start
  def start
      $game_party.members.each {|actor| actor.check_loop_animation }   
      mog_animation_plus_start
  end

  #--------------------------------------------------------------------------
  # ● Use Item
  #--------------------------------------------------------------------------         
  alias mog_animation_plus_use_item use_item
  def use_item
      execute_cast_animation
      mog_animation_plus_use_item        
  end

  #--------------------------------------------------------------------------
  # ● Execute Cast Animation
  #--------------------------------------------------------------------------      
  def execute_cast_animation
      return if @subject.current_action.item == nil rescue return
      item = @subject.current_action.item
      if item.note =~ /<Use Animation = (\d+)>/i
         execute_animation(@subject, $1.to_i,false)   
      elsif item.note =~ /<Wait Use Animation = (\d+)>/i  
         execute_animation(@subject, $1.to_i,true)   
      end  
  end  
  
  #--------------------------------------------------------------------------
  # ● Execute Animation
  #--------------------------------------------------------------------------     
  def execute_animation(subject , anime_id = 0, wait_animation = false)
      return if anime_id <= 0 or subject == nil
      subject.animation_id = anime_id rescue nil
      if wait_animation
         duration = ($data_animations[anime_id].frame_max * 4) + 1
         for i in 0..duration
             @spriteset.update ; Graphics.update
         end      
      end   
  end  
  
end   

#==============================================================================
# ■ Game Actor
#==============================================================================
class Game_Actor < Game_Battler

  #--------------------------------------------------------------------------
  # ● Level UP
  #--------------------------------------------------------------------------      
  alias mog_animation_plus_level_up level_up
  def level_up
       mog_animation_plus_level_up
       self.animation_id = MOG_ANIMATION_PLUS::LEVEL_UP_ANIMATION if can_lvup_animation?
  end

  #--------------------------------------------------------------------------
  # ● Can Lvup Animation
  #--------------------------------------------------------------------------      
  def can_lvup_animation?
      return false if !use_sprite?
      return false if !SceneManager.scene_is?(Scene_Battle)
      if $imported[:mog_battle_hud_ex]
          return false if $game_message.visible and MOG_BATTLE_HUD_EX::MESSAGE_WINDOW_FADE_HUD
          return false if !$game_temp.battle_hud_visible
      end
      return true
  end

end
[/pre]

关于动画,貌似可以用这个。
回复

使用道具 举报

梦石
0
星屑
95
在线时间
62 小时
注册时间
2012-4-13
回帖
29
 楼主| 发表于 2015-3-27 18:22:54 来自手机 | 显示全部楼层
长弓巡洋集团 发表于 2015-3-27 10:38
#==============================================================================
# +++ MOG - Animatio ...

我试试先
回复

使用道具 举报

梦石
0
星屑
95
在线时间
62 小时
注册时间
2012-4-13
回帖
29
 楼主| 发表于 2015-3-27 18:32:11 | 显示全部楼层
长弓巡洋集团 发表于 2015-3-27 10:38
#==============================================================================
# +++ MOG - Animatio ...

不好意思,没有效果
我用的是RMVA默认战斗系统

点评

在技能备注里写想要的动画,见脚本说明  发表于 2015-3-27 18:54
那个是要备注的 = =  发表于 2015-3-27 18:53
回复

使用道具 举报

梦石
0
星屑
95
在线时间
62 小时
注册时间
2012-4-13
回帖
29
 楼主| 发表于 2015-3-29 04:48:26 | 显示全部楼层
长弓巡洋集团 发表于 2015-3-27 10:38
#==============================================================================
# +++ MOG - Animatio ...

原来如此,我再试试。
回复

使用道具 举报

梦石
0
星屑
95
在线时间
62 小时
注册时间
2012-4-13
回帖
29
 楼主| 发表于 2015-3-29 14:25:28 | 显示全部楼层
长弓巡洋集团 发表于 2015-3-27 10:38
#==============================================================================
# +++ MOG - Animatio ...

报告,实验失败!
失败原因:脚本不会,英语看不懂。

点评

那是葡萄牙語,不是英語  发表于 2015-3-29 14:32
回复

使用道具 举报

梦石
0
星屑
95
在线时间
62 小时
注册时间
2012-4-13
回帖
29
 楼主| 发表于 2015-3-29 23:28:12 | 显示全部楼层
黑白色的枫 发表于 2015-3-29 14:25
报告,实验失败!
失败原因:脚本不会,英语看不懂。

葡萄牙语我也不认识QAQ

点评

我知道,我知道 PS:因为很重要所以说了两遍  发表于 2015-4-1 14:47
不要緊, 這是正常的==  发表于 2015-3-31 20:53
回复

使用道具 举报

梦石
0
星屑
723
在线时间
530 小时
注册时间
2010-6-9
回帖
668
发表于 2015-3-31 11:11:10 | 显示全部楼层
把实验的流程和结果说下,或许能帮你解决问题。
失败是成功他妈。
回复

使用道具 举报

梦石
0
星屑
95
在线时间
62 小时
注册时间
2012-4-13
回帖
29
 楼主| 发表于 2015-3-31 19:28:01 | 显示全部楼层
负零 发表于 2015-3-31 11:11
把实验的流程和结果说下,或许能帮你解决问题。
失败是成功他妈。

我把
<Hit Animation = ID>
<Use Animation = ID>
<Wait Use Animation = ID>
<Loop Animation = ID>
<Death Animation = ID>
写在技能注释里,后面的ID替换成动画的序号
又在49行ID里写上了技能的序号,但是没有用
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部