查看: 1901|回复: 4

[已经解决] 光标脚本与sideview冲突

[复制链接]
梦石
0
星屑
1143
在线时间
186 小时
注册时间
2017-8-2
回帖
1
发表于 2019-10-24 18:46:24 | 显示全部楼层 |阅读模式
悬赏200星屑已解决
https://atelierrgss.wordpress.com/rgss3-battle-cursor/

先附上光标脚本的网址

问题是这样的,只要技能的目标是『自己』的时候,
就会卡在sideview特技待机的动画那里。
而技能的对象是『一个队员』的时候,
连光标都不会出现,
有什么方法能解决吗?

拜托各位大哥了

最佳答案

查看完整内容

396行跟397行,可以尝试一下加减数值
梦石
0
星屑
9813
在线时间
1647 小时
注册时间
2012-6-6
回帖
306
发表于 2019-10-24 18:46:25 | 显示全部楼层
fish12358 发表于 2019-10-25 18:06
昨天自己摸索了以后发现,只要把 On Skill OK跟 On Item OK这两段删了以后,对自己施放技能时就不会出错 ...

396行跟397行,可以尝试一下加减数值
回复

使用道具 举报

梦石
0
星屑
9813
在线时间
1647 小时
注册时间
2012-6-6
回帖
306
发表于 2019-10-25 09:16:37 | 显示全部楼层
把这放到Sideview下面试试看吧,不行的话那就没办法
[pre lang="ruby"]$imported = {} if $imported.nil?
$imported[:mog_battle_cursor] = true

#==============================================================================
# ■ CURSOR SETTING
#==============================================================================
module MOG_BATTLE_CURSOR
  #相对于目标的指针位置.
  CURSOR_POSITION = [0, 48]
  #目标名的位置.
  CURSOR_NAME_POSITION = [-10, 46]
  #指针是否左右滑动.
  CURSOR_SLIDE_EFFECT = true
  #指针是否上下浮动.
  CURSOR_FLOAT_EFFECT = true
  #指针的Z坐标.
  CURSOR_Z = 155
  #第二个指针的相对于目标的位置.
  TARGET_CURSOR_2_POS = [0, 0]
  #第二个指针是否有缩放效果.
  TARGET_CURSOR_2_ZOOM_EFFECT = false
end

#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
  
  attr_accessor :battle_cursor
  attr_accessor :battle_cursor_data
  attr_accessor :target_skill
  attr_accessor :battle_end
  attr_accessor :sprite_visible
  attr_accessor :battle_cursor_need_refresh
  attr_accessor :battle_cursor_scope_refresh
  attr_accessor :battle_cursor_target
  attr_accessor :target_data
  attr_accessor :target_cursor_need_refresh
  attr_accessor :target_window_active
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------  
  alias mog_battle_cursor_initialize initialize
  def initialize
      @battle_cursor = [0,0,false,""] ; @target_skill = [] ; @battle_end = false
      @battle_cursor_need_refresh = [false,false] ; @battle_cursor_target = [nil,nil]
      @target_data = [nil,nil] ; @target_cursor_need_refresh = false
      @target_window_active = [false,false] ; @battle_cursor_scope_refresh = false
      mog_battle_cursor_initialize
  end  
  
  #--------------------------------------------------------------------------
  # ● Clear Target Temp
  #--------------------------------------------------------------------------   
  def clear_target_temp
      $game_party.members.each {|t| t.target_temp = false } rescue nil
      $game_troop.members.each {|t| t.target_temp = false } rescue nil   
      @target_data = [nil,nil] ; @battle_cursor_target = [nil,nil]
  end
   
  #--------------------------------------------------------------------------
  # ● Sprite Visible
  #--------------------------------------------------------------------------   
  def sprite_visible
      return false if $game_message.visible
      return false if $game_temp.battle_end
      return true
  end
  
end

#==============================================================================
# ■ Spriteset Battle Cursor
#==============================================================================
class Sprite_Battle_Cursor < Sprite
  include MOG_BATTLE_CURSOR
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------        
  def initialize(viewport = nil)
      super(viewport)
      $game_temp.battle_cursor = [0,0,false,""] ; $game_temp.battle_end = false
      self.bitmap = Cache.system("Battle_Cursor")
      self.visible = $game_temp.battle_cursor[2] ; self.z = CURSOR_Z
      @cw = self.bitmap.width / 2 ; @ch = [self.bitmap.height, Graphics.height - self.bitmap.height]
      @cursor_name = Sprite.new ; @cursor_name.bitmap = Bitmap.new(120,32)
      @cursor_name.z = self.z + 1 ; @cursor_name.bitmap.font.size = 16
      @cursor_name_enemy = $game_temp.battle_cursor[3] ; @cs_x = 0
      @cursor_name_position = [CURSOR_NAME_POSITION[0] ,CURSOR_NAME_POSITION[1]]
      @cursor_float = [0,0] ;  refresh_cursor_name
      @face_battler = SceneManager.face_battler? if $imported[:mog_battle_hud_ex]
      @cs_x = (15 * MOG_SPRITE_ACTOR::SPRITE_ZOOM).truncate if $imported[:mog_sprite_actor]  
  end

  #--------------------------------------------------------------------------
  # ● Dispose Sprite
  #--------------------------------------------------------------------------         
  def dispose
      super
      dispose_sprite_cursor
  end
  
  #--------------------------------------------------------------------------
  # ● Dispose Sprite Cursor
  #--------------------------------------------------------------------------            
  def dispose_sprite_cursor
      @cursor_name.bitmap.dispose ; @cursor_name.dispose
      self.bitmap.dispose ; $game_temp.clear_target_temp
  end

  #--------------------------------------------------------------------------
  # ● Refresh Cursor Name
  #--------------------------------------------------------------------------              
  def refresh_cursor_name
      @cursor_name_enemy = $game_temp.battle_cursor[3]
      @cursor_name.bitmap.clear
      @cursor_name.bitmap.draw_text(0,0,120,32,@cursor_name_enemy.to_s,1)
  end

  #--------------------------------------------------------------------------
  # ● Update Sprite Cursor
  #--------------------------------------------------------------------------              
  def update_sprite_cursor
      update_battle_camera_cursor if update_battle_cursor_r?
      if force_hide? ; self.visible = false ; @cursor_name.visible = false ; return ; end
      update_visible ; update_cursor_float_effect ; set_real_position
      execute_move(0,self.x,$game_temp.battle_cursor[0])
      execute_move(1,self.y,$game_temp.battle_cursor[1] + @cursor_float[1])
      update_sprite_name
      self.visible = false if !$game_temp.sprite_visible
      @cursor_name.opacity = 0 if @cursor_name and !$game_temp.sprite_visible
  end
  
  #--------------------------------------------------------------------------
  # ● Process Cursor Move
  #--------------------------------------------------------------------------
  def process_cursor_move
      return unless cursor_movable?
      last_index = @index
      cursor_move_index(1) if Input.repeat?(:DOWN)
      cursor_move_index(-1) if Input.repeat?(:UP)
      cursor_move_index(1) if Input.repeat?(:RIGHT)
      cursor_move_index(-1) if Input.repeat?(:LEFT)
      $game_temp.battle_cursor_data = $game_troop.alive_members[@index]
      Sound.play_cursor if @index != last_index
  end
  #--------------------------------------------------------------------------
  # ● Update Battle Cursor
  #--------------------------------------------------------------------------              
  def update_battle_cursor_r?
      return false if $imported[:mog_battle_camera] == nil
      if $imported[:mog_battle_hud_ex] and SceneManager.face_battler? and $game_temp.battle_cursor_target[0] != nil
         self.ox = 0 ; self.oy = 0 ; @cursor_name.ox = 0 ; @cursor_name.oy = 0
         return false
      end   
      return true
   end   
      
  #--------------------------------------------------------------------------
  # ● Update Battle Camera Cursor
  #--------------------------------------------------------------------------              
  def update_battle_camera_cursor
      self.ox = $game_temp.viewport_oxy[0]
      self.oy = $game_temp.viewport_oxy[1]
      @cursor_name.ox = self.ox
      @cursor_name.oy = self.oy
  end

  #--------------------------------------------------------------------------
  # ● Set Real Position
  #--------------------------------------------------------------------------              
  def set_real_position  
      return if $game_temp.target_data == [nil,nil]
      return if $game_temp.battle_cursor_target == [nil,nil]
      $game_temp.battle_cursor[0] = $game_temp.target_data[1].x - @cw + CURSOR_POSITION[0]
      $game_temp.battle_cursor[1] = $game_temp.target_data[1].y + CURSOR_POSITION[1]
      $game_temp.battle_cursor[1] -= ($game_temp.target_data[1].bitmap.height / 2) unless !$game_temp.target_data[1].bitmap
      if $game_temp.target_data[0].is_a?(Game_Actor)
         if $imported[:mog_sprite_actor] and $game_temp.target_data[0].dead?
            if $game_temp.target_data[0].bact_sprite[5] == 6
               $game_temp.battle_cursor[0] -= @cs_x
            else
               $game_temp.battle_cursor[0] += @cs_x
            end   
         end         
         $game_temp.battle_cursor[1] -= @ch[0] if @face_battler and $game_temp.battle_cursor[1] > @ch[1]
      end      
  end
   
  #--------------------------------------------------------------------------
  # ● Can Move Real Position?
  #--------------------------------------------------------------------------               
  def can_move_real_position?
      return false if $game_temp.battle_cursor_data == nil
      return false if $game_temp.battle_cursor_data.dead?
      screen_x = $game_temp.battle_cursor_data.screen_x rescue nil
      return false if screen_x == nil
      return true
  end   
      
  #--------------------------------------------------------------------------
  # ● Force Hide
  #--------------------------------------------------------------------------              
  def force_hide?
      return true if $game_temp.battle_cursor == nil
      return true if $game_temp.battle_cursor[0] == nil
      return true if $game_temp.battle_cursor[1] == nil   
      return false
  end
  
  #--------------------------------------------------------------------------
  # ● Update Visible
  #--------------------------------------------------------------------------               
  def update_visible
      $game_temp.battle_cursor_data = nil if !self.visible
      if force_hide_battle_cursor?
         self.visible = false ; return
      end  
      self.visible = $game_temp.battle_cursor[2]
      (self.x = -64 ; self.y = -64) if !self.visible
  end  
  
  #--------------------------------------------------------------------------
  # ● Force Hide Battle Cursor
  #--------------------------------------------------------------------------               
  def force_hide_battle_cursor?
      if $imported[:mog_sprite_actor] and !$game_temp.target_data.nil?
         return true if !$game_temp.target_data[0].bact_sprite_visiblle
      end  
      return true if $imported[:mog_active_chain] and $game_temp.chain_action_phase
      return true if $imported[:mog_atb_system] and BattleManager.actor == nil
