Mohon maaf, blog ini sedang dalam tahap renovasi pembaharuan link.

Combo Timing

| | 0 komentar

Combo Timing Versi: v1.0 (Tipe: Tankentai Add-On) ini merupakan hasil konversi dari Rusted_71, timing serangan ala Legend of Dragoon. Kini Script ini dapat digunakan untuk RPG Maker VX.

Fitur

  • Plug and play (Mungkin. Kamu masih harus ngatur animasi serangannya.)
  • Serangan bisa ditiming!
  • Combo serangan yang bisa digonta-ganti
Screenshots












Scripts
=begin
================================================================================
                          COMBO ACTIVATOR v1.0VX
                      by Rusted_71 export by wltr3565
================================================================================
A friend of mine, Rusted_71, has made something that's similar to Legend of
Dragoon. Unfortunately, it was for XP, and for Tankentai as well. But many of
VX users want to use this. Since it's possible to export it, I exported this for
VX use.

Note: I never played Legend of Dragoon in my life, so don't ask me for the
      detailed mechanism.
================================================================================
Features:
- Plug and Play (maybe? You still have to set you skill animations though)
- A really cool function to time your attack! Try yourself. I don't get it.
  Just press the C button while the shrinked square is at the same size as the
  smaller one.
- Interchangeable combo attacks.
================================================================================
How to use:
Adjust things in the script below. For the functions:
- Combo Learning:
To make an actor to learn a new combo, use this in the script command:
   $game_system.learn_combo(actor_id, combo_id)
actor_id represents the learning actor's id, and combo_id represents the learned
combo's id. The equipped combo won't be used in an instant. It must be equipped
first.

- Combo Adjusting Screen.
To make the players adjust their actors' combo attacks, use this in the script
command:
   $scene = Scene_Combo.new(actor_index)
actor index represents the actor's party index. Like this:
   $scene = Scene_Combo.new(1)
Defaultly, will show Ulrika's combo menu.

If you want the skills do things like normal attacks in this demo, just set the
skill's sequence from the sequence below.
================================================================================
Install:
Put this below Tankentai and above main. Then adjust things below.
================================================================================
Terms of Use:
Credit Rusted_71 especially! He made this first. Crediting me, wltr3565 will be
very nice. Oh, don't ask me about commercial uses. Ask Rusted_71.
================================================================================
Thanks:
- Rusted_71: He made this first in XP.
- Trickster: Rect draw method for this script.
- Sony: Legend of Dragoon... Is it?
================================================================================
=end
#===============================================================================
#   COMMENCING COMPATIBILITY FLAG
#===============================================================================
$imported = {} if $imported == nil
$imported["Rusted_71's_Combo_Activator"] = true
#===============================================================================
#   END COMPATIBILITY FLAG
#===============================================================================

module N01
  NEW_ACTION = {
#==============================================================================
# These are the sequences for the animation in Tankentai style. Write it in
# Tankentai.
  "GANBANTAIN" => ["Afterimage ON","PREV_STEP_ATTACK","WPN_SWING_VL","OBJ_ANIM_WEAPON",
                       "WAIT(FIXED)","16","TIME_N","OBJ_ANIM_WEAPON","WPN_SWING_UNDER",
                       "WPN_SWING_OVER","4","TIME_F","JUMP_FIELD_ATTACK","WPN_SWING_VL",
                       "OBJ_ANIM_WEAPON","WAIT(FIXED)","16","TIME_F","OBJ_ANIM_WEAPON",
                       "Invert","WPN_SWING_V","WPN_SWING_VL","12","TIME_F","Invert",
                       "JUMP_FIELD_ATTACK","WPN_SWING_VL","OBJ_ANIM_WEAPON",
                       "JUMP_AWAY","JUMP_AWAY","WAIT(FIXED)","8", "TIME_S",
                       "OBJ_ANIM_WEAPON","DASH_ATTACK","WPN_SWING_VL","Can Collapse",
                       "Afterimage OFF","16","FLEE_RESET"],
  "DUAL_SLASH" => ["Afterimage ON","PREV_STEP_ATTACK","WPN_SWING_VL","OBJ_ANIM_WEAPON",
                       "WAIT(FIXED)","16","TIME_N","WPN_SWING_VL","OBJ_ANIM_WEAPON","4",
                       "Can Collapse","Afterimage OFF","16","FLEE_RESET"],
  "TRIPLE_SLASH" => ["Afterimage ON","PREV_STEP_ATTACK","WPN_SWING_VL","OBJ_ANIM_WEAPON",
                       "WAIT(FIXED)","16","TIME_N","WPN_SWING_VL","OBJ_ANIM_WEAPON",
                       "WAIT(FIXED)","16","TIME_N","WPN_SWING_VL","OBJ_ANIM_WEAPON",
                       "Can Collapse","Afterimage OFF","16","FLEE_RESET"]
  }
