Makers
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

script de animacion para tanketai

3 participantes

Ir abajo

script de animacion para tanketai Empty script de animacion para tanketai

Mensaje  chicany2009 Lun Mar 22, 2010 7:57 pm

ahora es traigo este script que me gusto mucho y les servira a aquellos que usen el sistema de batalla lateral y se molesten por que no quieren que la animacion de la habilidad se vea en la pantalla completa pues este script hace eso acomodar la animacion para que no se vea en la pantalla completa lo explico en las screen

Aka esan las screen:
Spoiler:

sin mas que decir aqui esta el script:
Código:
###############################################################################
#Tankentai Animation 'Screen' and Reflect State Fix v1.0                          #
#by CrimsonSeas                                                              #
###############################################################################
#This is a fix for animation in Tankentai battle system. This fixex 2 issues  #
#I encountered while using Tankentai.                                          #
#-The issue where when you are using an animation with 'Screen' position, the #
# animation will be played at the center of the screen. Ideally, the animation#
# should be played at the targets' area, so when you use it on an enemy, it  #
# will be played at the enemies' area and vice versa.                        #
#-The issue where when using an animation with 'Screen' position, the        #
# animation will be played over and over on top of each other. This results in#
# animations with higher opacity when used against many targets rather than  #
# a few targets.                                                              #
#                                                                            #
#As I make fixes for this script due to bugs, I also found some Tankentai bugs#
#in Reflect state. Try this: cast Reflect on char A, and have char A heal    #
#himself. Even though he has Reflect, he will still be healed. This fixes that#
#issue. Also, this script adds an option to make reflect hits multiple times  #
#if the action if reflected multiple times (such as multi_hitting actions and #
#actions that target all.)                                                    #
#Details on how Reflect works:                                                #
#If you cast a skill on an enemy and it gets reflected, the reflection will  #
#hit the caster. It would still hit even if the caster is on reflect.        #
#If you cast a skill on an ally and it gets reflected, it will look for a    #
#random target from the opponents' unit.                                      #
#If you cast a skill that hits multiple targets or hits multiple times, the  #
#reflection would hit the same number as the reflection number                #
#If you cast a skill with TARGETALL or OTHERS, it will look for random target #
#from all battlers available                                                  #
#If you use normal attack, it will always reflect to yourself regardless of  #
#reflect                                                                      #
#When looking for random targets, target will first be selected from target  #
#unit which the the action won't be reflected. If there is none, then it will #
#randomly select target from target unit regardless of reflect.              #
#                                                                            #
#                                                                            #
#A few warnings, this script rewrites many of the default Tankentai methods.  #
#Compatibility issues may arise if you're using other Tankentai patches or    #
#addons (it works with my skill activation addon though), so far it works fine#
#with my custom scripts and with the default Tankentai. This works pretty good#
#for me so if it doesn't for you, then that must mean it clashes with other  #
#scripts.
###############################################################################
module AnimFix
#Sets whether reflect will be repeated if the skill hits multiple targets
  REPEAT_REFLECT = true
#This is an array of screen animation IDs that will use the default y position
#of 208, or default x of 272.
#Keep note that this setting only works for screen animations, it's useless if
#you enter an animation ID that is not a screen animation.
  DEFAULT_Y = [60]
  DEFAULT_X = [80]
end

class Sprite_Battler
  def start_animation(animation, mirror = false)
    dispose_animation
    @animation = animation
    return if @animation == nil
    @animation_mirror = mirror
    @animation_duration = @animation.frame_max * 4 + 1
    load_animation_bitmap
    @animation_sprites = []
    if @animation.position != 3 or not @@animations.include?(animation)
      if @use_sprite
        for i in 0..15
          sprite = ::Sprite.new(viewport)
          sprite.visible = false
          @animation_sprites.push(sprite)
        end
        unless @@animations.include?(animation)
          @@animations.push(animation)
        end
      end
    end
    if @animation.position == 3
      act = @battler.action
      if (act.skill != nil && act.skill.extension.include?("TARGETALL")) || (act.item != nil && act.item.extension.include?("TARGET_ALL"))
        @animation_ox = 544 / 2
        @animation_oy = (416 - 128) / 2
      else
        if @battler.is_a?(Game_Actor)
          unit = $game_party.members
        else
          unit = $game_troop.members
        end
        ax = 0
        ay = 0
        mem = 0
        for battler in unit
          ax += battler.position_x + self.ox
          ay += battler.position_y + self.oy
          mem += 1
        end
        ax = (ax/mem).to_i
        ay = (ay/mem).to_i
        @animation_ox = ax unless AnimFix::DEFAULT_X.include?(@animation.id)
        @animation_oy = ay unless AnimFix::DEFAULT_Y.include?(@animation.id)
        @animation_ox = 544 / 2 if AnimFix::DEFAULT_X.include?(@animation.id)
        @animation_oy = 416 / 2 if AnimFix::DEFAULT_Y.include?(@animation.id)
      end
    else
      @animation_ox = self.x - self.ox + self.width / 2
      @animation_oy = self.y - self.oy + self.height / 2
      if @animation.position == 0
        @animation_oy -= self.height / 2
      elsif @animation.position == 2
        @animation_oy += self.height / 2
      end
    end
  end