#      return true if $imported[:mog_blitz_commands] and $game_temp.blitz_commands_phase
      return false
  end
  
  #--------------------------------------------------------------------------
  # ● Update Sprite Name
  #--------------------------------------------------------------------------               
  def update_sprite_name
      return if @cursor_name == nil
      refresh_cursor_name  if @cursor_name_enemy != $game_temp.battle_cursor[3]
      @cursor_name.x = self.x + @cursor_name_position[0]
      @cursor_name.y = self.y + @cursor_name_position[1]
      @cursor_name.opacity = self.opacity ; @cursor_name.visible = self.visible
  end  
  
  #--------------------------------------------------------------------------
  # ● Update Cursor Float Effect
  #--------------------------------------------------------------------------              
  def update_cursor_float_effect
      return if !CURSOR_FLOAT_EFFECT
      @cursor_float[0] += 1
      case @cursor_float[0]
        when 0..20  ; @cursor_float[1] += 1
        when 21..40 ; @cursor_float[1] -= 1
        else
          @cursor_float[0] = 0 ;   @cursor_float[1] = 0
      end        
  end  
  
  #--------------------------------------------------------------------------
  # ● Execute Move
  #--------------------------------------------------------------------------      
  def execute_move(type,cp,np)
      sp = 5 + ((cp - np).abs / 5)
      if cp > np
         cp -= sp ; cp = np if cp < np
      elsif cp < np
         cp += sp ; cp = np if cp > np
      end     
       self.x = cp if type == 0 ; self.y = cp if type == 1
  end      
  
end

#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------      
  alias mog_battle_cursor_initialize initialize
  def initialize
      mog_battle_cursor_initialize
      create_cursor
  end
  
  #--------------------------------------------------------------------------
  # ● Dispose
  #--------------------------------------------------------------------------      
  alias mog_battle_cursor_dispose dispose
  def dispose
      mog_battle_cursor_dispose
      dispose_battle_cursor
  end
  
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------         
  alias mog_battle_cursor_update update
  def update
      mog_battle_cursor_update
      update_battle_cursor
  end  
  
  #--------------------------------------------------------------------------
  # ● Create_Cursor
  #--------------------------------------------------------------------------        
  def create_cursor
      return if @battle_cursor != nil
      $game_temp.clear_target_temp ; @battle_cursor = Sprite_Battle_Cursor.new
  end
  
  #--------------------------------------------------------------------------
  # ● Dispose Cursor
  #--------------------------------------------------------------------------        
  def dispose_battle_cursor
      return if @battle_cursor == nil
      @battle_cursor.dispose ; @battle_cursor = nil
  end  
  
  #--------------------------------------------------------------------------
  # ● Update Battle Cursor
  #--------------------------------------------------------------------------         
  def update_battle_cursor
      return if @battle_cursor == nil
      @battle_cursor.update_sprite_cursor
  end
  
end

#==============================================================================
# ■ Battle Cursor Index
#==============================================================================
module Battle_Cursor_index
  
  include MOG_BATTLE_CURSOR
  
  #--------------------------------------------------------------------------
  # ● Check Index Limit
  #--------------------------------------------------------------------------      
  def check_index_limit
      self.index = 0 if self.index >= item_max
      self.index = (item_max - 1) if self.index < 0
  end      
  
  #--------------------------------------------------------------------------
  # ● Set Cursor Position Enemy
  #--------------------------------------------------------------------------   
  def set_cursor_position_enemy
      return if !self.active
      self.index = 0 if $game_troop.alive_members[self.index].nil?
      @fcursor = nil ; $game_temp.battle_cursor_need_refresh[1] = false
      $game_temp.battle_cursor[0] = $game_troop.alive_members[self.index].screen_x + CURSOR_POSITION[0] rescue nil
      $game_temp.battle_cursor[1] = $game_troop.alive_members[self.index].screen_y + CURSOR_POSITION[1] rescue nil
      $game_temp.battle_cursor[3] = $game_troop.alive_members[self.index].name rescue nil
      $game_temp.battle_cursor_data = $game_troop.alive_members[self.index]
      return if $game_temp.battle_cursor_data == nil
      enable_target_sprites($game_temp.battle_cursor_data.index)
  end

  #--------------------------------------------------------------------------
  # ● Enable Target Sprites
  #--------------------------------------------------------------------------   
  def enable_target_sprites(target_index)  
      return if $game_temp.target_skill.empty?
      if $imported[:mog_atb_system] and !BattleManager.subject.nil?
         $game_temp.battle_cursor_scope_refresh = true
      end   
      $game_temp.clear_target_temp ; battler = $game_temp.target_skill[1]
      type = $game_temp.target_skill[0].is_a?(RPG::Skill) ? 0 : 1
      target_index = $game_temp.battle_cursor_data.index
      battler.make_action_temp($game_temp.target_skill[0].id, target_index,type)      
      targets = battler.action_temp.make_targets.compact
      targets.each {|t| t.target_temp = true }
  end  
   
  #--------------------------------------------------------------------------
  # ● Refresh Scope Targets
  #--------------------------------------------------------------------------   
  def refresh_scope_targets
      targets = battler.action_temp.make_targets.compact
      targets.each {|t| t.target_temp = true }
  end
  
  #--------------------------------------------------------------------------
  # ● Set Cursor Position Actor
  #--------------------------------------------------------------------------   
  def set_cursor_position_actor
      return if !self.active
      self.index = 0 if $game_party.members[self.index].nil?
      @fcursor = nil ; $game_temp.battle_cursor_need_refresh[0] = false
      $game_temp.battle_cursor[0] = $game_party.members[self.index].sv.x + CURSOR_POSITION[0] rescue nil#screen_x + CURSOR_POSITION[0] rescue nil
      $game_temp.battle_cursor[1] = $game_party.members[self.index].sv.y + CURSOR_POSITION[1] rescue nil#screen_y + CURSOR_POSITION[1] rescue nil
      $game_temp.battle_cursor[3] = $game_party.members[self.index].name rescue nil
      $game_temp.battle_cursor_data = $game_party.members[self.index]
      $game_temp.battle_cursor = [0,0,false,0] if $game_temp.battle_cursor[0] == nil
      enable_target_sprites(self.index)
  end  
      
  #--------------------------------------------------------------------------
  # ● Process Cursor Move Index
  #--------------------------------------------------------------------------  
  def cursor_move_index(value = 0)
      self.index += value ;  check_index_limit
  end

end

#==============================================================================
# ■ Window_BattleActor
#==============================================================================
class Window_BattleActor < Window_BattleStatus
  include Battle_Cursor_index
  
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------  
  alias mog_battle_cursor_actor_update update
  def update
      pre_index = self.index
      mog_battle_cursor_actor_update
      $game_temp.battle_cursor_target[0] = $game_party.members[self.index]
      $game_temp.battle_cursor_target[0] = nil if !self.active      
      set_cursor_position_actor if refresh_cursor_position?(pre_index)
      $game_temp.target_window_active[0] = self.active
  end
  
  #--------------------------------------------------------------------------
  # ● Refresh Cursor Position
  #--------------------------------------------------------------------------  
  def refresh_cursor_position?(pre_index)
      return true if pre_index != self.index
      return true if @fcursor
      return true if $game_temp.battle_cursor_need_refresh[0]
      return false
  end

  #--------------------------------------------------------------------------
  # ● Show
  #--------------------------------------------------------------------------
  alias mog_battle_cursor_show show
  def show
      if @info_viewport
         set_cursor_position_actor ; $game_temp.battle_cursor[2] = true
         @fcursor = true
      end
      mog_battle_cursor_show
  end

  #--------------------------------------------------------------------------
  # ● Hide
  #--------------------------------------------------------------------------
  alias mog_battle_cursor_hide hide
  def hide
      $game_temp.battle_cursor[2] = false if @info_viewport
      if $game_temp.target_window_active[1] == false
         ($game_temp.clear_target_temp ; $game_temp.target_skill.clear) unless self.active
      end
      mog_battle_cursor_hide
  end  
  
  #--------------------------------------------------------------------------
  # ● Process Cursor Move
  #--------------------------------------------------------------------------
  def process_cursor_move
      return unless cursor_movable?
      last_index = @index
      cursor_move_index(1) if Input.repeat?(:DOWN)
      cursor_move_index(-1) if Input.repeat?(:UP)
      cursor_move_index(1) if Input.repeat?(:RIGHT)
      cursor_move_index(-1) if Input.repeat?(:LEFT)
      $game_temp.battle_cursor_data = $game_party.members[self.index]
      Sound.play_cursor if @index != last_index
  end
  
end

#==============================================================================
# ■ Game Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  attr_accessor :index
end

#==============================================================================
# ■ Game Troop
#==============================================================================
class Game_Troop < Game_Unit
   
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  alias mog_battle_cursor_setup setup
  def setup(troop_id)
      mog_battle_cursor_setup(troop_id)
      if can_sort_index?
         @enemies.sort! {|a,b| a.screen_x <=> b.screen_x}
         @enemies.each_with_index {|e, i| e.index = i }
      end
  end
  
  #--------------------------------------------------------------------------
  # * Can Sort Index?
  #--------------------------------------------------------------------------
  def can_sort_index?
      return false if @enemies.size < 3
      return false if troop.pages.size > 1
      return false if !troop.pages[0].list[0].parameters.empty? rescue false
      return true
  end
  
end

#==============================================================================
# ■ Window_BattleEnemy
#==============================================================================
class Window_BattleEnemy < Window_Selectable
  include Battle_Cursor_index
  
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------  
  alias mog_battle_cursor_enemy_update update
  def update
      pre_index = self.index
      mog_battle_cursor_enemy_update
      $game_temp.battle_cursor_target[1] = $game_troop.alive_members[self.index]
      $game_temp.battle_cursor_target[1] = nil if !self.active
      set_cursor_position_enemy if refresh_cursor_position?(pre_index)
      $game_temp.target_window_active[1] = self.active
  end
  
  #--------------------------------------------------------------------------
  # ● Refresh Cursor Position
  #--------------------------------------------------------------------------  
  def refresh_cursor_position?(pre_index)
      return true if pre_index != self.index
      return true if @fcursor
      return true if $game_temp.battle_cursor_need_refresh[1]
      return false
  end   
      
  #--------------------------------------------------------------------------
  # ● Show
  #--------------------------------------------------------------------------
  alias mog_battle_cursor_show show
  def show
      if @info_viewport
         set_cursor_position_enemy ; $game_temp.battle_cursor[2] = true
         @fcursor = true
      end
      mog_battle_cursor_show
  end
  
  #--------------------------------------------------------------------------
  # ● Hide
  #--------------------------------------------------------------------------
  alias mog_battle_cursor_hide hide
  def hide
      $game_temp.battle_cursor[2] = false if @info_viewport
      if $game_temp.target_window_active[0] == false
      ($game_temp.clear_target_temp ; $game_temp.target_skill.clear) unless self.active
      end
      mog_battle_cursor_hide
  end  
   
  #--------------------------------------------------------------------------
  # ● Process Cursor Move
  #--------------------------------------------------------------------------
  def process_cursor_move
      return unless cursor_movable?
      last_index = @index
      cursor_move_index(1) if Input.repeat?(:DOWN)
      cursor_move_index(-1) if Input.repeat?(:UP)
      cursor_move_index(1) if Input.repeat?(:RIGHT)
      cursor_move_index(-1) if Input.repeat?(:LEFT)
      $game_temp.battle_cursor_data = $game_troop.alive_members[@index]
      Sound.play_cursor if @index != last_index
  end
      