#==============================================================================
  ACTION.merge!(NEW_ACTION) # Don't touch
  NEW_ANIME = { # Once again, do not touch.
#==============================================================================
# This will make the ANIME for the attack timing. The format for making one is
# like this:
#
# "anime_name" => ["Timing",time_set]
#
# "nama_anime" >> To be called in the sequence. This will be the moment where
#                 You must input your timing.
# "Timing" >> Always add this for timing ANIME's
# time_set >> The delay in frames. 60 frames are the same as 1 second,
#             defaultly.
#==============================================================================
  "TIME_VF" => ["Timing", 30],
  "TIME_F" => ["Timing", 40],
  "TIME_N" => ["Timing", 60],
  "TIME_S" => ["Timing", 90]
  }
#==============================================================================
  ANIME.merge!(NEW_ANIME) # Don't touch.
  COMBOS = ["", # Don't touch, once again.
#==============================================================================
# This will make the combos (normal attack sequences) so with this, actors can
# have their individual attack animations, and changeable. The format is like
# this:
# ["combo_name",hit_modifier,sequence_name, help],
#
# "nama_combo" >> The combo name. This one will be shown in the attack command.
# hit_modifier >> The attack modifier.
#                 Make it in array and make it as the same amount as the number
#                 of hits.
#                 [2,2,2,2,2,2], << 6 hit combo and hit number 1, 2, 3, 4, 5,
#                                   and 6 will multiply the normal damage by 2.
# sequence_name >> The attack animation sequence like you adjust in skills.
# help         >> Description for the combo.
#
#==============================================================================
             # Name,  Modifier,       Sequence,           Help.
            ["Slash",      [1],      "NORMAL_ATTACK", "Slash like you normally do."], #<<< Combo ID 1
            ["Dual Slash",[0.5,0.6],"DUAL_SLASH", "Basic stuff, but twice."],#<<<< Combo ID 2 and so on.
            ["Triple Slash",[0.4,0.4,0.5],"TRIPLE_SLASH", "Now you can do threesome!"],
            ["Ganbantain",[0.3,0.2,0.2,0.2,0.2,0.5],"GANBANTAIN", "\"Gua Bantain\"? Whatever."]
#==============================================================================
  ]
#==============================================================================
# This will set the first combo for each actors to learn and use. The format
# is like this:
#
# [actor_id,combo_id],
# actor_id represents the corresponding actor's id, and combo_id represents the
# learned combo's id.
# Example:
#    DEFAULT_COMBO = [[1, 2], [2, 4]]
# Actor id number 1 will learn and use Combo id 2, and Actor id number 2 will
# learn and use Combo id 4. The others won't learn any... Better to fill it for
# each actors.
#==============================================================================
  DEFAULT_COMBO = [[1,1],[2,1],[3,1],[4,4],[5,1],[6,1],[7,1],[8,1]]
end

module WLTR
  module COMBO_SETUP
#===============================================================================
# The term for the combo. Write it in a string.
#===============================================================================
    COMBO_TERM = "Combo"
  end
end
"=============================================================================="
"   BELOW IS TOO DANGEROUS TO READ WITHOUT PROPER SCRIPTING SKILLS. THEREFOR,  "
"                            EDIT AT YOUR OWN RISK!                            "
"=============================================================================="