end

class Scene_Battle
  alias fix_start start
  def start
    @reflect_number = 0
    @reflection = false
    fix_start
  end
 
  def reflect_action(action)
    # 個別処理の場合ターゲットを一つずつ抜き出す
    @targets = [@individual_target.shift] if @active_battler.individual
    # スキルの場合
    if @active_battler.action.skill?
      obj = @active_battler.action.skill
      for target in @targets
        return if target == nil
        return if target.dead? && !obj.for_dead_friend?
        # HPが0なら戦闘不能復活以外はミスしない
        target.revival = true if obj.for_dead_friend?
        if target.hp == 0 && !obj.for_dead_friend?
          target.perfect_skill_effect(@active_battler, obj)
        # 必中確認
        else
          target.perfect_skill_effect(@active_battler, obj)
        end
        pop_damage(target, obj, action)
        # コスト吸収確認
        absorb_cost(target, obj)
      end
    # アイテムの場合
    elsif @active_battler.action.item?
      obj = @active_battler.action.item
      for target in @targets
        return if target == nil
        return if target.dead? && !obj.for_dead_friend?
        target.revival = true if obj.for_dead_friend?
        if target.hp == 0 && !obj.for_dead_friend?
          target.perfect_item_effect(@active_battler, obj)
        else
          target.perfect_item_effect(@active_battler, obj)
        end
        pop_damage(target, obj, action)
      end
    # 通常攻撃の場合
    else
      for target in @targets
        return if target == nil or target.dead?
        target.perfect_attack_effect(@active_battler)
        pop_damage(target, nil, action)
      end
    end
    anim_id = obj.animation_id if obj != nil
    anim_id = -1 if obj == nil
    display_animation(@targets, anim_id)
    # ステータスウインドウをリフレッシュ
    @status_window.refresh
    # 連続行動中のランダムターゲットを考慮し、すぐに次のターゲットを選択
    return if obj == nil
  end
 
  def damage_action(action)
    # 個別処理の場合ターゲットを一つずつ抜き出す
    @targets = [@individual_target.shift] if @active_battler.individual
    # スキルの場合
    if @active_battler.action.skill?
      obj = @active_battler.action.skill
      for target in @targets
        return if target == nil
        return if target.dead? && !obj.for_dead_friend?
        # HPが0なら戦闘不能復活以外はミスしない
        target.revival = true if obj.for_dead_friend?
        if target.hp == 0 && !obj.for_dead_friend?
          target.perfect_skill_effect(@active_battler, obj)
        # 必中確認
        elsif obj.extension.include?("NOEVADE")
          magic_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
          physics_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
          target.perfect_skill_effect(@active_battler, obj) unless @reflection or @invalid
        else
          # 反射確認
          magic_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
          physics_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
          # ダメージ計算
          target.skill_effect(@active_battler, obj) unless @reflection or @invalid
        end
        pop_damage(target, obj, action) unless @reflection or @invalid
        # コスト吸収確認
        absorb_cost(target, obj)
        # 反射アクション取得
        @active_battler.reflex = action if @reflection
        @reflection = false
        @invalid = false
      end
    # アイテムの場合
    elsif @active_battler.action.item?
      obj = @active_battler.action.item
      for target in @targets
        return if target == nil
        return if target.dead? && !obj.for_dead_friend?
        target.revival = true if obj.for_dead_friend?
        if target.hp == 0 && !obj.for_dead_friend?
          target.perfect_item_effect(@active_battler, obj)
        elsif obj.extension.include?("NOEVADE")
          magic_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
          physics_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
          target.perfect_item_effect(@active_battler, obj) unless @reflection or @invalid
        else
          magic_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
          physics_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
          target.item_effect(@active_battler, obj) unless @reflection or @invalid
        end
        pop_damage(target, obj, action) unless @reflection or @invalid
        @active_battler.reflex = action if @reflection
        @reflection = false
        @invalid = false
      end
    # 通常攻撃の場合
    else
      for target in @targets
        return if target == nil or target.dead?
        physics_reflection(target, nil)
        target.perfect_attack_effect(@active_battler) if target.hp <= 0
        target.attack_effect(@active_battler) unless target.hp <= 0 or @reflection or @invalid
        pop_damage(target, nil, action) unless @reflection or @invalid
        # 反射アクション取得
        @active_battler.reflex = action if @reflection
        @reflection = false
        @invalid = false
      end
    end
    anim_id = obj.animation_id if obj != nil
    anim_id = -1 if obj == nil
    display_animation(@targets, anim_id)
    # ステータスウインドウをリフレッシュ
    @status_window.refresh
    # 連続行動中のランダムターゲットを考慮し、すぐに次のターゲットを選択
    return if obj == nil
    target_decision(obj) if obj.extension.include?("RANDOMTARGET")
  end
 
  def display_normal_animation(targets, animation_id, mirror = false)
    animation = $data_animations[animation_id]
    if @active_battler.action.kind == 1
      obj = @active_battler.action.skill
    elsif @active_battler.action.kind == 2
      obj = @active_battler.action.item
    end
    if obj != nil && obj.extension.include?("TARGETALL")
      @active_battler.animation_id = animation_id
      return
    end
    physical = true if obj == nil && @active_battler.action.kind == 0
    physical = true if obj != nil && obj.physical_attack
    physical = false if obj != nil && !obj.physical_attack
    if true
      to_screen = (animation.position == 3) if animation != nil
      to_screen = false if animation == nil
      screen_already_played = false
      for target in targets.uniq
        reflected = false
        next if target.missed || target.evaded
        if @active_battler.reflex != nil
          for state in target.states
            for ext in state.extension
              if ext.include?("MAGREFLECT") && !physical && !@reflection
                @reflect_number += 1
                reflected = true
                break
              elsif ext.include?("PHYREFLECT") && physical && !@reflection
                @reflect_number += 1
                reflected = true
                break
              end
            end
            break if reflected
          end
        end
        next if reflected
        next if screen_already_played
        next if animation == nil
        target.animation_id = animation_id
        target.animation_mirror = mirror
        screen_already_played = true if to_screen
      end
    end
    reflected = false
    screen_already_played = false
  end
 
  def display_animation(targets, animation_id)
    if animation_id < 0
      display_attack_animation(targets)
    else
      display_normal_animation(targets, animation_id)
    end
  end
 
  def display_attack_animation(targets)
    if @active_battler.is_a?(Game_Enemy) && @active_battler.weapon == 0
      display_normal_animation(targets, N01::NO_WEAPON)
    elsif @active_battler.is_a?(Game_Enemy)
      id = $data_weapons[@active_battler.weapon].animation_id
      display_normal_animation(targets, id)
    else
      aid1 = @active_battler.atk_animation_id
      aid2 = @active_battler.atk_animation_id2
      display_normal_animation(targets, aid1, false) unless @second_attack
      display_normal_animation(targets, aid2, true) if @second_attack
      if @active_battler.is_a?(Game_Actor) && @active_battler.two_swords_style
        if @second_attack
          @second_attack = false
        else
          @second_attack = true
        end
      end
    end
  end
 
  def action_end
    # 初期化
    @individual_target = nil
    @help_window.visible = false if @help_window != nil && @help_window.visible
    @active_battler.active = false
    @active_battler.clear_action_results
    if @active_battler.action.skill?
      obj = @active_battler.action.skill
    end
    # 念のため不死身化解除
    unimmortaling
    # 反射されていた場合
    if @active_battler.reflex != nil
      @reflection = true
      reflection_process(@active_battler.reflex)
    end
    @reflect_number = 0
    @reflection = false
    # 逆吸収で戦闘不能になった場合
    if @absorb_dead
      @active_battler.perform_collapse
      @absorb_dead = false
      wait(N01::COLLAPSE_WAIT)
    end
    @second_attack = false
    # 次の行動までウエイトを挟む
    wait(N01::ACTION_WAIT)
  end
 
  def reflection_process(action)
    if @active_battler.action.skill?
      obj = @active_battler.action.skill
    elsif @active_battler.action.item?
      obj = @active_battler.action.item
    end
    if @active_battler.is_a?(Game_Actor)
      if obj != nil && (obj.extension.include?("TARGETALL") || obj.extension.include?("OTHERS"))
        ref_target = @active_battler
      elsif @targets[0].is_a?(Game_Actor) && obj != nil
        ref_target = get_rand_ref_target($game_troop.existing_members, obj)
      elsif @targets[0].is_a?(Game_Actor) && obj == nil
        ref_target = @active_battler
      elsif @targets[0].is_a?(Game_Enemy)
        ref_target = @active_battler
      end
    else
      if obj != nil && (obj.extension.include?("TARGETALL") || obj.extension.include?("OTHERS"))
        ref_target = @active_battler
      elsif @targets[0].is_a?(Game_Enemy) && obj != nil
        ref_target = get_rand_ref_target($game_party.existing_members, obj)
      elsif @targets[0].is_a?(Game_Enemy) && obj == nil
        ref_target = @active_battler
      elsif @targets[0].is_a?(Game_Actor)
        ref_target = @active_battler
      end
    end
    if obj == nil
      ref_target = @active_battler
    end
    return reflect_number = 0 if ref_target == nil
    @targets = [ref_target]
    if obj == nil
      id = @active_battler.atk_animation_id
      animation = $data_animations[id]
    else
      animation = $data_animations[obj.animation_id]
    end
    time = 0
    time = animation.frame_max * 4 + 1 if animation != nil
    for i in 1..@reflect_number
      reflect_action(action)
      @targets[0].perform_collapse
      wait(N01::COLLAPSE_WAIT)
      wait(time)
      break if @targets[0].dead?
      break unless AnimFix::REPEAT_REFLECT
    end 
    @active_battler.reflex = nil
  end
 
  def get_rand_ref_target(unit, obj)
    temp = unit
    p obj.physical_attack
    for battler in unit
      for state in battler.states
        for ext in state.extension
        if ext[/PHYREFLECT/] != nil && obj == nil
          temp.delete(battler)
        elsif obj == nil
          next
        elsif ext[/PHYREFLECT/] != nil && obj.physical_attack
          temp.delete(battler)
          next
        elsif ext[/MAGREFLECT/] != nil && !obj.physical_attack
          temp.delete(battler)
          next
        else
          next
        end
        end
      end
    end
    temp.uniq!
    if temp.size == 0
      temp = unit
    end
    return temp[rand(temp.size)]
  end 