end

#==============================================================================
# ■ Window Selectable
#==============================================================================
class Window_Selectable < Window_Base  

  #--------------------------------------------------------------------------
  # * Process OK
  #-------------------------------------------------------------------------
  alias mog_target_cursor_process_ok process_ok
  def process_ok
      mog_target_cursor_process_ok
      execute_target_selection if can_execute_target_selection?
  end
  
  #--------------------------------------------------------------------------
  # * Can Execute Target Selection
  #-------------------------------------------------------------------------
  def can_execute_target_selection?
      return false if !SceneManager.scene_is?(Scene_Battle)
      return false if !current_item_enabled?
      return true if self.is_a?(Window_BattleSkill)
      return true if self.is_a?(Window_BattleItem)
      return true if self.is_a?(Window_ActorCommand) and self.index == 0
      return false
  end

  #--------------------------------------------------------------------------
  # * Execute Target Selection
  #-------------------------------------------------------------------------
  def execute_target_selection      
      return if BattleManager.actor == nil
      $game_temp.target_skill.clear
      item = @data[index] rescue nil      
      item = $data_skills[BattleManager.actor.attack_skill_id] rescue nil if self.is_a?(Window_ActorCommand)
      return if item == nil
      if [2,8,10].include?(item.scope) or item.note =~ /<Scope Range = (\d+) - (\d+) - (\d+) - (\d+)>/   
         $game_temp.target_skill = [item,BattleManager.actor]
      end   
  end  

end

#==============================================================================
# ■ Game Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
  
  attr_accessor :target_temp
  attr_accessor :action_temp
  
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias mog_target_cursor_initialize initialize
  def initialize
      @target_cursor_temp = false
      mog_target_cursor_initialize
  end
  
  #--------------------------------------------------------------------------
  # ● Make Action Temp
  #--------------------------------------------------------------------------
  def make_action_temp(action_id,target_index,type)
      return if action_id == nil
      action = Game_Action.new(self, true)
      action.set_skill(action_id) if type == 0
      action.set_item(action_id) if type == 1
      action.target_index = target_index
      @action_temp = action
  end     
  
  #--------------------------------------------------------------------------
  # ● Make Action Temp
  #--------------------------------------------------------------------------
  alias mog_battle_cursor_item_apply item_apply
  def item_apply(user, item)
      mog_battle_cursor_item_apply(user, item)
      if self == $game_temp.battle_cursor_target[1]
         $game_temp.battle_cursor_need_refresh[0] = true
         $game_temp.battle_cursor_need_refresh[1] = true
      end
  end  
  
end

#==============================================================================
# ■ Game BattlerBase
#==============================================================================
class Game_BattlerBase
   attr_accessor :hidden
end

#==============================================================================
# ■ Sprite Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
  include MOG_BATTLE_CURSOR
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias mog_target_cursor_initialize initialize
  def initialize(viewport, battler = nil)
      mog_target_cursor_initialize(viewport, battler)
      create_target_cursor
  end
  
  #--------------------------------------------------------------------------
  # * Create Target Cursor
  #--------------------------------------------------------------------------
  def create_target_cursor
      @target_cursor = Sprite.new
      @target_cursor.bitmap = Cache.system("Battle_Cursor2")
      @target_cursor.ox = @target_cursor.bitmap.width / 2
      @target_cursor.oy = @target_cursor.bitmap.height / 2
      @target_cursor_org = [@target_cursor.ox,@target_cursor.oy]
      @target_cursor.visible = false
      @target_visible_old = @target_cursor.visible
      @tc_pos = [TARGET_CURSOR_2_POS[0],TARGET_CURSOR_2_POS[1] + @target_cursor.oy]
      @face_battler = SceneManager.face_battler? if $imported[:mog_battle_hud_ex]
      @target_cursor_ch = [@target_cursor.bitmap.height, Graphics.height - @target_cursor.bitmap.height]
  end
  
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias mog_target_cursor_dispose dispose
  def dispose
      dispose_target_cursor
      mog_target_cursor_dispose
  end
  
  #--------------------------------------------------------------------------
  # * Dispose Target Cursor
  #--------------------------------------------------------------------------
  def dispose_target_cursor
      return if @target_cursor == nil
      @target_cursor.bitmap.dispose ; @target_cursor.dispose
  end
  
  #--------------------------------------------------------------------------
  # * Update Postion
  #--------------------------------------------------------------------------
  alias mog_target_cursor_update_position update_position
  def update_position
      mog_target_cursor_update_position
      update_battler_cursor_xy
      update_target_cursor
  end
  
  #--------------------------------------------------------------------------
  # * Update Battler Cursor
  #--------------------------------------------------------------------------
  def update_battler_cursor_xy
      return if @battler == nil
      return if $game_temp.battle_cursor_target[0] != nil and @battler != $game_temp.battle_cursor_target[0]
      return if $game_temp.battle_cursor_target[1] != nil and @battler != $game_temp.battle_cursor_target[1]
      $game_temp.target_data = [@battler,self]
  end  
  
  #--------------------------------------------------------------------------
  # * Update Target Cursor
  #--------------------------------------------------------------------------
  def update_target_cursor
      return if @target_cursor == nil
      refresh_zoom if @target_visible_old != @target_cursor.visible
      @target_cursor.visible = can_target_cursor_visible?
      return if !@target_cursor.visible
      @target_cursor.x = self.x + @tc_pos[0]
      @target_cursor.y = self.y + @tc_pos[1]
      @target_cursor.y -= (self.bitmap.height / 2) if self.bitmap
      if @battler.is_a?(Game_Actor) and @face_battler
         @target_cursor.y -= @target_cursor_ch[0] if @target_cursor.y > @target_cursor_ch[1]
      end           
      @target_cursor.z = CURSOR_Z + 1
      @target_cursor.opacity = 130 + rand(125)
      @target_cursor.zoom_x -= 0.05 if @target_cursor.zoom_x > 1.00
      @target_cursor.zoom_x = 1.00 if @target_cursor.zoom_x < 1.00
      @target_cursor.zoom_y = @target_cursor.zoom_x      
      update_battle_camera_cursor_t if update_battle_camera_cursor_t?
  end
  
  #--------------------------------------------------------------------------
  # * Update Battle Camera Cursor T
  #--------------------------------------------------------------------------
  def update_battle_camera_cursor_t?
      return false if $imported[:mog_battle_camera] == nil
      return false if @battler == nil
      if $imported[:mog_battle_hud_ex] and SceneManager.face_battler?
         return false if @battler.is_a?(Game_Actor)
      end  
      return true
  end
     
  #--------------------------------------------------------------------------
  # ● Update Battle Camera Cursor
  #--------------------------------------------------------------------------              
  def update_battle_camera_cursor_t
      @target_cursor.ox = $game_temp.viewport_oxy[0] + @target_cursor_org[0]
      @target_cursor.oy = $game_temp.viewport_oxy[1] + @target_cursor_org[1]
  end  
  
  #--------------------------------------------------------------------------
  # * Refresh Zoom
  #--------------------------------------------------------------------------
  def refresh_zoom
      @target_visible_old = @target_cursor.visible
      @target_cursor.zoom_x = 1.50 if TARGET_CURSOR_2_ZOOM_EFFECT
      @target_cursor.zoom_y = @target_cursor.zoom_x
  end
  
  #--------------------------------------------------------------------------
  # * Can Target Cursor Visible?
  #--------------------------------------------------------------------------
  def can_target_cursor_visible?
      return false if !$game_temp.battle_cursor[2]
      return false if @battler.dead?
      return false if @battler.hidden
      return false if !@battler.target_temp
      return false if $game_message.visible
      return false if $game_temp.battle_end
      return false if $imported[:mog_sprite_actor] and !@battler.bact_sprite_visiblle
      return false if $imported[:mog_active_chain] and $game_temp.chain_action_phase
      return false if $imported[:mog_atb_system] and BattleManager.actor == nil
#      return false if $imported[:mog_blitz_commands] and $game_temp.blitz_commands_phase
      return true
  end
  
end

#==============================================================================
# ■ Scene Battle
#==============================================================================
class Scene_Battle < Scene_Base
  
  #--------------------------------------------------------------------------
  # * On Skill OK
  #--------------------------------------------------------------------------
  def on_skill_ok
      if $imported[:mog_atb_system]
         return if BattleManager.actor == nil
         @skill_window.visible = false unless !@status_window.visible
      end
      @skill = @skill_window.item
      @skill_window.hide if @skill.for_opponent? or @skill.for_friend?
      BattleManager.actor.input.set_skill(@skill.id)
      BattleManager.actor.last_skill.object = @skill
     if [0,11].include?(@skill.scope)
        @skill_window.hide
        if $imported[:mog_atb_system]
           next_command
           BattleManager.command_end
           hide_base_window
        end               
      elsif @skill.for_opponent?
          select_enemy_selection
      else
          select_actor_selection
      end
  end
  
  #--------------------------------------------------------------------------
  # * On Item OK
  #--------------------------------------------------------------------------
  def on_item_ok
      if $imported[:mog_atb_system]
         return if BattleManager.actor == nil
         @item_window.visible = false unless !@status_window.visible
      end   
      @item = @item_window.item
      @item_window.hide if @item.for_opponent? or @item.for_friend?
      BattleManager.actor.input.set_item(@item.id)
      if [0,11].include?(@item.scope)
         @item_window.hide
         next_command
         if $imported[:mog_atb_system]
            next_command
            BattleManager.command_end
            hide_base_window
         end         
      elsif @item.for_opponent?
          select_enemy_selection
      else
          select_actor_selection
      end
      $game_party.last_item.object = @item
  end  
   
  #--------------------------------------------------------------------------
  # * Turn End
  #--------------------------------------------------------------------------
  alias mog_battle_cursor_turn_end turn_end
  def turn_end
      mog_battle_cursor_turn_end
      if $game_temp.battle_cursor_scope_refresh
         $game_temp.battle_cursor_scope_refresh = false
         $game_temp.battle_cursor_need_refresh[0] = true
         $game_temp.battle_cursor_need_refresh[1] = true
      end        
  end  
  