module RPG
  class Combo
    attr_accessor :id
    attr_accessor :name
    attr_accessor :hit_array
    attr_accessor :hit_sequence
    attr_accessor :help
    def initialize
      @id = 0
      @name = ""
      @hit_array = []
      @hit_sequence = ""
      @help = ""
    end
  end
end

class Game_System
  include N01
  def learn_combo(actor_id,combo_id)
    $game_actors[actor_id].learn_combo($data_combos[combo_id])
  end
 
  def combo_update
    for combo in DEFAULT_COMBO
      $game_actors[combo[0]].learn_combo($data_combos[combo[1]])
    end
    for i in 1...$data_actors.size
      $game_actors[i].current_combo = $game_actors[i].combos[0]
    end
  end
end

class Scene_Title < Scene_Base
  include N01
  alias main_yuk start
  def start
    $data_combos = [nil]
    for i in 1...COMBOS.size
      $data_combos.push(RPG::Combo.new)
      $data_combos[i].id = i
      $data_combos[i].name = COMBOS[i][0]
      $data_combos[i].hit_array = COMBOS[i][1]
      $data_combos[i].hit_sequence = COMBOS[i][2]
      $data_combos[i].help = COMBOS[i][3]
    end
   
    main_yuk
   
    $game_system.combo_update
  end
 
  alias command_new_game_cuy command_new_game
  def command_new_game
    command_new_game_cuy
    default_combo
  end
 
  def default_combo
    for combo in N01::DEFAULT_COMBO
      $game_system.learn_combo(combo[0],combo[1])
    end
    for i in 1...$data_actors.size
      $game_actors[i].current_combo = $game_actors[i].combos[0]
    end
  end
end


#draw box  method... credit to Trickster
class Bitmap
  def draw_box(outer, color, width = 1, height = 1)
    fill_rect(outer, color)
    inner = Rect.new(outer.x + width, outer.y + height, outer.width - width * 2,
    outer.height - height * 2)
    fill_rect(inner, Color.new(0, 0, 0, 0))
  end
end

class Window_Timing < Window_Base
  attr_accessor :time
  def initialize(time,x,y)
    super(0,0, 640, 480)
    @before_start = 60
    @time = time
    @begin_time = time
    @target_x = x
    @target_y = y
    @size = 150
    @size2 = 30
    @jarak = 0.2*@begin_time.to_f
    @viewport1 = Viewport.new(0, 0, 640, 480)
    @viewport1.visible = true
    @viewport1.z = 7000
    @activate_sprite = Sprite.new(@viewport1)
    @activate_sprite.bitmap = Bitmap.new(@size,@size)
    rect = Rect.new(0,0,@size,@size)
    @activate_sprite.bitmap.draw_box(rect, Color.new(150,100,100), 3, 3)
    @activate_sprite.x = @target_x - (@size/2)
    @activate_sprite.y = @target_y - (@size/2)
    self.z = 5000
    self.opacity = 0
    self.contents.dispose if self.contents != nil
    self.contents = Bitmap.new(width - 32, height - 32)
    rect = Rect.new(@target_x-@size2, @target_y-@size2, @size2, @size2)
    self.contents.draw_box(rect, Color.new(250,200,200,150), 4, 4)
  end
  def on_hit
    i = (@time.to_f/@begin_time.to_f)
    return i >=  0.05 && i <= 0.25
  end
  def refresh
    i = (@time.to_f/@begin_time.to_f)
    @activate_sprite.zoom_x = i
    @activate_sprite.zoom_y = i
    @activate_sprite.x = @target_x - ((@size*i).to_i/2)
    @activate_sprite.y = @target_y - ((@size*i).to_i/2)
  end
  def result(success)
    self.contents.dispose if self.contents != nil
    self.contents = Bitmap.new(width - 32, height - 32)
    rect = Rect.new(@target_x-@size2, @target_y-@size2, @size2, @size2)
    if success
      self.contents.fill_rect(rect, Color.new(250,200,200,150))
    else
      self.contents.fill_rect(rect, Color.new(200,200,250,150))
    end
  end
  def dispose
    super
    @activate_sprite.dispose
    @activate_sprite = nil
    @time = 0
  end
  def update
    super
    refresh
    @time -= 1
  end
