查看: 1272|回复: 3

[已经解决] 战斗中 选择目标用的指针 的脚本问题

[复制链接]
梦石
0
星屑
541
在线时间
172 小时
注册时间
2013-9-24
回帖
28
发表于 2015-8-11 11:02:15 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×

不懂脚本去用MOG是不是作死……
轻微的用了一下立绘战斗脚本,基本上测试起来没有问题。

……结果出现了一个小问题

战斗时,有一个选择目标的、、
使用技能后,无论是打别人还是奶自己都要做的选目标、、

这是一个把选目标做成了一个指针的脚本,(键盘操纵的指针,不需要用鼠标)
如果是单个目标来选的话,毫无问题。。

不过,如果要是遇到不需要选目标的情况【使用者,全体己方,全体敌人】
就会直接卡住游戏。。接下来的指令什么都做不成了。。

如果技能设成【使用者,全体己方】,游戏直接卡住。
如果技能设成【全体敌人】,会冒出一个指针选一个后再对全体有效。

这个小问题直接对游戏有着大硬伤。。。
直接卡住不能继续游戏什么的。。。
没有全体奶的技能的游戏也不现实、、、

如果有可以代替此功能(战斗中选定目标的指针)的脚本也行、、、
脚本废求助一下、、、

在此谢谢了。。。



[pre lang="ruby"]#==============================================================================
# +++ MOG - Battle Cursor (3.3) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Sistema de cursor animado de batalha nos sprites dos battlers.
#==============================================================================
# Arquivo necessário. (Graphics/System)
#
# Battle_Cursor.png
# Battle_Cursor2.png *(necessário o script Scope EX)
#
#==============================================================================
# NOTA - Deixe este script abaixo do script Battler Motion.
#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# (3.3) - Correção do bug de não atualizar a index quando o battler é morto.
# (3.2) - Melhoria de compatibilidade com Scope EX
# (3.1) - Melhoria na posição dos battler aliados mortos. (MOG Sprite Actor)
# (3.0) - Correção do cursor não acompanhar a posição do battler em movimento.
#       - Apresentar o cursor na seleção de todos os alvos.
#==============================================================================
$imported = {} if $imported.nil?
$imported[:mog_battle_cursor] = true

#==============================================================================
# ■ CURSOR SETTING
#==============================================================================
module MOG_BATTLE_CURSOR
  #Definição da posição do cursor em relação ao alvo.
  CURSOR_POSITION = [0, 0]
  #Definição da posição do nome do alvo.
  CURSOR_NAME_POSITION = [-10, 35]
  #Ativar efeito deslizar.
  CURSOR_SLIDE_EFFECT = true
  #Ativar animação de levitação.
  CURSOR_FLOAT_EFFECT = true
  #Definição da prioridade do cursor.
  CURSOR_Z = 155
  #Posição do cursor Secundário.
  TARGET_CURSOR_2_POS = [0, -48]
  #Ativar animação de zoom.
  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].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 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
      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
      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]
梦石
0
星屑
1736
在线时间
761 小时
注册时间
2013-9-23
回帖
180

开拓者

发表于 2015-8-11 13:17:15 | 显示全部楼层
建议你使用默认战斗系统试试,如果不行再说。

以下仅代表个人观点,算是不负责任的脚本用后感,并且再次声明绝无恶意,而且我也一直在用。
MOG系列的脚本经过作者不断更新后的功能越来越全面,但同时也带来了越来越多的兼容性问题。
单单MOG系列战斗相关的脚本之间的不兼容就不只一个,当然这些并不会带来你所说的那样的恶性后果。
所以,更别提对系列之外脚本的兼容性了。

点评

谢谢提醒,那不用这个脚本了  发表于 2015-8-12 00:31
回复

使用道具 举报

梦石
0
星屑
50
在线时间
395 小时
注册时间
2012-1-12
回帖
155
发表于 2015-8-11 16:16:10 | 显示全部楼层
MOG的指针脚本 一直都有这个用技能就会卡住的BUG  

兼容问题一直没有得到解决   最新版本的也是一样
回复

使用道具 举报

梦石
0
星屑
1736
在线时间
761 小时
注册时间
2013-9-23
回帖
180

开拓者

