Últimos temas
» [Ace]Movimiento Libre
por brrt Ayer a las 3:57 pm

» Virtual Kingom (Old Version)
por NinjaLOL Ayer a las 3:22 am

» Concurso de relatos - Septiembre/Octubre 2018 [Inscripción]
por raffael_0 Ayer a las 3:18 am

» Laminación [VXACE] [PROYECTO EN CURSO]
por Pocari Vie Oct 12, 2018 12:08 pm

» QUITAR VENTANA DEL MENU (VX ACE)
por THESHINYMISTERXD Sáb Oct 06, 2018 7:46 pm

» Condición para saber si el jugador está caminando
por Sonik Sáb Oct 06, 2018 5:03 pm

» ¿Tileset de un futbolín?
por MCarlos15 Jue Oct 04, 2018 9:07 pm

» RPG Maker VX Ace en MAC
por Er1ck_92 Mar Oct 02, 2018 8:42 am

» Distrito 0 [VXACE]
por BREAK93 Mar Oct 02, 2018 6:08 am

» Necesito taileset modernos pero que no tengan estilo anime por favor
por Doble D Mar Oct 02, 2018 12:36 am

» Fantasy World XP (+ de 200 para o grupo)
por DecinBR Sáb Sep 29, 2018 6:28 pm

» Problemas con un archivo
por AetherIssei Dom Sep 23, 2018 4:08 am


[Ace]Contraataque Por Tsukihime

Ir abajo

[Ace]Contraataque Por Tsukihime

Mensaje por JapoZero el Vie Ago 22, 2014 10:00 pm

[Ace]Contraataque
Por Tsukihime

Este script permite que al ser atacado, haya un contraataque. Se puede escoger o cambiar a gusto.

Para escogerla en el juego, hay que ir al menu de técnicas y apretar la tecla A, o la X dependiendo de configuración de teclado.
Para especificar qué técnica se puede usar, se pone en la nota de la técnica en la database
Código:
<counter-skill>
Y para poner contraataques default para enemigos y actores, en sus notas correspondientes
Código:
<counter-skill: x>
Se debe tener la técnica para usarla. Claro Esta. Script:
Código:

=begin
==============================================================================
 ** Counter Skills
 Author: Hime
 Date: May 25, 2012
------------------------------------------------------------------------------
 ** Change log
 May 25
  -initialized rpg objects
 May 17
  -added skill-counter selection in battle
 May 16, 2012
  -Initial release
------------------------------------------------------------------------------
 This script allows you to specify a counter-skill that is used when
 you counterattack. It extends the counter-attack system by allowing
 you to counter-attack with something other than the basic Attack skill
 
 The counter-skill can be applied to both offensive and support skills.
 If the skill targets an enemy, it will select the enemy that just attacked
 you, or all enemies if possible.
 
 If the skill targets an ally, it will be used on the actor, or all members
 in the battle party if possible.
 
 To use a counter-skill, go to the Skills menu and press the "A" key.
 If you are not using the default keyboard, the skill is set to the "X" key
 in the game's settings.
 
 The same applies during battle.
 You can customize this key below
 
 There are three options when it comes to specifying counter-skills.
 1 - You can choose to allow all skills to be chosen.
 2 - You can choose only certain skill types to be chosen.
 3 - You can also choose to tag certain skills with <counter-skill>.
 
 Note that 2 and 3 can be combined together
==============================================================================
=end
$imported = {} if $imported.nil?
$imported["Tsuki_CounterSkill"] = true
#==============================================================================
# ** Configuration.
#==============================================================================
module Tsuki
  module Counter_Skill
    # Highlight color for counterskill
    Counter_Color = Color.new(255, 0, 0, 255)
   
    # button to use for counter-skill selection
    Button = :Y
   
    # can switch in battle?
    Battle_Can_Switch = false
   
    # Which skills does can be used as counter skills apply to?
    # If true, all skills can be selected
    All_Skills = false
   
    # If true, checks tagged skills as well
    Tagged_Skills = true
   
    # Checks the following skill types
    Skill_Types = [2]
   
    Counter_Regex = /<counter-skill>/i
    Default_Counter = /<counter-skill:?\s*(\d+)\s*>/i
  end
end
#==============================================================================
# ** Rest of the script.
#==============================================================================
module RPG
  class Skill < UsableItem
    include Tsuki::Counter_Skill
   
    def is_counter_skill?
      counter_flag
    end
   
    def counter_flag
      return @counter_flag unless @counter_flag.nil?
      return @counter_flag = !self.note.scan(Counter_Regex).empty?
    end
  end
 
  class Enemy < BaseItem
    include Tsuki::Counter_Skill
   
    def counter_skill
      return @counter_skill unless @counter_skill.nil?
      res = Default_Counter.match(self.note)
      return @counter_skill = res ? res[1].to_i : 1
    end
  end
 
  class Actor < BaseItem
    include Tsuki::Counter_Skill
   
    def counter_skill
      return @counter_skill unless @counter_skill.nil?
      res = Default_Counter.match(self.note)
      return @counter_skill = res ? res[1].to_i : 1
    end
  end