end
class Scene_Battle < Scene_Base
  def playing_action
    loop do
      update_basic
      action = @active_battler.play
      next if action == 0
      @active_battler.play = 0
      if action[0] == "Individual"
        individual
      elsif action == "Timing"
        start_timing
        while $timing
          update_timing_window
        end
      elsif action == "Can Collapse"
        unimmortaling
      elsif action == "Cancel Action"
        break action_end
      elsif action == "End"
        break action_end
      elsif action[0] == "OBJ_ANIM"
        @target_battlers = @active_battler.action.make_attack_targets
        @target_battlers[0].set_modifier(@active_battler)
        damage_action(action[1])
      end
    end 
  end
 
  def start_timing
    x = @target_battlers[0].position_x
    y = @target_battlers[0].position_y
    @timing_window = Window_Timing.new(@active_battler.time_delay,x,y)
    $timing = true
    @skill_window.visible = false if @skill_window != nil
    @item_window.visible = false if @item_window != nil
  end
 
  def update_timing_window(basic = false)
    if !basic
      Graphics.update
      Input.update
    end
    @timing_window.update
    update_timing
  end
 
  def update_timing
    if @timing_window.time <= 0
      @timing_window.result(false)
      $failure = true
      end_timing_process
    end
    if Input.trigger?(Input::C) && @timing_window != nil
      if @timing_window.on_hit
        @timing_window.result(true)
        end_timing_process
      else
        @timing_window.result(false)
        $failure = true
        end_timing_process
      end
    end
  end
  def end_timing_process
    i = 0
    loop do
      Graphics.update
      Input.update
      i += 1
      break if i == 5
    end
    $timing = false
    @timing_window.dispose
    @timing_window = nil
    @skill_window.visible = true if @skill_window != nil
    @item_window.visible = true if @item_window != nil
  end
 
  def execute_action_attack
    if @active_battler.actor?
      if @active_battler.weapon_id == 0
        action = @active_battler.non_weapon
        immortaling
      else
        action = @active_battler.current_combo.hit_sequence
        if $data_weapons[@active_battler.weapon_id].state_set.include?(1)
          for member in $game_party.members + $game_troop.members
            next if member.immortal
            next if member.dead?
            member.dying = true
          end
        else
          immortaling
        end
      end 
    else
      if @active_battler.weapon == 0
        action = @active_battler.base_action
        immortaling
      else
        action = $data_weapons[@active_battler.weapon].base_action
        if $data_weapons[@active_battler.weapon].plus_state_set.include?(1)
          for member in $game_party.members + $game_troop.members
            next if member.immortal
            next if member.dead?
            member.dying = true
          end
        else
          immortaling
        end
      end 
    end
    target_decision
    @spriteset.set_action(@active_battler.actor?, @active_battler.index, action)
    playing_action
  end
end