发表于 2015-8-12 07:55:06 | 显示全部楼层
MOG兼容问题主要是更新后功能多了导致的,
给你个兼容性相对好到不知道要甩现在版本多少条街的早期MOG指针,先试试,还不行就还再说(─.─|||
  1. #==============================================================================
  2. # +++ MOG - Battle Cursor (2.2) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com/
  6. #==============================================================================
  7. # Sistema de cursor animado de batalha nos sprites dos battlers.
  8. #==============================================================================
  9. # Arquivo necessário. (Graphics/System)
  10. #
  11. # Battle_Cursor.png
  12. # Battle_Cursor2.png *(necessário o script Scope EX)
  13. #
  14. #==============================================================================
  15. # NOTA - Deixe este script abaixo do script Battler Motion.
  16. #==============================================================================
  17. # ● Histórico (Version History)
  18. #==============================================================================
  19. # (2.2) Melhoria no sistema de posição da origem Z.
  20. #==============================================================================

  21. #==============================================================================
  22. # ■ CURSOR SETTING
  23. #==============================================================================
  24. module MOG_BATTLE_CURSOR
  25.   #Definição da posição do cursor em relação ao alvo.
  26.   CURSOR_POSITION = [-45, -16]
  27.   #Definição da posição do nome do alvo.
  28.   CURSOR_NAME_POSITION = [-10, 35]
  29.   #Ativar efeito deslizar.
  30.   CURSOR_SLIDE_EFFECT = true
  31.   #Ativar animação de levitação.
  32.   CURSOR_FLOAT_EFFECT = true
  33.   #Definição da prioridade do cursor.
  34.   CURSOR_Z = 105
  35.   #Posição do cursor Secundário.
  36.   TARGET_CURSOR_2_POS = [0, -48]
  37.   #Ativar animação de zoom.
  38.   TARGET_CURSOR_2_ZOOM_EFFECT = true
  39. end

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

  42. #==============================================================================
  43. # ■ Game Temp
  44. #==============================================================================
  45. class Game_Temp
  46.   
  47.   attr_accessor :battle_cursor
  48.   attr_accessor :battle_cursor_data
  49.   attr_accessor :target_skill
  50.   
  51.   #--------------------------------------------------------------------------
  52.   # ● Initialize
  53.   #--------------------------------------------------------------------------  
  54.   alias mog_battle_cursor_initialize initialize
  55.   def initialize
  56.       @battle_cursor = [0,0,false,""] ; @target_skill = []
  57.       mog_battle_cursor_initialize
  58.   end  
  59.   
  60.   #--------------------------------------------------------------------------
  61.   # ● Clear Target Temp
  62.   #--------------------------------------------------------------------------   
  63.   def clear_target_temp
  64.       $game_party.members.each {|t| t.target_temp = false } rescue nil
  65.       $game_troop.members.each {|t| t.target_temp = false } rescue nil      
  66.   end
  67.    
  68. end

  69. #==============================================================================
  70. # ■ Spriteset Battle Cursor
  71. #==============================================================================
  72. class Sprite_Battle_Cursor < Sprite
  73.   include MOG_BATTLE_CURSOR
  74.   
  75.   #--------------------------------------------------------------------------
  76.   # ● Initialize
  77.   #--------------------------------------------------------------------------        
  78.   def initialize(viewport = nil)
  79.       super(viewport)
  80.       $game_temp.battle_cursor = [0,0,false,""]
  81.       self.bitmap = Cache.system("Battle_Cursor")
  82.       self.visible = $game_temp.battle_cursor[2] ; self.z = CURSOR_Z
  83.       @cursor_name = Sprite.new ; @cursor_name.bitmap = Bitmap.new(120,32)
  84.       @cursor_name.z = self.z + 1 ; @cursor_name.bitmap.font.size = 16
  85.       @cursor_name_enemy = $game_temp.battle_cursor[3]
  86.       @cursor_name_position = [CURSOR_NAME_POSITION[0] ,CURSOR_NAME_POSITION[1]]
  87.       @cursor_float = [0,0] ;  refresh_cursor_name
  88.   end
  89.   
  90.   #--------------------------------------------------------------------------
  91.   # ● Dispose Sprite
  92.   #--------------------------------------------------------------------------         
  93.   def dispose
  94.       super
  95.       dispose_sprite_cursor
  96.   end
  97.   
  98.   #--------------------------------------------------------------------------
  99.   # ● Dispose Sprite Cursor
  100.   #--------------------------------------------------------------------------            
  101.   def dispose_sprite_cursor
  102.       @cursor_name.bitmap.dispose ; @cursor_name.dispose
  103.       self.bitmap.dispose ; $game_temp.clear_target_temp
  104.   end

  105.   #--------------------------------------------------------------------------
  106.   # ● Refresh Cursor Name
  107.   #--------------------------------------------------------------------------              
  108.   def refresh_cursor_name
  109.       @cursor_name_enemy = $game_temp.battle_cursor[3]
  110.       @cursor_name.bitmap.clear
  111.       @cursor_name.bitmap.draw_text(0,0,120,32,@cursor_name_enemy.to_s,1)
  112.   end

  113.   #--------------------------------------------------------------------------
  114.   # ● Update
  115.   #--------------------------------------------------------------------------            
  116.   def update
  117.       super
  118.       update_sprite_cursor
  119.   end

  120.   #--------------------------------------------------------------------------
  121.   # ● Update Sprite Cursor
  122.   #--------------------------------------------------------------------------              
  123.   def update_sprite_cursor
  124.       update_visible ; update_cursor_float_effect
  125.       execute_move(0,self.x,$game_temp.battle_cursor[0])
  126.       execute_move(1,self.y,$game_temp.battle_cursor[1] + @cursor_float[1])
  127.       update_sprite_name
  128.   end

  129.   #--------------------------------------------------------------------------
  130.   # ● Update Visible
  131.   #--------------------------------------------------------------------------               
  132.   def update_visible
  133.       self.visible = $game_temp.battle_cursor[2]
  134.       (self.x = -64 ; self.y = -64) if !self.visible
  135.   end  
  136.   
  137.   #--------------------------------------------------------------------------
  138.   # ● Update Sprite Name
  139.   #--------------------------------------------------------------------------               
  140.   def update_sprite_name
  141.       return if @cursor_name == nil
  142.       refresh_cursor_name  if @cursor_name_enemy != $game_temp.battle_cursor[3]
  143.       @cursor_name.x = self.x + @cursor_name_position[0]
  144.       @cursor_name.y = self.y + @cursor_name_position[1]
  145.       @cursor_name.opacity = self.opacity ; @cursor_name.visible = self.visible
  146.   end  
  147.   
  148.   #--------------------------------------------------------------------------
  149.   # ● Update Cursor Float Effect
  150.   #--------------------------------------------------------------------------              
  151.   def update_cursor_float_effect
  152.       return if !CURSOR_FLOAT_EFFECT
  153.       @cursor_float[0] += 1
  154.       case @cursor_float[0]
  155.         when 0..20  ; @cursor_float[1] += 1
  156.         when 21..40 ; @cursor_float[1] -= 1
  157.         else
  158.           @cursor_float[0] = 0 ;   @cursor_float[1] = 0
  159.       end        
  160.   end  
  161.   
  162.   #--------------------------------------------------------------------------
  163.   # ● Execute Move
  164.   #--------------------------------------------------------------------------      
  165.   def execute_move(type,cp,np)
  166.       sp = 5 + ((cp - np).abs / 5)
  167.       if cp > np
  168.          cp -= sp ; cp = np if cp < np
  169.       elsif cp < np
  170.          cp += sp ; cp = np if cp > np
  171.       end     
  172.       self.x = cp if type == 0 ; self.y = cp if type == 1
  173.   end      
  174.   
  175. end

  176. #==============================================================================
  177. # ■ Spriteset Battle
  178. #==============================================================================
  179. class Spriteset_Battle
  180.   
  181.   #--------------------------------------------------------------------------
  182.   # ● Initialize
  183.   #--------------------------------------------------------------------------      
  184.   alias mog_battle_cursor_initialize initialize
  185.   def initialize
  186.       mog_battle_cursor_initialize
  187.       create_cursor
  188.   end
  189.   
  190.   #--------------------------------------------------------------------------
  191.   # ● Dispose
  192.   #--------------------------------------------------------------------------      
  193.   alias mog_battle_cursor_dispose dispose
  194.   def dispose
  195.       mog_battle_cursor_dispose
  196.       dispose_cursor
  197.   end
  198.   
  199.   #--------------------------------------------------------------------------
  200.   # ● Update
  201.   #--------------------------------------------------------------------------         
  202.   alias mog_battle_cursor_update update
  203.   def update
  204.       mog_battle_cursor_update
  205.       update_battle_cursor
  206.   end  
  207.   
  208.   #--------------------------------------------------------------------------
  209.   # ● Create_Cursor
  210.   #--------------------------------------------------------------------------        
  211.   def create_cursor
  212.       return if @battle_cursor != nil
  213.       $game_temp.clear_target_temp ; @battle_cursor = Sprite_Battle_Cursor.new      
  214.   end
  215.   
  216.   #--------------------------------------------------------------------------
  217.   # ● Dispose Cursor
  218.   #--------------------------------------------------------------------------        
  219.   def dispose_cursor
  220.       return if @battle_cursor == nil
  221.       @battle_cursor.dispose
  222.   end  
  223.   
  224.   #--------------------------------------------------------------------------
  225.   # ● Update Battle Cursor
  226.   #--------------------------------------------------------------------------         
  227.   def update_battle_cursor
  228.       return if @battle_cursor == nil
  229.       @battle_cursor.update      
  230.   end
  231.   
  232. end

  233. #==============================================================================
  234. # ■ Battle Cursor Index
  235. #==============================================================================
  236. module Battle_Cursor_index
  237.   
  238.   include MOG_BATTLE_CURSOR
  239.   
  240.   #--------------------------------------------------------------------------
  241.   # ● Check Index Limit
  242.   #--------------------------------------------------------------------------      
  243.   def check_index_limit
  244.       self.index = 0 if self.index >= item_max
  245.       self.index = (item_max - 1) if self.index < 0
  246.   end      
  247.   
  248.   #--------------------------------------------------------------------------
  249.   # ● Set Cursor Position Enemy
  250.   #--------------------------------------------------------------------------   
  251.   def set_cursor_position_enemy
  252.       return if !self.active
  253.       @fcursor = nil
  254.       $game_temp.battle_cursor[0] = $game_troop.alive_members[self.index].screen_x + CURSOR_POSITION[0] rescue nil
  255.       $game_temp.battle_cursor[1] = $game_troop.alive_members[self.index].screen_y + CURSOR_POSITION[1] rescue nil
  256.       $game_temp.battle_cursor[3] = $game_troop.alive_members[self.index].name rescue nil
  257.       $game_temp.battle_cursor_data = $game_troop.alive_members[self.index]
  258.       $game_temp.battle_cursor = [0,0,false,0] if $game_temp.battle_cursor[0] == nil
  259.       enable_target_sprites($game_temp.battle_cursor_data.index)
  260.   end
  261.   
  262.   #--------------------------------------------------------------------------
  263.   # ● Enable Target Sprites
  264.   #--------------------------------------------------------------------------   
  265.   def enable_target_sprites(target_index)  
  266.       return if $game_temp.target_skill.empty?
  267.       $game_temp.clear_target_temp ; battler = $game_temp.target_skill[1]
  268.       type = $game_temp.target_skill[0].is_a?(RPG::Skill) ? 0 : 1
  269.       target_index = $game_temp.battle_cursor_data.index
  270.       battler.make_action_temp($game_temp.target_skill[0].id, target_index,type)      
  271.       targets = battler.action_temp.make_targets.compact
  272.       targets.each {|t| t.target_temp = true }
  273.   end  
  274.    
  275.   #--------------------------------------------------------------------------
  276.   # ● Set Cursor Position Actor
  277.   #--------------------------------------------------------------------------   
  278.   def set_cursor_position_actor
  279.       return if !self.active      
  280.       @fcursor = nil
  281.       $game_temp.battle_cursor[0] = $game_party.members[self.index].screen_x + CURSOR_POSITION[0] rescue nil
  282.       $game_temp.battle_cursor[1] = $game_party.members[self.index].screen_y + CURSOR_POSITION[1] rescue nil
  283.       $game_temp.battle_cursor[3] = $game_party.members[self.index].name rescue nil
  284.       $game_temp.battle_cursor_data = $game_party.members[self.index]
  285.       $game_temp.battle_cursor = [0,0,false,0] if $game_temp.battle_cursor[0] == nil
  286.       enable_target_sprites(self.index)
  287.   end  
  288.   
  289.   #--------------------------------------------------------------------------
  290.   # ● Process Cursor Move
  291.   #--------------------------------------------------------------------------
  292.   def process_cursor_move
  293.       $game_temp.battle_cursor_data = nil
  294.       return unless cursor_movable?
  295.       last_index = @index
  296.       cursor_move_index(1) if Input.repeat?(:DOWN)
  297.       cursor_move_index(-1) if Input.repeat?(:UP)
  298.       cursor_move_index(1) if Input.repeat?(:RIGHT)
  299.       cursor_move_index(-1) if Input.repeat?(:LEFT)
  300.       $game_temp.battle_cursor_data = $game_troop.alive_members[@index]
  301.       Sound.play_cursor if @index != last_index
  302.   end
  303.       
  304.   #--------------------------------------------------------------------------
  305.   # ● Process Cursor Move Index
  306.   #--------------------------------------------------------------------------  
  307.   def cursor_move_index(value = 0)
  308.       self.index += value ;  check_index_limit
  309.   end

  310. end

  311. #==============================================================================
  312. # ■ Window_BattleActor
  313. #==============================================================================
  314. class Window_BattleActor < Window_BattleStatus
  315.   include Battle_Cursor_index
  316.   
  317.   #--------------------------------------------------------------------------
  318.   # ● Update
  319.   #--------------------------------------------------------------------------  
  320.   alias mog_battle_cursor_actor_update update
  321.   def update
  322.       pre_index = self.index
  323.       mog_battle_cursor_actor_update
  324.       set_cursor_position_actor if pre_index != self.index or @fcursor
  325.   end  

  326.   #--------------------------------------------------------------------------
  327.   # ● Show
  328.   #--------------------------------------------------------------------------
  329.   alias mog_battle_cursor_show show
  330.   def show
  331.       if @info_viewport
  332.          set_cursor_position_actor ; $game_temp.battle_cursor[2] = true
  333.          @fcursor = true
  334.       end
  335.       mog_battle_cursor_show
  336.   end

  337.   #--------------------------------------------------------------------------
  338.   # ● Hide
  339.   #--------------------------------------------------------------------------
  340.   alias mog_battle_cursor_hide hide
  341.   def hide
  342.       $game_temp.battle_cursor[2] = false if @info_viewport
  343.       $game_temp.clear_target_temp ; $game_temp.target_skill.clear
  344.       mog_battle_cursor_hide
  345.   end  
  346.   
  347. end

  348. #==============================================================================
  349. # ■ Game Enemy
  350. #==============================================================================
  351. class Game_Enemy < Game_Battler
  352.   attr_accessor :index
  353. end

  354. #==============================================================================
  355. # ■ Game Troop
  356. #==============================================================================
  357. class Game_Troop < Game_Unit
  358.    
  359.   #--------------------------------------------------------------------------
  360.   # * Setup
  361.   #--------------------------------------------------------------------------
  362.   alias mog_battle_cursor_setup setup
  363.   def setup(troop_id)
  364.       mog_battle_cursor_setup(troop_id)
  365.       if can_sort_index?
  366.          @enemies.sort! {|a,b| a.screen_x <=> b.screen_x}
  367.          @enemies.each_with_index {|e, i| e.index = i }
  368.       end
  369.   end
  370.   
  371.   #--------------------------------------------------------------------------
  372.   # * Can Sort Index?
  373.   #--------------------------------------------------------------------------
  374.   def can_sort_index?
  375.       return false if @enemies.size < 3
  376.       return false if troop.pages.size > 1
  377.       return false if !troop.pages[0].list[0].parameters.empty? rescue false
  378.       return true
  379.   end
  380.   
  381. end

  382. #==============================================================================
  383. # ■ Window_BattleEnemy
  384. #==============================================================================
  385. class Window_BattleEnemy < Window_Selectable
  386.   include Battle_Cursor_index
  387.   
  388.   #--------------------------------------------------------------------------
  389.   # ● Update
  390.   #--------------------------------------------------------------------------  
  391.   alias mog_battle_cursor_enemy_update update
  392.   def update
  393.       pre_index = self.index
  394.       mog_battle_cursor_enemy_update
  395.       set_cursor_position_enemy if pre_index != self.index or @fcursor
  396.   end
  397.   
  398.   #--------------------------------------------------------------------------
  399.   # ● Show
  400.   #--------------------------------------------------------------------------
  401.   alias mog_battle_cursor_show show
  402.   def show
  403.       if @info_viewport
  404.          set_cursor_position_enemy ; $game_temp.battle_cursor[2] = true
  405.          @fcursor = true
  406.       end
  407.       mog_battle_cursor_show
  408.   end
  409.   
  410.   #--------------------------------------------------------------------------
  411.   # ● Hide
  412.   #--------------------------------------------------------------------------
  413.   alias mog_battle_cursor_hide hide
  414.   def hide
  415.       $game_temp.battle_cursor[2] = false if @info_viewport
  416.       $game_temp.clear_target_temp ; $game_temp.target_skill.clear
  417.       mog_battle_cursor_hide
  418.   end  
  419.   
  420. end

  421. #==============================================================================
  422. # ■ Window Selectable
  423. #==============================================================================
  424. class Window_Selectable < Window_Base  

  425.   #--------------------------------------------------------------------------
  426.   # * Process OK
  427.   #-------------------------------------------------------------------------
  428.   alias mog_target_cursor_process_ok process_ok
  429.   def process_ok
  430.       mog_target_cursor_process_ok
  431.       execute_target_selection if can_execute_target_selection?
  432.   end
  433.   
  434.   #--------------------------------------------------------------------------
  435.   # * Can Execute Target Selection
  436.   #-------------------------------------------------------------------------
  437.   def can_execute_target_selection?
  438.       return false if !SceneManager.scene_is?(Scene_Battle)
  439.       return false if !current_item_enabled?
  440.       return true if self.is_a?(Window_BattleSkill)
  441.       return true if self.is_a?(Window_BattleItem)
  442.       return true if self.is_a?(Window_ActorCommand) and self.index == 0
  443.       return false
  444.   end

  445.   #--------------------------------------------------------------------------
  446.   # * Execute Target Selection
  447.   #-------------------------------------------------------------------------
  448.   def execute_target_selection
  449.       return if BattleManager.actor == nil
  450.       $game_temp.target_skill.clear
  451.       item = @data[index] rescue nil
  452.       item = $data_skills[BattleManager.actor.attack_skill_id] rescue nil if self.is_a?(Window_ActorCommand)
  453.       return if item == nil
  454.       if [2,8,10].include?(item.scope) or item.note =~ /<Scope Range = (\d+) - (\d+) - (\d+) - (\d+)>/   
  455.          $game_temp.target_skill = [item,BattleManager.actor]
  456.       end   
  457.   end  
  458.   
  459. end

  460. #==============================================================================
  461. # ■ Game Battler
  462. #==============================================================================
  463. class Game_Battler < Game_BattlerBase
  464.   
  465.   attr_accessor :target_temp
  466.   attr_accessor :action_temp
  467.   
  468.   #--------------------------------------------------------------------------
  469.   # * Initialize
  470.   #--------------------------------------------------------------------------
  471.   alias mog_target_cursor_initialize initialize
  472.   def initialize
  473.       @target_cursor_temp = false
  474.       mog_target_cursor_initialize
  475.   end
  476.   
  477.   #--------------------------------------------------------------------------
  478.   # ● Make Action Temp
  479.   #--------------------------------------------------------------------------
  480.   def make_action_temp(action_id,target_index,type)
  481.       return if action_id == nil
  482.       action = Game_Action.new(self, true)
  483.       action.set_skill(action_id) if type == 0
  484.       action.set_item(action_id) if type == 1
  485.       action.target_index = target_index
  486.       @action_temp = action
  487.   end     
  488.   
  489. end

  490. #==============================================================================
  491. # ■ Game BattlerBase
  492. #==============================================================================
  493. class Game_BattlerBase
  494.    attr_accessor :hidden
  495. end

  496. #==============================================================================
  497. # ■ Scene Battler
  498. #==============================================================================
  499. class Scene_Battle < Scene_Base

  500.   #--------------------------------------------------------------------------
  501.   # * On Skill OK
  502.   #--------------------------------------------------------------------------
  503.   def on_skill_ok
  504.       @skill = @skill_window.item
  505.       BattleManager.actor.input.set_skill(@skill.id)
  506.       BattleManager.actor.last_skill.object = @skill
  507.       if [0,11].include?(@skill.scope)
  508.          @skill_window.hide ; next_command
  509.       elsif @skill.for_opponent?
  510.          select_enemy_selection
  511.       else
  512.          select_actor_selection
  513.       end
  514.   end
  515.   
  516.   #--------------------------------------------------------------------------
  517.   # * On Item OK
  518.   #--------------------------------------------------------------------------
  519.   def on_item_ok
  520.       @item = @item_window.item
  521.       BattleManager.actor.input.set_item(@item.id)
  522.       if [0,11].include?(@item.scope)
  523.          @item_window.hide ; next_command
  524.       elsif @item.for_opponent?
  525.          select_enemy_selection
  526.       else
  527.          select_actor_selection
  528.       end
  529.       $game_party.last_item.object = @item
  530.   end
  531.   
  532. end

  533. #==============================================================================
  534. # ■ Sprite Battler
  535. #==============================================================================
  536. class Sprite_Battler < Sprite_Base
  537.   include MOG_BATTLE_CURSOR
  538.   #--------------------------------------------------------------------------
  539.   # * Initialize
  540.   #--------------------------------------------------------------------------
  541.   alias mog_target_cursor_initialize initialize
  542.   def initialize(viewport, battler = nil)
  543.       mog_target_cursor_initialize(viewport, battler)
  544.       create_target_cursor
  545.   end
  546.   
  547.   #--------------------------------------------------------------------------
  548.   # * Create Target Cursor
  549.   #--------------------------------------------------------------------------
  550.   def create_target_cursor
  551.       @target_cursor = Sprite.new
  552.       @target_cursor.bitmap = Cache.system("Battle_Cursor2")
  553.       @target_cursor.ox = @target_cursor.bitmap.width / 2
  554.       @target_cursor.oy = @target_cursor.bitmap.height / 2
  555.       @target_cursor.visible = false
  556.       @target_visible_old = @target_cursor.visible
  557.       @tc_pos = [TARGET_CURSOR_2_POS[0],TARGET_CURSOR_2_POS[1] + @target_cursor.oy]
  558.   end
  559.   
  560.   #--------------------------------------------------------------------------
  561.   # * Dispose
  562.   #--------------------------------------------------------------------------
  563.   alias mog_target_cursor_dispose dispose
  564.   def dispose
  565.       dispose_target_cursor
  566.       mog_target_cursor_dispose
  567.   end
  568.   
  569.   #--------------------------------------------------------------------------
  570.   # * Dispose Target Cursor
  571.   #--------------------------------------------------------------------------
  572.   def dispose_target_cursor
  573.       return if @target_cursor == nil
  574.       @target_cursor.bitmap.dispose ; @target_cursor.dispose
  575.   end
  576.   
  577.   #--------------------------------------------------------------------------
  578.   # * Update Postion
  579.   #--------------------------------------------------------------------------
  580.   alias mog_target_cursor_update_position update_position
  581.   def update_position
  582.       mog_target_cursor_update_position
  583.       update_target_cursor
  584.   end
  585.   
  586.   #--------------------------------------------------------------------------
  587.   # * Update Target Cursor
  588.   #--------------------------------------------------------------------------
  589.   def update_target_cursor
  590.       return if @target_cursor == nil
  591.       refresh_zoom if @target_visible_old != @target_cursor.visible
  592.       @target_cursor.visible = can_target_cursor_visible?
  593.       return if !@target_cursor.visible
  594.       @target_cursor.x = self.x + @tc_pos[0]
  595.       @target_cursor.y = self.y + @tc_pos[1]
  596.       @target_cursor.z = CURSOR_Z + 1
  597.       @target_cursor.opacity = 130 + rand(125)
  598.       @target_cursor.zoom_x -= 0.05 if @target_cursor.zoom_x > 1.00
  599.       @target_cursor.zoom_x = 1.00 if @target_cursor.zoom_x < 1.00
  600.       @target_cursor.zoom_y = @target_cursor.zoom_x            
  601.   end
  602.   
  603.   #--------------------------------------------------------------------------
  604.   # * Refresh Zoom
  605.   #--------------------------------------------------------------------------
  606.   def refresh_zoom
  607.       @target_visible_old = @target_cursor.visible
  608.       @target_cursor.zoom_x = 1.50 if TARGET_CURSOR_2_ZOOM_EFFECT
  609.       @target_cursor.zoom_y = @target_cursor.zoom_x
  610.   end
  611.   
  612.   #--------------------------------------------------------------------------
  613.   # * Can Target Cursor Visible?
  614.   #--------------------------------------------------------------------------
  615.   def can_target_cursor_visible?
  616.       return false if @battler.dead?
  617.       return false if @battler.hidden
  618.       return false if !@battler.target_temp
  619.       return true
  620.   end
  621.   
  622. end
复制代码

点评

没问题了!谢谢!  发表于 2015-8-15 01:07
35行的优先级改成1000+试试  发表于 2015-8-15 00:50
谢谢,用起来运行没bug。选敌没问题,就是选择队友时,指针会藏在队友后面看不见  发表于 2015-8-15 00:47
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部