end

class Sprite_Battler
  def damage_action(action)
    damage = @battler.hp_damage
    damage = @battler.mp_damage if @battler.mp_damage != 0
    # HPとMP両方同時にダメージがあるなら
    if @battler.hp_damage != 0 && @battler.mp_damage != 0
      @battler.double_damage = true
      damage = @battler.hp_damage
    end 
    # 吸収攻撃でHP0の処理
    if action[0] == "absorb"
      absorb = true
      action[0] = nil
    end
    # ヒットしている時のみアニメ実行
    # ダメージアクション実行
    start_action(@battler.damage_hit) if damage > 0 && action[2]
    # 攻撃が当たっていない場合は回避アクション実行
    if @battler.evaded or @battler.missed
      start_action(@battler.evasion) if action[2]
      Sound.play_evasion
    end
    @damage.damage_pop unless absorb or action[3] != nil
  end
end
chicany2009
chicany2009
Aprendiz

Mensajes : 30
Puntos : 35
Reputación : 1
Fecha de inscripción : 20/03/2010
Edad : 30
Localización : En todos y en ningun lugar

Volver arriba Ir abajo

script de animacion para tanketai Empty Re: script de animacion para tanketai

Mensaje  exellomas Lun Mar 22, 2010 8:27 pm

ajjaja no paras de poner scrips jaj jaj xD
exellomas
exellomas
Moderador