class Sprite_Battler < Sprite_Base
  def action
    return if @active_action == nil
    action = @active_action[0]
    return cek_invert if action == "Cek Invert"
    return mirroring if action == "Invert"
    return angling if action == "angle"
    return zooming if action == "zoom"
    return mirage_on if action == "Afterimage ON"
    return mirage_off if action == "Afterimage OFF"
    return picture if action == "pic"
    return @picture.visible = false && @picture_time = 0 if action == "Clear image"
    return graphics_change if action == "change"
    return battle_anime if action == "anime"
    return balloon_anime if action == "balloon"
    return sound if action == "sound"
    return $game_switches[@active_action[1]] = @active_action[2] if action == "switch"
    return variable if action == "variable"
    return two_swords if action == "Two Wpn Only"
    return non_two_swords if action == "One Wpn Only"
    return necessary if action == "nece"
    return derivating if action == "der"
    return individual_action if action == "Process Skill"
    return individual_action_end if action == "Process Skill End"
    return non_repeat if action == "Don't Wait"
    return @battler.change_base_position(self.x, self.y) if action == "Start Pos Change"
    return @battler.base_position if action == "Start Pos Return"
    return change_target if action == "target"
    return send_action(action) if action == "Can Collapse"
    return send_action(action) if action == "Cancel Action"
    return state_on if action == "sta+"
    return state_off if action == "sta-"
    return Graphics.frame_rate = @active_action[1] if action == "fps"
    return floating if action == "float"
    return eval(@active_action[1]) if action == "script"
    return force_action if @active_action.size == 4
    return reseting if @active_action.size == 5
    return moving if @active_action.size == 7
    return battler_anime if @active_action.size == 9
    return moving_anime if @active_action.size == 11
    return anime_finish if action == "End"
    return timing_cont if action == "Timing"
  end
 
  def cek_invert
    if self.mirror
      self.mirror = false
      @weapon_R.mirroring if @anime_flug
    end
  end
 
  def next_action
    return @wait -= 1 if @wait > 0
    return if @anime_end == false
    return @unloop_wait -= 1 if @unloop_wait > 0
    if $failure and @battler.actor?
      @action = N01::ACTION["FAILURE_ACTION"].dup
      $failure = false
    end
    active = @action.shift
    @active_action = N01::ANIME[active]
    @wait = active.to_i if @active_action == nil
    action
  end
 
  def timing_cont
    @battler.play = 0
    @battler.play = "Timing" if @battler.active
    @battler.time_delay = @active_action[1] if @battler.active
  end
end

class Game_Battler
  attr_accessor :time_delay
  alias timing_initialize initialize
  def initialize
    timing_initialize
    @time_delay = 0
  end
  def set_modifier(battler)
    if battler == nil
      @modifier = nil
    else
      battler.hit_array != nil ? array = battler.hit_array : array = [1]
      @modifier = array.dup if @modifier == [] or @modifier == nil
    end
  end
  def set_attack_damage_value(attacker)
    case DAMAGE_ALGORITHM_TYPE
    when 0
      atk = [attacker.atk - (self.pdef / 2), 0].max
      str = [20 + attacker.str, 0].max
    when 1
      atk = [attacker.atk - ((attacker.atk * self.pdef) / 1000), 0].max
      str = [20 + attacker.str, 0].max
    when 2
      atk = 20
      str = [(attacker.str * 4) - (self.dex * 2) , 0].max
    when 3
      atk = [(10 + attacker.atk) - (self.pdef / 2), 0].max
      str = [(20 + attacker.str) - (self.dex / 2), 0].max
    end
    i = @modifier.shift
    self.damage = (atk * str / 20 * i).to_i
    self.damage = 1 if self.damage == 0 and (rand(100) > 40)
    self.damage *= elements_correct(attacker.element_set)
    self.damage /= 100
  end
end

module N01
  ACTION.merge!("FAILURE_ACTION" => ["Can Collapse", "Afterimage OFF", "Cek Invert", "FLEE_RESET", "End"])
  ANIME.merge!("Cek Invert" => ["Cek Invert"])
end

class Game_Actor < Game_Battler
  attr_accessor :hit_array
  attr_accessor :hit_sequence
  attr_reader :combos
  attr_accessor :current_combo
  alias initialize_a initialize
  def initialize(actor_id)
    @combos = []
    @current_combo = nil
    initialize_a(actor_id)
  end
 
  def learn_combo(combo)
    unless @combos.include?(combo)
      @combos.push(combo)
      @combos.sort! do |a,b|
        a.id <=> b.id
      end
    end
  end
 
  alias shadow_erase shadow
  def shadow
    return "" if !$game_temp.in_battle
    return shadow_erase
  end
end

class Game_Enemy < Game_Battler
  attr_accessor :hit_array
  attr_accessor :hit_sequence
end