end[/pre]
回复

使用道具 举报

梦石
1
星屑
14374
在线时间
2109 小时
注册时间
2017-9-28
回帖
607
发表于 2019-10-25 10:11:39 | 显示全部楼层
本帖最后由 Nil2018 于 2019-10-25 10:12 编辑

我是mog指针+victor指针一起用...两者还要修改部分内容才兼容
我不会写脚本就只能这样了

2333.gif

mog#==============================================================================
# +++ MOG - 战斗指针 (2.2) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# 战斗选择目标时显示动态指针.
#==============================================================================
# 需要以下图片. (Graphics/System)
#
# Battle_Cursor.png
# Battle_Cursor2.png *(需要脚本:"目标范围 EX")
#
#==============================================================================
# 注意 - 请把本脚本放在脚本:"MOG - 战斗图动态效果"之下
#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# (2.2) Melhoria no sistema de posi??o da origem Z.
#==============================================================================

#==============================================================================
# ■ CURSOR SETTING
#==============================================================================
module MOG_BATTLE_CURSOR
  #相对于目标的指针位置.
  CURSOR_POSITION = [-5, -10]
  #目标名的位置.
  CURSOR_NAME_POSITION = [-20, 15]
  #指针是否左右滑动.
  CURSOR_SLIDE_EFFECT = true
  #指针是否上下浮动.
  CURSOR_FLOAT_EFFECT = false
  #指针的Z坐标.
  CURSOR_Z = 155
  #第二个指针的相对于目标的位置.
  TARGET_CURSOR_2_POS = [0, -48]
  #第二个指针是否有缩放效果.
  TARGET_CURSOR_2_ZOOM_EFFECT = false
end

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

#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
  
  attr_accessor :battle_cursor
  attr_accessor :battle_cursor_data
  attr_accessor :target_skill
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------  
  alias mog_battle_cursor_initialize initialize
  def initialize
      @battle_cursor = [0,0,false,""] ; @target_skill = []
      mog_battle_cursor_initialize
  end  
  
  #--------------------------------------------------------------------------
  # ● Clear Target Temp
  #--------------------------------------------------------------------------   
  def clear_target_temp
      $game_party.members.each {|t| t.target_temp = false } rescue nil
      $game_troop.members.each {|t| t.target_temp = false } rescue nil      
  end
   
end

#==============================================================================
# ■ Spriteset Battle Cursor
#==============================================================================
class Sprite_Battle_Cursor < Sprite
  include MOG_BATTLE_CURSOR
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------        
  def initialize(viewport = nil)
      super(viewport)
      $game_temp.battle_cursor = [0,0,false,""]
      self.bitmap = Cache.system("Battle_Cursor")
      self.visible = $game_temp.battle_cursor[2] ; self.z = CURSOR_Z
      @cursor_name = Sprite.new ; @cursor_name.bitmap = Bitmap.new(120,32)
      @cursor_name.z = self.z + 1 ; @cursor_name.bitmap.font.size = 16
      @cursor_name_enemy = $game_temp.battle_cursor[3]
      @cursor_name_position = [CURSOR_NAME_POSITION[0] ,CURSOR_NAME_POSITION[1]]
      @cursor_float = [0,0] ;  refresh_cursor_name
  end
  
  #--------------------------------------------------------------------------
  # ● Dispose Sprite
  #--------------------------------------------------------------------------         
  def dispose
      super
      dispose_sprite_cursor
  end
  
  #--------------------------------------------------------------------------
  # ● Dispose Sprite Cursor
  #--------------------------------------------------------------------------            
  def dispose_sprite_cursor
      @cursor_name.bitmap.dispose ; @cursor_name.dispose
      self.bitmap.dispose ; $game_temp.clear_target_temp
  end

  #--------------------------------------------------------------------------
  # ● Refresh Cursor Name
  #--------------------------------------------------------------------------              
  def refresh_cursor_name
      @cursor_name_enemy = $game_temp.battle_cursor[3]
      @cursor_name.bitmap.clear
      @cursor_name.bitmap.draw_text(0,0,120,32,@cursor_name_enemy.to_s,1)
  end

  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------            
  def update
      super
      update_sprite_cursor
  end

  #--------------------------------------------------------------------------
  # ● Update Sprite Cursor
  #--------------------------------------------------------------------------              
  def update_sprite_cursor
      update_visible ; update_cursor_float_effect
      execute_move(0,self.x,$game_temp.battle_cursor[0])
      execute_move(1,self.y,$game_temp.battle_cursor[1] + @cursor_float[1])
      update_sprite_name
  end

  #--------------------------------------------------------------------------
  # ● Update Visible
  #--------------------------------------------------------------------------               
  def update_visible
      self.visible = $game_temp.battle_cursor[2]
      (self.x = -64 ; self.y = -64) if !self.visible
  end  
  
  #--------------------------------------------------------------------------
  # ● Update Sprite Name
  #--------------------------------------------------------------------------               
  def update_sprite_name
      return if @cursor_name == nil
      refresh_cursor_name  if @cursor_name_enemy != $game_temp.battle_cursor[3]
      @cursor_name.x = self.x + @cursor_name_position[0]
      @cursor_name.y = self.y + @cursor_name_position[1]
      @cursor_name.opacity = self.opacity ; @cursor_name.visible = self.visible
  end  
  
  #--------------------------------------------------------------------------
  # ● Update Cursor Float Effect
  #--------------------------------------------------------------------------              
  def update_cursor_float_effect
      return if !CURSOR_FLOAT_EFFECT
      @cursor_float[0] += 1
      case @cursor_float[0]
        when 0..20  ; @cursor_float[1] += 1
        when 21..40 ; @cursor_float[1] -= 1
        else
          @cursor_float[0] = 0 ;   @cursor_float[1] = 0
      end        
  end  
  
  #--------------------------------------------------------------------------
  # ● Execute Move
  #--------------------------------------------------------------------------      
  def execute_move(type,cp,np)
      sp = 5 + ((cp - np).abs / 5)
      if cp > np
         cp -= sp ; cp = np if cp < np
      elsif cp < np
         cp += sp ; cp = np if cp > np
      end     
      self.x = cp if type == 0 ; self.y = cp if type == 1
  end      
  
end

#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------      
  alias mog_battle_cursor_initialize initialize
  def initialize
      mog_battle_cursor_initialize
      create_cursor
  end
  
  #--------------------------------------------------------------------------
  # ● Dispose
  #--------------------------------------------------------------------------      
  alias mog_battle_cursor_dispose dispose
  def dispose
      mog_battle_cursor_dispose
      dispose_cursor
  end
  
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------         
  alias mog_battle_cursor_update update
  def update
      mog_battle_cursor_update
      update_battle_cursor
  end  
  
  #--------------------------------------------------------------------------
  # ● Create_Cursor
  #--------------------------------------------------------------------------        
  def create_cursor
      return if @battle_cursor != nil
      $game_temp.clear_target_temp ; @battle_cursor = Sprite_Battle_Cursor.new      
  end
  
  #--------------------------------------------------------------------------
  # ● Dispose Cursor
  #--------------------------------------------------------------------------        
  def dispose_cursor
      return if @battle_cursor == nil
      @battle_cursor.dispose
  end  
  
  #--------------------------------------------------------------------------
  # ● Update Battle Cursor
  #--------------------------------------------------------------------------         
  def update_battle_cursor
      return if @battle_cursor == nil
      @battle_cursor.update      
  end
  
end

#==============================================================================
# ■ Battle Cursor Index
#==============================================================================
module Battle_Cursor_index
  
  include MOG_BATTLE_CURSOR
  
  #--------------------------------------------------------------------------
  # ● Check Index Limit
  #--------------------------------------------------------------------------      
  def check_index_limit
      self.index = 0 if self.index >= item_max
      self.index = (item_max - 1) if self.index < 0
  end      
  
  #--------------------------------------------------------------------------
  # ● Set Cursor Position Enemy
  #--------------------------------------------------------------------------   
  def set_cursor_position_enemy
#~       return if !self.active
#~       @fcursor = nil
#~       $game_temp.battle_cursor[0] = $game_troop.alive_members[self.index].screen_x + CURSOR_POSITION[0] rescue nil
#~       $game_temp.battle_cursor[1] = $game_troop.alive_members[self.index].screen_y + CURSOR_POSITION[1] rescue nil
#~       $game_temp.battle_cursor[3] = $game_troop.alive_members[self.index].name rescue nil
#~       $game_temp.battle_cursor_data = $game_troop.alive_members[self.index]
#~       $game_temp.battle_cursor = [0,0,false,0] if $game_temp.battle_cursor[0] == nil
#~       enable_target_sprites($game_temp.battle_cursor_data.index)
  end
  
  #--------------------------------------------------------------------------
  # ● Enable Target Sprites
  #--------------------------------------------------------------------------   
  def enable_target_sprites(target_index)  
      return if $game_temp.target_skill.empty?
      $game_temp.clear_target_temp ; battler = $game_temp.target_skill[1]
      type = $game_temp.target_skill[0].is_a?(RPG::Skill) ? 0 : 1
      target_index = $game_temp.battle_cursor_data.index
      battler.make_action_temp($game_temp.target_skill[0].id, target_index,type)      
      targets = battler.action_temp.make_targets.compact
      targets.each {|t| t.target_temp = true }
  end  
   
  #--------------------------------------------------------------------------
  # ● Set Cursor Position Actor
  #--------------------------------------------------------------------------   
  def set_cursor_position_actor
      return if !self.active      
      @fcursor = nil
      $game_temp.battle_cursor[0] = $game_party.members[self.index].screen_x + CURSOR_POSITION[0] rescue nil
      $game_temp.battle_cursor[1] = $game_party.members[self.index].screen_y + CURSOR_POSITION[1] rescue nil
      $game_temp.battle_cursor[3] = $game_party.members[self.index].name rescue nil
      $game_temp.battle_cursor_data = $game_party.members[self.index]
      $game_temp.battle_cursor = [0,0,false,0] if $game_temp.battle_cursor[0] == nil
      enable_target_sprites(self.index)
  end  
  
  #--------------------------------------------------------------------------
  # ● Process Cursor Move
  #--------------------------------------------------------------------------
  def process_cursor_move
      $game_temp.battle_cursor_data = nil
      return unless cursor_movable?
      last_index = @index
      cursor_move_index(1) if Input.repeat?(:DOWN)
      cursor_move_index(-1) if Input.repeat?(:UP)
      cursor_move_index(1) if Input.repeat?(:RIGHT)
      cursor_move_index(-1) if Input.repeat?(:LEFT)
      $game_temp.battle_cursor_data = $game_troop.alive_members[@index]
      Sound.play_cursor if @index != last_index
  end
      
  #--------------------------------------------------------------------------
  # ● Process Cursor Move Index
  #--------------------------------------------------------------------------  
  def cursor_move_index(value = 0)
      self.index += value ;  check_index_limit
  end

