O TEMA DO FÓRUM ESTÁ EM MANUTENÇÃO. FEEDBACKS AQUI: ACESSAR

The Legend of Dragoon System no mapa?

Iniciado por Foghart, 17/01/2013 às 11:53

17/01/2013 às 11:53 Última edição: 17/01/2013 às 11:55 por Foghart
Olá galera do Centro RPG Maker!
Eu uso um sistema bem interessante no meu modo de batalha, que é um sistema semelhante ao do jogo de PSX: The Legend of Dragoon (tenho videos desse game no meu canal, quem quiser assistir =D)
Ele funciona perfeitamente no modo de batalha, mas o que eu estava querendo saber é se tem como fazer um segundo desse script que funcione no mapa para puzzles. Sabe aqueles games onde tem cenas de ação e tem que apertar um botão para você sobreviver? Tal como os jogos atuais de PS3 e XBOX360? Pois bem, eu estava querendo fazer isso sem ser por eventos pois iria dar MUITO trabalho. (Não que eu não saiba fazer, mas da trabalho demais)

Então, algum scripter pode dar uma olhada nesse script e adaptar para ser executado no mapa também? Dando as condições de se acertar ou não o botão?
Lembrando que eu ainda vou precisar desse script funcionando tanto em batalha como no mapa também, não sei se seria melhor criar um novo com dados diferentes ou se tem como fazer esse sistema dentro do script atual.
Script:
================================================================================
                          COMBO ACTIVATOR v1.3VX
                      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.
  "FAIL" => ["Can Collapse","COORD_RESET","Cancel Action","End"]
  }
#==============================================================================
  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_10" => ["Timing", 10],
  "TIME_15" => ["Timing", 15],
  "TIME_20" => ["Timing", 20],
  "TIME_25" => ["Timing", 25],
  "TIME_30" => ["Timing", 30],
  "TIME_35" => ["Timing", 35],
  "TIME_40" => ["Timing", 40],
  "TIME_45" => ["Timing", 45],
  "TIME_50" => ["Timing", 50],
  "TIME_55" => ["Timing", 55],
  "TIME_60" => ["Timing", 60]
  }
#==============================================================================
  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."],
            ["Link Combo", [1, 1, 1], "SKILL_90_SEQUENCE", "A link combo sample."]
#==============================================================================
  ]
#==============================================================================
# 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,2],[2,5],[3,2],[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"
    
#===============================================================================
# This adjust the target square's horizontal position. The bigger the number,
# the more it goes to the right.
#===============================================================================
    TARGET_X = -10
    
#===============================================================================
# This adjust the target square's vertical position. The bigger the number, the
# more it goes to the bottom.
#===============================================================================
    TARGET_Y = -50
    
#===============================================================================
# The trigger for activating the combo. Write Input::(the desired button). It's
# based on gamepad buttons. If you want the activation is by pressing D, write
# Input::Z there.
#===============================================================================
    TRIGGER = Input::C
    
#===============================================================================
# The sequence if the combo fails. Please remember to put "End" at the desired
# sequence. The default is "FAILURE_ACTION". This applies for a confusion status
# aswell, for evading bugs.
#===============================================================================
    FAIL_MOVEMENT = "FAIL"
  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 + WLTR::COMBO_SETUP::TARGET_X
    @target_y = y + WLTR::COMBO_SETUP::TARGET_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

if defined?(N02)
class Sprite_Battler < Sprite_Base
  def make_battler
    make_battler_n01
    @battler.graphics_width = @width
    @battler.graphics_height = @height
    make_atb if $game_temp.in_battle
  end  
end
end

class Scene_Battle < Scene_Base
  def playing_action
    loop do
      if defined?(N02)
        break if @judge
      end
      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?(WLTR::COMBO_SETUP::TRIGGER) && @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.current_combo.hit_sequence
        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 
    action = WLTR::COMBO_SETUP::FAIL_MOVEMENT if @active_battler.berserker? or @active_battler.confusion?
    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[WLTR::COMBO_SETUP::FAIL_MOVEMENT].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
  
  alias modify_damage make_attack_damage_value
  def make_attack_damage_value(attacker)
    modify_damage(attacker)
    
    i = @modifier.shift
    damage = @hp_damage
    damage *= i
    damage.round
    @hp_damage = damage                             # damage HP
  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
#
#===============================================================================

Esse script está com algumas definições já alteradas para a função do meu game, como o "TIME_25", "TIME_30"... "FAIL" => ["Can Collapse","COORD_RESET","Cancel Action","End"] etc...
Mas quem puder me ajudar estará me fazendo um grande favor!

Obrigado galera!
Foghart

Cara não quero ser o chato, mas assim eu dei uma olhada no script e ele é bem extenso, além disso ele mexe muito com classes/métodos/códigos especificos de batalha, ou seja fazer ele pegar no mapa teria que refaze-lo :/ já que o autor desse script pensou apenas em faze-lo para a batalha. Então não sei se alguém irá edita-lo para você :/.

Ah tudo bem, se eu não tiver chance nenhuma de fazer esse script para mapas eu tento fazer por evento!
Valeu pela atenção!