Mensajes : 172
Puntos : 210
Reputación : 0
Fecha de inscripción : 20/03/2010
Edad : 25
Localización : en ciudad maker

http://ciudad-rpg-maker.foroactivo.com/forum.htm

Volver arriba Ir abajo

script de animacion para tanketai Empty Re: script de animacion para tanketai

Mensaje  Arestame Mar Mar 23, 2010 7:48 am

Eres como yo en mis tiempos xD
Arestame
Arestame
Moderador

Mensajes : 140
Puntos : 165
Reputación : 3
Fecha de inscripción : 20/03/2010
Localización : Por todos los lados. ¡¡Detrás de ti!!

Volver arriba Ir abajo

script de animacion para tanketai Empty Re: script de animacion para tanketai

Mensaje  exellomas Mar Mar 23, 2010 8:25 am

xD arestame en tus tiempos?? jajaja me lo quiero imaginar pero no puedo xD
exellomas
exellomas
Moderador

Mensajes : 172
Puntos : 210
Reputación : 0
Fecha de inscripción : 20/03/2010
Edad : 25
Localización : en ciudad maker

http://ciudad-rpg-maker.foroactivo.com/forum.htm

Volver arriba Ir abajo

script de animacion para tanketai Empty Re: script de animacion para tanketai

Mensaje  Arestame Mar Mar 23, 2010 8:36 am

que te lo diga arzoback, aportaba yo también muchos scripts para el vx
Arestame
Arestame
Moderador

Mensajes : 140
Puntos : 165
Reputación : 3
Fecha de inscripción : 20/03/2010
Localización : Por todos los lados. ¡¡Detrás de ti!!

Volver arriba Ir abajo

script de animacion para tanketai Empty Re: script de animacion para tanketai

Mensaje  Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.