class Window_ActorCommand < Window_Command
  #--------------------------------------------------------------------------
  # * Setup
  #     actor : actor
  #--------------------------------------------------------------------------
  def setup(actor)
    s1 = actor.current_combo.name
    s2 = Vocab::skill
    s3 = Vocab::guard
    s4 = Vocab::item
    if actor.class.skill_name_valid     # Skill command name is valid?
      s2 = actor.class.skill_name       # Replace command name
    end
    @commands = [s1, s2, s3, s4]
    @item_max = 4
    refresh
    self.index = 0
  end
end

class Scene_Combo < Scene_Base
  def initialize(actor_index = 0)
    @actor_index = actor_index
  end
 
  def start
    super
    create_menu_background
    @actor = $game_party.members[@actor_index]
    @help_window = Window_Help.new
    @face_window = Window_Combo_Status.new(0, 24 + 32, @actor)
    @combo_list = Window_Combos.new(0, 128 + 24+32, 544, 416 - 128 - 24 - 32, @actor)
    @combo_list.help_window = @help_window
    @combo_list.active = true
  end
 
  def update
    @help_window.update
    @face_window.update
    @combo_list.update
    update_combo_selection
  end
 
  def update_combo_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    elsif Input.trigger?(Input::C)
      Sound.play_equip
      @actor.current_combo = @actor.combos[@combo_list.index]
      @face_window.refresh
    end
  end
 
  def terminate
    super
    @help_window.dispose
    @face_window.dispose
    @combo_list.dispose
    dispose_menu_background
  end
 
  def next_actor
    @actor_index += 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Combo.new(@actor_index)
  end

  def prev_actor
    @actor_index += $game_party.members.size - 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Combo.new(@actor_index)
  end
 
  def return_scene
    $scene = Scene_Menu.new
  end
end

class Window_Combos < Window_Selectable
  def initialize(x, y, width, height, actor)
    super(x, y, width, height)
    @actor = actor
    @column_max = 2
    self.index = 0
    refresh
  end
 
  def item
    return @data[self.index]
  end

  def refresh
    @data = []
    for item in @actor.combos
      @data.push(item)
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end

  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    if item != nil
      rect.width -= 4
      self.contents.draw_text(rect, item.name, 1)
    end
  end
 
  def update_help
    @help_window.set_text(item == nil ? "" : item.help)
  end
end

class Window_Combo_Status < Window_Base
  def initialize(x, y, actor)
    super(x, y, 544, 128)
    @actor = actor
    refresh
  end
 
  def refresh
    self.contents.clear
    @battler_sprite.dispose unless @battler_sprite == nil
    @battler_sprite = Sprite_Battler.new(Viewport.new(x, y - 40, 544, 416), @actor)
    @battler_sprite.make_battler
    @battler_sprite.first_action
    @battler_sprite.stand_by
    @battler_sprite.x = 0
    @battler_sprite.y = 0
    self.z = 0
    @battler_sprite.z = 11
    draw_actor_face(@actor, self.width - 144, 0)
    draw_actor_name(@actor, 0, 0)
    draw_actor_class(@actor, 0, 0 + 18)
    draw_actor_level(@actor, 0, 0 + 36)
    draw_actor_hp(@actor, 0, 0 + 54, 120)
    draw_actor_mp(@actor, 0, 0 + 72, 120)
    self.contents.draw_text(272 - 100, 0, 200, 20, "Current " + WLTR::COMBO_SETUP::COMBO_TERM, 1)
    self.contents.draw_text(272 - 100, 22, 200, 20, @actor.current_combo.name, 1)
  end
 
  def update
    super
    @battler_sprite.update
    @battler_sprite.x = 16 + 180
    @battler_sprite.y = 16 + 72 + 40
    @battler_sprite.z = 100
  end
 
  def dispose
    super
    @battler_sprite.dispose
  end
end
#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================
Demo
Untuk demo scriptnya dapat di download disini

0 komentar:

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Posting Komentar

 
© Copyright 2011. All rights reserved | www.techiru.com is proudly powered by Style Logic | My_Creation