end

#==============================================================================
# ■ Window_BattleActor
#==============================================================================
class Window_BattleActor < Window_BattleStatus
  include Battle_Cursor_index
  
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------  
  alias mog_battle_cursor_actor_update update
  def update
      pre_index = self.index
      mog_battle_cursor_actor_update
      set_cursor_position_actor if pre_index != self.index or @fcursor
  end  

  #--------------------------------------------------------------------------
  # ● Show
  #--------------------------------------------------------------------------
  alias mog_battle_cursor_show show
  def show
      if @info_viewport
         set_cursor_position_actor ; $game_temp.battle_cursor[2] = true
         @fcursor = true
      end
      mog_battle_cursor_show
  end

  #--------------------------------------------------------------------------
  # ● Hide
  #--------------------------------------------------------------------------
  alias mog_battle_cursor_hide hide
  def hide
      $game_temp.battle_cursor[2] = false if @info_viewport
      $game_temp.clear_target_temp ; $game_temp.target_skill.clear
      mog_battle_cursor_hide
  end  
  
end

#==============================================================================
# ■ Game Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  attr_accessor :index
end

#==============================================================================
# ■ Game Troop
#==============================================================================
class Game_Troop < Game_Unit
   
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  alias mog_battle_cursor_setup setup
  def setup(troop_id)
      mog_battle_cursor_setup(troop_id)
      if can_sort_index?
         @enemies.sort! {|a,b| a.screen_x <=> b.screen_x}
         @enemies.each_with_index {|e, i| e.index = i }
      end
  end
  
  #--------------------------------------------------------------------------
  # * Can Sort Index?
  #--------------------------------------------------------------------------
  def can_sort_index?
      return false if @enemies.size < 3
      return false if troop.pages.size > 1
      return false if !troop.pages[0].list[0].parameters.empty? rescue false
      return true
  end
  
end

#==============================================================================
# ■ Window_BattleEnemy
#==============================================================================
#~ class Window_BattleEnemy < Window_Selectable
#~   include Battle_Cursor_index
#~   
#~   #--------------------------------------------------------------------------
#~   # ● Update
#~   #--------------------------------------------------------------------------  
#~   alias mog_battle_cursor_enemy_update update
#~   def update
#~       pre_index = self.index
#~       mog_battle_cursor_enemy_update
#~       set_cursor_position_enemy if pre_index != self.index or @fcursor
#~   end
#~   
#~   #--------------------------------------------------------------------------
#~   # ● Show
#~   #--------------------------------------------------------------------------
#~   alias mog_battle_cursor_show show
#~   def show
#~       if @info_viewport
#~          set_cursor_position_enemy ; $game_temp.battle_cursor[2] = true
#~          @fcursor = true
#~       end
#~       mog_battle_cursor_show
#~   end
#~   
#~   #--------------------------------------------------------------------------
#~   # ● Hide
#~   #--------------------------------------------------------------------------
#~   alias mog_battle_cursor_hide hide
#~   def hide
#~       $game_temp.battle_cursor[2] = false if @info_viewport
#~       $game_temp.clear_target_temp ; $game_temp.target_skill.clear
#~       mog_battle_cursor_hide
#~   end  
#~   
#~ end

#==============================================================================
# ■ Window Selectable
#==============================================================================
class Window_Selectable < Window_Base  

  #--------------------------------------------------------------------------
  # * Process OK
  #-------------------------------------------------------------------------
  alias mog_target_cursor_process_ok process_ok
  def process_ok
      mog_target_cursor_process_ok
      execute_target_selection if can_execute_target_selection?
  end
  
  #--------------------------------------------------------------------------
  # * Can Execute Target Selection
  #-------------------------------------------------------------------------
  def can_execute_target_selection?
      return false if !SceneManager.scene_is?(Scene_Battle)
      return false if !current_item_enabled?
      return true if self.is_a?(Window_BattleSkill)
      return true if self.is_a?(Window_BattleItem)
      return true if self.is_a?(Window_ActorCommand) and self.index == 0
      return false
  end

  #--------------------------------------------------------------------------
  # * Execute Target Selection
  #-------------------------------------------------------------------------
  def execute_target_selection
      return if BattleManager.actor == nil
      $game_temp.target_skill.clear
      item = @data[index] rescue nil
      item = $data_skills[BattleManager.actor.attack_skill_id] rescue nil if self.is_a?(Window_ActorCommand)
      return if item == nil
      if [2,8,10].include?(item.scope) or item.note =~ /<Scope Range = (\d+) - (\d+) - (\d+) - (\d+)>/   
         $game_temp.target_skill = [item,BattleManager.actor]
      end   
  end  
  
end

#==============================================================================
# ■ Game Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
  
  attr_accessor :target_temp
  attr_accessor :action_temp
  
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias mog_target_cursor_initialize initialize
  def initialize
      @target_cursor_temp = false
      mog_target_cursor_initialize
  end
  
  #--------------------------------------------------------------------------
  # ● Make Action Temp
  #--------------------------------------------------------------------------
  def make_action_temp(action_id,target_index,type)
      return if action_id == nil
      action = Game_Action.new(self, true)
      action.set_skill(action_id) if type == 0
      action.set_item(action_id) if type == 1
      action.target_index = target_index
      @action_temp = action
  end     
  
end

#==============================================================================
# ■ Game BattlerBase
#==============================================================================
class Game_BattlerBase
   attr_accessor :hidden
end

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

  #--------------------------------------------------------------------------
  # * On Skill OK
  #--------------------------------------------------------------------------
  def on_skill_ok
      @skill = @skill_window.item
      BattleManager.actor.input.set_skill(@skill.id)
      BattleManager.actor.last_skill.object = @skill
      if [0,11].include?(@skill.scope)
         @skill_window.hide ; next_command
      elsif @skill.for_opponent?
         select_enemy_selection
      else
         select_actor_selection
      end
  end
  
  #--------------------------------------------------------------------------
  # * On Item OK
  #--------------------------------------------------------------------------
  def on_item_ok
      @item = @item_window.item
      BattleManager.actor.input.set_item(@item.id)
      if [0,11].include?(@item.scope)
         @item_window.hide ; next_command
      elsif @item.for_opponent?
         select_enemy_selection
      else
         select_actor_selection
      end
      $game_party.last_item.object = @item
  end
  
end

#==============================================================================
# ■ Sprite Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
  include MOG_BATTLE_CURSOR
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias mog_target_cursor_initialize initialize
  def initialize(viewport, battler = nil)
      mog_target_cursor_initialize(viewport, battler)
      create_target_cursor
  end
  
  #--------------------------------------------------------------------------
  # * Create Target Cursor
  #--------------------------------------------------------------------------
  def create_target_cursor
      @target_cursor = Sprite.new
      @target_cursor.bitmap = Cache.system("Battle_Cursor2")
      @target_cursor.ox = @target_cursor.bitmap.width / 2
      @target_cursor.oy = @target_cursor.bitmap.height / 2
      @target_cursor.visible = false
      @target_visible_old = @target_cursor.visible
      @tc_pos = [TARGET_CURSOR_2_POS[0],TARGET_CURSOR_2_POS[1] + @target_cursor.oy]
  end
  
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias mog_target_cursor_dispose dispose
  def dispose
      dispose_target_cursor
      mog_target_cursor_dispose
  end
  
  #--------------------------------------------------------------------------
  # * Dispose Target Cursor
  #--------------------------------------------------------------------------
  def dispose_target_cursor
      return if @target_cursor == nil
      @target_cursor.bitmap.dispose ; @target_cursor.dispose
  end
  
  #--------------------------------------------------------------------------
  # * Update Postion
  #--------------------------------------------------------------------------
  alias mog_target_cursor_update_position update_position
  def update_position
      mog_target_cursor_update_position
      update_target_cursor
  end
  
  #--------------------------------------------------------------------------
  # * Update Target Cursor
  #--------------------------------------------------------------------------
  def update_target_cursor
      return if @target_cursor == nil
      refresh_zoom if @target_visible_old != @target_cursor.visible
      @target_cursor.visible = can_target_cursor_visible?
      return if !@target_cursor.visible
      @target_cursor.x = self.x + @tc_pos[0]
      @target_cursor.y = self.y + @tc_pos[1]
      @target_cursor.z = CURSOR_Z + 1
      @target_cursor.opacity = 130 + rand(125)
      @target_cursor.zoom_x -= 0.05 if @target_cursor.zoom_x > 1.00
      @target_cursor.zoom_x = 1.00 if @target_cursor.zoom_x < 1.00
      @target_cursor.zoom_y = @target_cursor.zoom_x            
  end
  
  #--------------------------------------------------------------------------
  # * Refresh Zoom
  #--------------------------------------------------------------------------
  def refresh_zoom
      @target_visible_old = @target_cursor.visible
      @target_cursor.zoom_x = 1.50 if TARGET_CURSOR_2_ZOOM_EFFECT
      @target_cursor.zoom_y = @target_cursor.zoom_x
  end
  
  #--------------------------------------------------------------------------
  # * Can Target Cursor Visible?
  #--------------------------------------------------------------------------
  def can_target_cursor_visible?
      return false if @battler.dead?
      return false if @battler.hidden
      return false if !@battler.target_temp
      return true
  end
  
end