end

class Game_Battler < Game_BattlerBase
 
  attr_accessor :counter_skill
  alias tsuki_counter_skill_initialize_battler initialize
  def initialize
    tsuki_counter_skill_initialize_battler
    @counter_skill = $data_skills[attack_skill_id]
  end
end

class Game_Actor < Game_Battler
 
  alias tsuki_counter_skill_initialize_actor initialize
  def initialize(actor_id)
    tsuki_counter_skill_initialize_actor(actor_id)
    @counter_skill = actor.counter_skill ? $data_skills[actor.counter_skill] : $data_skills[attack_skill_id]
  end
end

class Game_Enemy < Game_Battler
  alias tsuki_counter_skill_initialize_enemy initialize
  def initialize(index, enemy_id)
    tsuki_counter_skill_initialize_enemy(index, enemy_id)
    @counter_skill = $data_skills[enemy.counter_skill]
  end
end

class Scene_Battle < Scene_Base
 
  # note that target is the battler that was targeted in this turn
  # @subject is the attacker
  def invoke_counter_attack(target, item)
    skill = target.counter_skill
    if target.usable?(skill)
      target.pay_skill_cost(skill)
      targets = make_targets(target, @subject, skill)
      @log_window.display_counter(target, skill)
      show_animation(targets, skill.animation_id)
      apply_counterattack(targets, target, skill)
    end
  end
 
  def apply_counterattack(targets, user, skill)
    targets.each do |target|
      target.item_apply(user, skill)
      refresh_status
      @log_window.display_action_results(target, skill)
    end
  end
 
  def make_targets(target, subject, skill)
    action = Game_Action.new(target)
    action.set_skill(skill.id)
    action.make_targets
  end
end

class Scene_Skill < Scene_ItemBase
  include Tsuki::Counter_Skill
 
  alias tsuki_counter_skill_item_window create_item_window
  def create_item_window
    tsuki_counter_skill_item_window
    @item_window.set_handler(:counter_skill, method(:on_counter_skill))
  end
 
  def on_counter_skill
    @item_window.set_counter_skill
    @item_window.activate
  end
end

class Scene_Battle < Scene_Base
 
  alias tsuki_counter_skill_battleskill_window create_skill_window
  def create_skill_window
    tsuki_counter_skill_battleskill_window
    @skill_window.set_handler(:counter_skill, method(:on_counter_skill))
  end
 
  def on_counter_skill
    @skill_window.set_counter_skill
    @skill_window.activate
  end
end

class Window_SkillList < Window_Selectable
  include Tsuki::Counter_Skill
 
  def is_counter_skill?(skill)
    @actor && @actor.counter_skill.id == skill.id
  end
 
  def set_counter_skill
    skill = item
    if valid_counter_skill?(skill)
      update_counter_skill(skill)
    end
    refresh
  end
 
  def valid_counter_skill?(skill)
    return false unless skill
    return true if All_Skills
    return true if Skill_Types.include?(skill.stype_id)
    return skill.is_counter_skill? if Tagged_Skills
    return false
  end
 
  def update_counter_skill(skill)
    if @actor.counter_skill == skill
      @actor.counter_skill = $data_skills[@actor.attack_skill_id]
    else
      @actor.counter_skill = skill
    end
  end
 
  def draw_item_name(item, x, y, enabled = true, width = 172)
    return unless item
    draw_icon(item.icon_index, x, y, enabled)
    if is_counter_skill?(item)
      change_color(Counter_Color, enabled)
    else
      change_color(normal_color, enabled)
    end
    draw_text(x + 24, y, width, line_height, item.name)
  end
 
  alias tsuki_counter_skill_process_handling process_handling
  def process_handling
    return unless open? && active
    return process_x if handle?(:counter_skill) && Input.trigger?(Tsuki::Counter_Skill::Button)
    tsuki_counter_skill_process_handling
  end
 
  def process_x
    Sound.play_cursor
    Input.update
    deactivate
    call_handler(:counter_skill)
  end
end

class Window_BattleSkill < Window_SkillList
  include Tsuki::Counter_Skill

  def valid_counter_skill?(skill)
    return false unless Battle_Can_Switch
    super
  end
end

class Window_BattleLog < Window_Selectable
 
  #--------------------------------------------------------------------------
  # * Display Counterattack
  #--------------------------------------------------------------------------
  def display_counter(target, item)
    Sound.play_evasion
    add_text("%s counters with %s!" %[target.name, item.name])
    wait
    back_one
  end
end
Espero que les sirva. Salu2
avatar
JapoZero
PJ Principal
PJ Principal

Masculino
Chile
RPG Maker : Ace
Mensajes : 653
Monedas : 3510
Reputación : 261
Edad : 18
Localización : Chile

Volver arriba Ir abajo

Volver arriba

- Temas similares

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