victor#==============================================================================
# ** Victor Engine - Target Arrow
#------------------------------------------------------------------------------
# Author : Victor Sant
#
# Version History:
#  v 1.00 - 2012.01.15 > First release
#  v 1.01 - 2012.03.08 > Fixed self action help name display
#  v 1.02 - 2012.05.30 > Fixed bug with Loop Animation arrow
#  v 1.03 - 2012.08.02 > Compatibility with Basic Module 1.27
#  v 1.04 - 2012.11.03 > Compatibility with Direct Commands
#                      > Fixed issue with line 408 undefined method
#  v 1.05 - 2012.12.24 > Compatibility with Active Time Battle
#  v 1.06 - 2012.12.30 > Fixed issue with enemy name when cancel selection
#  v 1.07 - 2013.01.07 > Improved arrow movement
#  v 1.08 - 2013.01.24 > Compatibility with Toggle Target
#------------------------------------------------------------------------------
#  This script allows to change target selection to a arrow like selection.
# It's possible to make it animated and set different graphics for enemies
# and actors target selections.
# 如果使用 'Victor Engine - Loop Animation'脚本,那指针还可以用动画来表示
#
#------------------------------------------------------------------------------
# 兼容性
#   需要脚本 'Victor Engine - Basic Module' v 1.27 或者更高的版本
#   并且将本脚本放在 'Victor Engine - Custom Basic Actions' 之下.
#
# * 重写方法
#   class RPG::UsableItem < RPG::BaseItem
#     def need_selection?
#
#   class Window_BattleEnemy < Window_Selectable
#     def show
#     def hide
#     def cursor_movable?
#     def cursor_down(wrap = false)
#     def cursor_up(wrap = false)
#     def cursor_right(wrap = false)
#     def cursor_left(wrap = false)
#     def update_help
#
#   class Window_BattleActor < Window_BattleStatus
#     def cursor_movable?
#     def cursor_down(wrap = false)
#     def cursor_up(wrap = false)
#     def cursor_right(wrap = false)
#     def cursor_left(wrap = false)
#     def update_help
#     def update_cursor
#
# * 重名方法
#   class Window_BattleEnemy < Window_Selectable
#     def initialize(info_viewport)
#     def update
#     def dispose
#
#   class Window_BattleActor < Window_BattleStatus
#     def initialize(info_viewport)
#     def update
#     def show
#     def hide
#     def update_cursor
#     def dispose
#
#   class Scene_Battle < Scene_Base
#     def create_actor_window
#     def create_enemy_window
#     def command_attack
#     def on_skill_ok
#     def on_item_ok
#     def on_enemy_cancel
#     def on_actor_cancel
#
#------------------------------------------------------------------------------
# Instructions:
#  To instal the script, open you script editor and paste this script on
#  a new section bellow the Materials section. This script must also
#  be bellow the scripts 'Victor Engine - Basic'
#
#------------------------------------------------------------------------------
# 技能和物品的备注栏写上:
#   
#  <target description>
#  string
#  </target description>
#   这是设定指向目标时显示的文本描述,“string”是描述的内容
#   使用  \\n  来换行.
#
#------------------------------------------------------------------------------
# 附加介绍:
#
#  指针图片必须放在 Graphics/System.
#
#  如果你想用一个动画来表示指针,你需要脚本
#  'Victor Engine - Loop Animation' v 1.02 或更高版本.
#
#==============================================================================

#==============================================================================
# ** Victor Engine
#------------------------------------------------------------------------------
#   Setting module for the Victor Engine
#==============================================================================

module Victor_Engine
  #--------------------------------------------------------------------------
  # * Set the automatic text control codes
  #   when false, it's needed to add \# on the start of the text to use
  #   control codes
  #--------------------------------------------------------------------------
  VE_ARROW_DEFAULT = {
    name:   "MenuCursor", # 指针图片文件名 ("文件名")
    frames: 1,        #指针的帧数 (1 则为无动画)
    speed:  5,       # 等待时间 (60 帧 = 1 秒)
    height: true,     # 根据目标的高度自动调整指针位置
    help:   true,     # 当选择目标时弹出帮助窗口
    x:      -18,        # 调整x坐标
    y:      3,        # 调整y坐标
    move:   0,        # 移动类型. 0 :全方向移动, 1 : 横向移动
                      # 2 : 纵向移动
    anim:   111,        # 作为指针的动画id. 本操作需要脚本
                      # "Victor Engine - Loop Animation",

                     
  } # 别动这个括号
  #--------------------------------------------------------------------------
  # * 自动定义指针设定
  #    将角色和敌人的指针区别开.
  #--------------------------------------------------------------------------
  VE_ARROW_CUSTOM = {
    actor: {name: "MenuCursor"},  #指向角色的指针图片文件名
    enemy: {name: "MenuCursor"},  #指向敌人的指针图片文件名
  } # Don't remove
  #--------------------------------------------------------------------------
  # * 在选择目标时隐藏技能窗口
  #    因为技能窗口覆盖在战斗画面之上,所以你可以设定在选择目标时隐藏技能窗口Since the window is placed above the battlers, the arrow stay behind
  #    若你的技能窗口已修改为不遮挡战斗画面,你也可以将true改为false
  #--------------------------------------------------------------------------
  VE_HIDE_SKILL_WINDOW = false
  #--------------------------------------------------------------------------
  # * 在选择目标时隐藏物品窗口
  #--------------------------------------------------------------------------
  VE_HIDE_ITEM_WINDOW = false
  #--------------------------------------------------------------------------
  # * 使用帮助窗口 (不能修改)
  #--------------------------------------------------------------------------
  VE_USE_TARGET_HELP = true
  #--------------------------------------------------------------------------
  # * 帮助窗口设定.
  #--------------------------------------------------------------------------
  VE_TARGET_HELP_WINDOW = {
    text_align:    1,    # 文本对齐, 0: 左, 1: 中, 2: 右
    target_info:   true, # 如果是true将显示目标名称和状态,false则显示技能名
    all_enemies:   "全部敌人",   # 选择全体敌人时的文本
    all_actors:    "全部队友",    # 选择全体队友时的文本
    all_target:    "全部目标",   # 选择全体目标时的文本
    random_enemy:  "随机敌人",  # 选择随机敌人时的文本
    random_actor:  "随机队友",   # 选择随机队友时的文本
    random_target: "随机目标", # 选择随机目标时的文本
  } # 别动这个括号
  #--------------------------------------------------------------------------
  # * 需要
  #   这个方法将检查你是否有 basic module 或其他本脚本需要用到的
  #   VE 脚本, 这里不需要编辑
  #--------------------------------------------------------------------------
  def self.required(name, req, version, type = nil)
    if !$imported[:ve_basic_module]
      msg = "The script '%s' requires the script\n"
      msg += "'VE - Basic Module' v%s or higher above it to work properly\n"
      msg += "Go to http://victorenginescripts.wordpress.com/ to download this script."
      msgbox(sprintf(msg, self.script_name(name), version))
      exit
    else
      self.required_script(name, req, version, type)
    end
  end
  #--------------------------------------------------------------------------
  # * script_name
  #   Get the script name base on the imported value, 不需要编辑
  #--------------------------------------------------------------------------
  def self.script_name(name, ext = "VE")
    name = name.to_s.gsub("_", " ").upcase.split
    name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
    name.join(" ")
  end
end

$imported ||= {}
$imported[:ve_target_arrow] = 1.08
Victor_Engine.required(:ve_target_arrow, :ve_basic_module, 1.27, :above)
Victor_Engine.required(:ve_target_arrow, :ve_toggle_target, 1.00, :bellow)

#==============================================================================
# ** RPG::UsableItem
#------------------------------------------------------------------------------
#  This is the superclass for skills and items.
#==============================================================================

class RPG::UsableItem < RPG::BaseItem
  #--------------------------------------------------------------------------
  # * Overwrite method: need_selection?
  #--------------------------------------------------------------------------
  def need_selection?
    @scope > 0
  end
end

#==============================================================================
# ** Window_Selectable
#------------------------------------------------------------------------------
#  This window contains cursor movement and scroll functions.
#==============================================================================

class Window_Selectable < Window_Base
  #--------------------------------------------------------------------------
  # * New method: init_arrow
  #--------------------------------------------------------------------------
  def init_arrow
    @arrows = []
    @arrows_anim = 0
    @arrows_value = VE_ARROW_CUSTOM.dup
    @arrows_value.default = VE_ARROW_DEFAULT.dup
    @arrows_value.each do |key, value|
      arrow = @arrows_value[key]
      arrow[:x]      = VE_ARROW_DEFAULT[:x]      if !value[:x]
      arrow[:y]      = VE_ARROW_DEFAULT[:y]      if !value[:y]
      arrow[:name]   = VE_ARROW_DEFAULT[:name]   if !value[:name]
      arrow[:frames] = VE_ARROW_DEFAULT[:frames] if !value[:frames]
      arrow[:rect]   = VE_ARROW_DEFAULT[:rect]   if !value[:rect]
      arrow[:speed]  = VE_ARROW_DEFAULT[:speed]  if !value[:speed]
      arrow[:anim]   = VE_ARROW_DEFAULT[:anim]   if !value[:anim]
      arrow[:move]   = VE_ARROW_DEFAULT[:move]   if !value[:move]
      arrow[:height] = VE_ARROW_DEFAULT[:height] if !value[:height]
    end
  end
  #--------------------------------------------------------------------------
  # * New method: init_arrow_sprite
  #--------------------------------------------------------------------------
  def init_arrow_sprite(forced = false)
    dispose_arrow if @arrows_index != @index || forced || item_max == 0
    return unless active
    if target_all? && item_max > 0
      item_max.times {|i| create_arrow_sprite(i) }
    elsif @index > -1 && item_max > 0
      create_arrow_sprite(0)
    end
    @arrows_index = @index
    update_arrow_sprite
  end
  #--------------------------------------------------------------------------
  # * New method: set_action
  #--------------------------------------------------------------------------
  def set_action(action)
    @action = action
  end
  #--------------------------------------------------------------------------
  # * New method: target_all?
  #--------------------------------------------------------------------------
  def target_all?
    @action && (@action.for_all? || @action.for_random?)
  end
  #--------------------------------------------------------------------------
  # * New method: target_self?
  #--------------------------------------------------------------------------
  def target_self?
    @action && @action.for_user?
  end
  #--------------------------------------------------------------------------
  # * New method: create_arrow_sprite
  #--------------------------------------------------------------------------
  def create_arrow_sprite(i)
    return if @arrows
    @arrows = Sprite_Base.new
    @arrows.bitmap = Cache.system(arrow_filename)
  end
  #--------------------------------------------------------------------------
  # * New method: arrow_animation
  #--------------------------------------------------------------------------
  def arrow_animation?
    arrow_animation != 0 && $imported[:ve_loop_animation]
  end
  #--------------------------------------------------------------------------
  # * New method: update_arrow_sprite
  #--------------------------------------------------------------------------
  def update_arrow_sprite
    @arrows.each_index do |i|
      next unless @arrows && target(i)
      @arrows.viewport = target(i).sprite.viewport
      arrow_animation? ? set_arrow_animation(i) : set_arrow_bitmap(i)
      update_arrow_position(i)
    end
    update_all_arrows
  end
  #--------------------------------------------------------------------------
  # * New method: set_arrow_bitmap
  #--------------------------------------------------------------------------
  def set_arrow_bitmap(i)
    bitmap = @arrows.bitmap
    arrow_width   = bitmap.width / arrow_frames
    current_frame = arrow_width * @arrows_anim
    @arrows.src_rect.set(current_frame, 0, arrow_width, bitmap.height)
  end
  #--------------------------------------------------------------------------
  # * New method: set_arrow_animation
  #--------------------------------------------------------------------------
  def set_arrow_animation(i)
    target = target(i)
    return if !target || target.sprite.loop_anim?(:arrow)
    settings = {anim: arrow_animation, type: :arrow, loop: 1}
    target.sprite.add_loop_animation(settings)
  end
  #--------------------------------------------------------------------------
  # * New method: update_arrow_position
  #--------------------------------------------------------------------------
  def update_arrow_position(i)
    adjust = arrow_height ? target(i).sprite.oy / 2 : 0
    @arrows.x  = position_x(i) + arrow_x
    @arrows.y  = position_y(i) + arrow_y - adjust
    @arrows.z  = self.z + 1000
    @arrows.ox = @arrows.width  / 2
    @arrows.oy = @arrows.height / 2
  end
  #--------------------------------------------------------------------------
  # * New method: position_x
  #--------------------------------------------------------------------------
  def position_x(i)
    $imported[:ve_animated_battle] ? target(i).current_x : target(i).screen_x
  end
  #--------------------------------------------------------------------------
  # * New method: position_y
  #--------------------------------------------------------------------------
  def position_y(i)
    $imported[:ve_animated_battle] ? target(i).current_y : target(i).screen_y
  end
  #--------------------------------------------------------------------------
  # * New method: update_all_arrows
  #--------------------------------------------------------------------------
  def update_all_arrows
    @arrows.each {|arrow| arrow.update }
  end
  #--------------------------------------------------------------------------
  # * New method: arrow_frames
  #--------------------------------------------------------------------------
  def target_window_type
    instance_of?(Window_BattleEnemy) ? :enemy : :actor
  end
  #--------------------------------------------------------------------------
  # * New method: arrow_filename
  #--------------------------------------------------------------------------
  def arrow_filename
    arrow_animation? ? "" : @arrows_value[target_window_type][:name]
  end
  #--------------------------------------------------------------------------
  # * New method: arrow_frames
  #--------------------------------------------------------------------------
  def arrow_frames
    [@arrows_value[target_window_type][:frames], 1].max
  end
  #--------------------------------------------------------------------------
  # * New method: arrow_old_rect
  #--------------------------------------------------------------------------
  def arrow_old_rect
    @arrows_value[target_window_type][:rect]
  end
  #--------------------------------------------------------------------------
  # * New method: arrow_animspeed
  #--------------------------------------------------------------------------
  def arrow_animspeed
    [@arrows_value[target_window_type][:speed], 1].max
  end
  #--------------------------------------------------------------------------
  # * New method: arrow_x
  #--------------------------------------------------------------------------
  def arrow_x
    @arrows_value[target_window_type][:x]
  end
  #--------------------------------------------------------------------------
  # * New method: arrow_y
  #--------------------------------------------------------------------------
  def arrow_y
    @arrows_value[target_window_type][:y]
  end
  #--------------------------------------------------------------------------
  # * New method: arrow_animation
  #--------------------------------------------------------------------------
  def arrow_animation
    @arrows_value[target_window_type][:anim]
  end
  #--------------------------------------------------------------------------
  # * New method: arrow_height
  #--------------------------------------------------------------------------
  def arrow_height
    @arrows_value[target_window_type][:height]
  end
  #--------------------------------------------------------------------------
  # * New method: arrow_move
  #--------------------------------------------------------------------------
  def arrow_move
    @arrows_value[target_window_type][:move]
  end
  #--------------------------------------------------------------------------
  # * New method: help_info
  #--------------------------------------------------------------------------
  def help_info
    VE_TARGET_HELP_WINDOW
  end
  #--------------------------------------------------------------------------
  # * New method: target_description
  #--------------------------------------------------------------------------
  def target_description
    return "" unless @action
    regexp = get_all_values("TARGET DESCRIPTION")
    text   = ""
    @action.note.scan(regexp) do
      info = $1.dup
      info.gsub!(/\r\n/) { "" }
      info.gsub!(/\\n/)  { "\r\n" }
      text += info
    end
    text
  end
  #--------------------------------------------------------------------------
  # * New method: update_target_help
  #--------------------------------------------------------------------------  
  def update_target_help
    text  = target_description
    align = help_info[:text_align]
    @help_window.visible = true
    if text != ""
      @help_window.set_info_text(text, align)
    else
      if help_info[:target_info]
        draw_tartge_info(align)
      else
        @help_window.set_item_text(@action, align)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * New method: draw_tartge_inf
  #--------------------------------------------------------------------------  
  def draw_tartge_info(align)
#~     if @action.for_one?
#~       @help_window.set_target_text(target(0), align)
#~     elsif @action.for_all? && @action.for_random?
#~       text = help_info[:random_enemies] if @action.for_opponent?
#~       text = help_info[:random_actors]  if @action.for_friend?
#~       text = help_info[:random_target]  if @action.for_all_targets?
#~       @help_window.set_info_text(text, align)
#~     elsif @action.for_all? && !@action.for_random?
#~       text = help_info[:all_enemies] if @action.for_opponent?
#~       text = help_info[:all_actors]  if @action.for_friend?
#~       text = help_info[:all_target]  if @action.for_all_targets?
#~       @help_window.set_info_text(text, align)
#~     end
  end
end

#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
#  This window shows skill and item explanations along with actor status.
#==============================================================================

#~ class Window_Help < Window_Base
#~   #--------------------------------------------------------------------------
#~   # * Alias method: set_item
#~   #--------------------------------------------------------------------------
#~   alias :set_item_ve_arrow_arrow :set_item
#~   def set_item(item)
#~     set_item_ve_arrow_arrow(item)
#~     refresh
#~   end
#~   #--------------------------------------------------------------------------
#~   # * New method: set_target_text
#~   #--------------------------------------------------------------------------
#~   def set_target_text(target, align = 0)
#~     if target && (target != @target || @target.name != @text)
#~       @text   = ""
#~       @target = target
#~       @align  = align
#~       target_info
#~     end
#~   end
#~   #--------------------------------------------------------------------------
#~   # * New method: set_info_text
#~   #--------------------------------------------------------------------------
#~   def set_info_text(text, align = 0)
#~     if text != @text
#~       @text = text
#~       contents.clear
#~       adj = @text[/\r\n/i]
#~       draw_text(0, 0, width, line_height * (adj ? 1 : 2), @text, align)
#~     end
#~   end
#~   #--------------------------------------------------------------------------
#~   # * New method: set_item_text
#~   #--------------------------------------------------------------------------
#~   def set_item_text(item, align = 0)
#~     if item.name != @text
#~       @text = item.name
#~       contents.clear
#~       iw = item.icon_index == 0 ? 0 : 24
#~       text_width = text_size(@text).width
#~       x = align == 0 ? 0 : (contents_width - 24 - text_width) / (3 - align)
#~       draw_icon(item.icon_index, x, line_height / 2, true)
#~       draw_text(iw + 2, 0, contents_width - iw, line_height * 2, @text, align)
#~     end
#~   end
#~   #--------------------------------------------------------------------------
#~   # * New method: target_info
#~   #--------------------------------------------------------------------------
#~   def target_info
#~     contents.clear
#~     change_color(hp_color(@target))
#~     adj = (@target.state_icons + @target.buff_icons).size == 0
#~     height = line_height * (adj ? 2 : 1)
#~     draw_text(0, 0, contents_width, height, @target.name, @align)
#~     draw_target_icons
#~   end
#~   #--------------------------------------------------------------------------
#~   # * New method: draw_target_icons
#~   #--------------------------------------------------------------------------
#~   def draw_target_icons
#~     icons = (@target.state_icons + @target.buff_icons)[0, contents_width / 24]
#~     x = @align == 0 ? 0 : (contents_width - icons.size * 24) / (3 - @align)
#~     icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, line_height) }
#~   end
#~ end

#==============================================================================
# ** Window_BattleEnemy
#------------------------------------------------------------------------------
#  This window display a list of enemies on the battle screen.
#==============================================================================

class Window_BattleEnemy < Window_Selectable
  #--------------------------------------------------------------------------
  # * Overwrite method: show
  #--------------------------------------------------------------------------
  def show
    result = super
    fix_selection(arrow_move == 1 ? :horz : :vert)
    select(0)
    init_arrow_sprite(true)
    self.visible = false
    result
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: hide
  #--------------------------------------------------------------------------
  def hide
    result = super
    dispose_arrow
    result
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: enemy
  #--------------------------------------------------------------------------
  def enemy
    enemy_list[@index]
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: cursor_movable?
  #--------------------------------------------------------------------------
  def cursor_movable?
    super && active && !cursor_all && !target_all? && !target_self?
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: cursor_down
  #--------------------------------------------------------------------------
  def cursor_down(wrap = false)
    fix_selection(:vert) if arrow_move != 1 && @mode == :horz
    select((index - 1 + item_max) % item_max) if arrow_move != 1
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: cursor_up
  #--------------------------------------------------------------------------
  def cursor_up(wrap = false)
    fix_selection(:vert) if arrow_move != 1 && @mode == :horz
    select((index + 1) % item_max) if arrow_move != 1
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: cursor_right
  #--------------------------------------------------------------------------
  def cursor_right(wrap = false)
    fix_selection(:horz) if arrow_move != 2 && @mode == :vert
    select((index + 1) % item_max) if arrow_move != 2
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: cursor_left
  #--------------------------------------------------------------------------
  def cursor_left(wrap = false)
    fix_selection(:horz) if arrow_move != 2 && @mode == :vert
    select((index - 1 + item_max) % item_max) if arrow_move != 2
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: update_help
  #--------------------------------------------------------------------------
  def update_help
    update_target_help
  end
  #--------------------------------------------------------------------------
  # * Alias method: initialize
  #--------------------------------------------------------------------------
  alias :initialize_ve_arrow_arrow :initialize
  def initialize(info_viewport)
    initialize_ve_arrow_arrow(info_viewport)
    init_arrow
  end
  #--------------------------------------------------------------------------
  # * Alias method: update
  #--------------------------------------------------------------------------
  alias :update_ve_arrow_arrow :update
  def update
    update_ve_arrow_arrow
    init_arrow_sprite
    update_arrow_sprite
    return if Graphics.frame_count % arrow_animspeed != 0
    @arrows_anim = (@arrows_anim + 1) % arrow_frames
  end
  #--------------------------------------------------------------------------
  # * Alias method: dispose
  #--------------------------------------------------------------------------
  alias :dispose_ve_arrow_arrow :dispose
  def dispose
    dispose_ve_arrow_arrow
    dispose_arrow
  end
  #--------------------------------------------------------------------------
  # * New method: enemies
  #--------------------------------------------------------------------------
  def enemies
    enemy_list
  end
  #--------------------------------------------------------------------------
  # * New method: enemy_list
  #--------------------------------------------------------------------------
  def enemy_list
    enemies = $game_troop.alive_members.dup
    enemies.sort! {|a, b| b.screen_y <=> a.screen_y } if @mode == :vert
    enemies.sort! {|a, b| a.screen_x <=> b.screen_x } if @mode == :horz
    enemies
  end
  #--------------------------------------------------------------------------
  # * New method: fix_selection
  #--------------------------------------------------------------------------
  def fix_selection(type)
    current = enemy
    @mode   = type
    @index  = enemy_list.index(current)
  end
  #--------------------------------------------------------------------------
  # * New method: target
  #--------------------------------------------------------------------------
  def target(i)
    target_all? ? enemies : enemy
  end
  #--------------------------------------------------------------------------
  # * New method: dispose_arrow
  #--------------------------------------------------------------------------
  def dispose_arrow
    if arrow_animation?
      enemies.each do |enemy|
        enemy.sprite && enemy.sprite.end_loop_anim(:arrow)
      end
    end
    @arrows.each {|arrow| arrow.dispose }
    @arrows.clear
  end
end

#==============================================================================
# ** Window_BattleActor
#------------------------------------------------------------------------------
#  This window display a list of actors on the battle screen.
#==============================================================================

class Window_BattleActor < Window_BattleStatus
  #--------------------------------------------------------------------------
  # * Overwrite method: cursor_movable?
  #--------------------------------------------------------------------------
  def cursor_movable?
    super && active && !cursor_all && !target_all? && !target_self?
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: cursor_down
  #--------------------------------------------------------------------------
  def cursor_down(wrap = false)
    return if show_actor && arrow_move == 1
    fix_selection(:vert) if show_actor && arrow_move != 1 && @mode == :horz
    show_actor ? select((index + 1) % item_max) : super
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: cursor_up
  #--------------------------------------------------------------------------
  def cursor_up(wrap = false)
    return if show_actor && arrow_move == 1
    fix_selection(:vert) if show_actor && arrow_move != 1 && @mode == :horz
    show_actor ? select((index - 1 + item_max) % item_max) : super
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: cursor_right(
  #--------------------------------------------------------------------------
  def cursor_right(wrap = false)
    return if show_actor && arrow_move == 2
    fix_selection(:horz) if show_actor && arrow_move != 2 && @mode == :vert
    show_actor ? select((index + 1) % item_max) : super
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: cursor_left
  #--------------------------------------------------------------------------
  def cursor_left(wrap = false)
    return if show_actor && arrow_move == 2
    fix_selection(:horz) if show_actor && arrow_move != 2 && @mode == :vert
    show_actor ? select((index - 1 + item_max) % item_max) :  super
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: update_help
  #--------------------------------------------------------------------------
  def update_help
    update_target_help
  end
  #--------------------------------------------------------------------------
  # * Overwrite method: update_cursor
  #--------------------------------------------------------------------------
  def update_cursor
    @cursor_all = cursor_all
    super
  end
  #--------------------------------------------------------------------------
  # * Alias method: initialize
  #--------------------------------------------------------------------------
  alias :initialize_ve_arrow_arrow :initialize
  def initialize(info_viewport)
    initialize_ve_arrow_arrow(info_viewport)
    init_arrow if show_actor
  end
  #--------------------------------------------------------------------------
  # * Alias method: update
  #--------------------------------------------------------------------------
  alias :update_ve_arrow_arrow :update
  def update
    update_ve_arrow_arrow
    return unless show_actor
    init_arrow_sprite
    update_arrow_sprite
    return if Graphics.frame_count % arrow_animspeed != 0
    @arrows_anim = (@arrows_anim + 1) % arrow_frames
  end
  #--------------------------------------------------------------------------
  # * Alias method: show
  #--------------------------------------------------------------------------
  alias :show_ve_arrow_arrow :show
  def show
    if show_actor
      result = super
      self.visible = false
      select(0)
      result
    else
      show_ve_arrow_arrow
    end
  end
  #--------------------------------------------------------------------------
  # * Alias method: hide
  #--------------------------------------------------------------------------
  alias :hide_ve_arrow_arrow :hide
  def hide
    result = hide_ve_arrow_arrow
    dispose_arrow if show_actor
    result
  end
  #--------------------------------------------------------------------------
  # * Alias method: dispose
  #--------------------------------------------------------------------------
  alias :update_cursor_ve_arrow_arrow :update_cursor
  def update_cursor
    show_actor ? cursor_rect.empty : update_cursor_ve_arrow_arrow
  end
  #--------------------------------------------------------------------------
  # * Alias method: dispose
  #--------------------------------------------------------------------------
  alias :dispose_ve_arrow_arrow :dispose
  def dispose
    dispose_ve_arrow_arrow
    dispose_arrow if show_actor
  end
  #--------------------------------------------------------------------------
  # * New method: cursor_all
  #--------------------------------------------------------------------------
  def cursor_all
    @action && @action.for_all?
  end
  #--------------------------------------------------------------------------
  # * New method: actor
  #--------------------------------------------------------------------------
  def actor
    actor_list[@index]
  end
  #--------------------------------------------------------------------------
  # * New method: actors
  #--------------------------------------------------------------------------
  def actors
    actor_list
  end
  #--------------------------------------------------------------------------
  # * New method: enemy_list
  #--------------------------------------------------------------------------
  def actor_list
    actors = $game_party.battle_members.dup
    actors.sort! {|a, b| b.screen_y <=> a.screen_y } if @mode == :vert
    actors.sort! {|a, b| a.screen_x <=> b.screen_x } if @mode == :horz
    actors
  end
  #--------------------------------------------------------------------------
  # * New method: fix_selection
  #--------------------------------------------------------------------------
  def fix_selection(type)
    current = actor
    @mode   = type
    @index  = actor_list.index(current)
  end
  #--------------------------------------------------------------------------
  # * New method: target
  #--------------------------------------------------------------------------
  def target(i)
    @index = BattleManager.actor.index if @action.for_user?
    target_all? ? actors : actor
  end
  #--------------------------------------------------------------------------
  # * New method: show_actor
  #--------------------------------------------------------------------------
  def show_actor
    $imported[:ve_actor_battlers]
  end
  #--------------------------------------------------------------------------
  # * New method: dispose_arrow
  #--------------------------------------------------------------------------
  def dispose_arrow
    if arrow_animation?
      actors.each {|actor| actor.sprite.end_loop_anim(:arrow) if actor.sprite }
    end
    @arrows.each {|arrow| arrow.dispose }
    @arrows.clear
  end
end

#~ #==============================================================================
#~ # ** Scene_Battle
#~ #------------------------------------------------------------------------------
#~ #  This class performs battle screen processing.
#~ #==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias method: create_actor_window
  #--------------------------------------------------------------------------
  alias :create_actor_window_ve_arrow_arrow :create_actor_window
  def create_actor_window
    create_actor_window_ve_arrow_arrow
    @actor_window.help_window = @help_window if VE_USE_TARGET_HELP
  end
  #--------------------------------------------------------------------------
  # * Alias method: create_enemy_window
  #--------------------------------------------------------------------------
  alias :create_enemy_window_ve_arrow_arrow :create_enemy_window
  def create_enemy_window
    create_enemy_window_ve_arrow_arrow
    @enemy_window.help_window = @help_window if VE_USE_TARGET_HELP
  end
  #--------------------------------------------------------------------------
  # * Alias method: command_attack
  #--------------------------------------------------------------------------
  alias :command_attack_ve_arrow_arrow :command_attack
  def command_attack
    set_window_action($data_skills[BattleManager.actor.attack_skill_id])
    command_attack_ve_arrow_arrow
  end
  #--------------------------------------------------------------------------
  # * Alias method: on_skill_ok
  #--------------------------------------------------------------------------
  alias :on_skill_ok_ve_arrow_arrow :on_skill_ok
  def on_skill_ok
    set_window_action(@skill_window.item)
    on_skill_ok_ve_arrow_arrow
    @skill_window.visible = false if VE_HIDE_SKILL_WINDOW
  end
  #--------------------------------------------------------------------------
  # * Alias method: on_item_ok
  #--------------------------------------------------------------------------
  alias :on_item_ok_ve_arrow_arrow :on_item_ok
  def on_item_ok
    set_window_action(@item_window.item)
    on_item_ok_ve_arrow_arrow
    @item_window.visible = false if VE_HIDE_ITEM_WINDOW
  end
  #--------------------------------------------------------------------------
  # * Alias method: on_enemy_cancel
  #--------------------------------------------------------------------------
  alias :on_enemy_cancel_ve_arrow_arrow :on_enemy_cancel
  def on_enemy_cancel
    on_enemy_cancel_ve_arrow_arrow
    case @actor_command_window.current_symbol
    when :skill then @skill_window.visible = true
    when :item  then @item_window.visible  = true
    when :attack, :direct_skill, :direct_item
      @help_window.visible = false
    end
  end
  #--------------------------------------------------------------------------
  # * Alias method: on_actor_cancel
  #--------------------------------------------------------------------------
  alias :on_actor_cancel_ve_arrow_arrow :on_actor_cancel
  def on_actor_cancel
    on_actor_cancel_ve_arrow_arrow
    case @actor_command_window.current_symbol
    when :skill then @skill_window.visible = true
    when :item  then @item_window.visible  = true
    when :attack, :direct_skill, :direct_item
      @help_window.visible = false
    end
  end
  #--------------------------------------------------------------------------
  # * New method: set_window_action
  #--------------------------------------------------------------------------
  def set_window_action(item)
    @enemy_window.set_action(item) if item.for_opponent?
    @enemy_window.update_help      if item.for_opponent?
    @actor_window.set_action(item) if item.for_friend?
    @actor_window.update_help      if item.for_friend?
  end
end
VA外站脚本汉化群:226308173   |    部分远古文件备份:https://wwzv.lanzoue.com/b02rac5pc  密码:acgm
回复

使用道具 举报

梦石
0
星屑
1143
在线时间
186 小时
注册时间
2017-8-2
回帖
1
 楼主| 发表于 2019-10-25 18:06:18 | 显示全部楼层
本帖最后由 fish12358 于 2019-10-25 18:08 编辑
流浪杰哥 发表于 2019-10-25 09:16
把这放到Sideview下面试试看吧,不行的话那就没办法
$imported = {} if $imported.nil?
$imported[:mog_bat ...


昨天自己摸索了以后发现,只要把 On Skill OK跟 On Item OK这两段删了以后,对自己施放技能时就不会出错,只是这样会有别的问题吗?
我完全没用到他们的ATB脚本

你改的这个的确能选择sideview的队员,不过有些跑位了,因为我有调整过默认的位子,想请问要在怎么在你改的这脚本调整呢?

现在好像只剩这问题了!
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部