查看: 2598|回复: 7

[已经解决] 我需要一个可以使用光标选择敌人的脚本

[复制链接]
梦石
0
星屑
50
在线时间
25 小时
注册时间
2012-10-9
回帖
19
发表于 2015-12-27 18:40:58 | 显示全部楼层 |阅读模式
悬赏9星屑已解决
目前使用的是SideView横版,其他也没插什么另外的脚本了,想要的效果是,光标指向敌人来选择攻击目标,而不是原来的在下方状态栏选择。
这个问题问完后还有大堆问题需要回答。。
ps:脚本最好有中文能让我看懂,纯新人一点点脚本都不懂。。只会用。。

最佳答案

查看完整内容

[pre lang="ruby"]$脸图战斗 = true $imported = {} if $imported.nil? module YEA module BATTLE SKIP_PARTY_COMMAND = true BATTLESTATUS_NAME_FONT_SIZE = 20 BATTLESTATUS_TEXT_FONT_SIZE = 16 BATTLESTATUS_NO_ACTION_ICON = 185 BATTLESTATUS_HPGAUGE_Y_PLUS = 11 BATTLESTATUS_CENTER_FACES = false HELP_TEXT_ALL_FOES = "全体敌人" HELP_TEXT_ONE_RANDOM_FOE = "单个敌人" ...
我问你,你就是我的马石打吗
梦石
0
星屑
6963
在线时间
1557 小时
注册时间
2011-6-14
回帖
425
发表于 2015-12-27 18:40:59 | 显示全部楼层
[pre lang="ruby"]$脸图战斗 = true
$imported = {} if $imported.nil?
module YEA
  module BATTLE
    SKIP_PARTY_COMMAND = true
    BATTLESTATUS_NAME_FONT_SIZE = 20
    BATTLESTATUS_TEXT_FONT_SIZE = 16
    BATTLESTATUS_NO_ACTION_ICON = 185
    BATTLESTATUS_HPGAUGE_Y_PLUS = 11
    BATTLESTATUS_CENTER_FACES   = false
    HELP_TEXT_ALL_FOES        = "全体敌人"
    HELP_TEXT_ONE_RANDOM_FOE  = "单个敌人"
    HELP_TEXT_MANY_RANDOM_FOE = "%d个随机敌人"
    HELP_TEXT_ALL_ALLIES      = "全体队友"
    HELP_TEXT_ALL_DEAD_ALLIES = "全体死亡队友"
    HELP_TEXT_ONE_RANDOM_ALLY = "单个随机队友"
    HELP_TEXT_RANDOM_ALLIES   = "%d个随机队友"
  end
end
class Game_Battler
  def can_collapse?
    return false unless dead?
    unless actor?
      return false unless sprite.battler_visible
      array = [:collapse, :boss_collapse, :instant_collapse]
      return false if array.include?(sprite.effect_type)
    end
    return true
  end
  def draw_mp?
    return true
  end
  def draw_tp?
    return $data_system.opt_display_tp
  end
end
module Icon
  def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
end
class Game_Temp
  attr_accessor :battle_aid
  attr_accessor :evaluating
end
class Game_Action
  alias evaluate_item_with_target_abe evaluate_item_with_target
  def evaluate_item_with_target(target)
    $game_temp.evaluating = true
    result = evaluate_item_with_target_abe(target)
    $game_temp.evaluating = false
    return result
  end
end
class Game_Actor < Game_Battler
  def draw_mp?
    return true unless draw_tp?
    for skill in skills
      next unless added_skill_types.include?(skill.stype_id)
      return true if skill.mp_cost > 0
    end
    return false
  end
  def draw_tp?
    return false unless $data_system.opt_display_tp
    for skill in skills
      next unless added_skill_types.include?(skill.stype_id)
      return true if skill.tp_cost > 0
    end
    return false
  end
end
class Window_BattleStatus < Window_Selectable
  def initialize
    super(0, 0, window_width, window_height)
    self.openness = 0
    @party = $game_party.battle_members.clone
  end
  def col_max; return $game_party.max_battle_members; end
  def battle_members; return $game_party.battle_members; end
  def actor; return battle_members[@index]; end
  def update
    super
    return if @party == $game_party.battle_members
    @party = $game_party.battle_members.clone
    refresh
  end
  def draw_item(index)
    return if index.nil?
    clear_item(index)
    actor = battle_members[index]
    rect = item_rect(index)
    return if actor.nil?
    draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
    draw_actor_name(actor, rect.x, rect.y, rect.width-8)
    draw_actor_action(actor, rect.x, rect.y)
    draw_actor_icons(actor, rect.x, line_height*1, rect.width)
    gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
    contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
    draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
    if draw_tp?(actor) && draw_mp?(actor)
      dw = rect.width/2-2
      dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
      draw_actor_tp(actor, rect.x+2, line_height*3, dw)
      dw = rect.width - rect.width/2 - 2
      draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
    elsif draw_tp?(actor) && !draw_mp?(actor)
      draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
    else
      draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
    end
  end
  def item_rect(index)
    rect = Rect.new
    rect.width = contents.width / $game_party.max_battle_members
    rect.height = contents.height
    rect.x = index * rect.width
    if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
      rect.x += (contents.width - $game_party.members.size * rect.width) / 2
    end
    rect.y = 0
    return rect
  end
  def draw_face(face_name, face_index, dx, dy, enabled = true)
    bitmap = Cache.face(face_name)
    fx = [(96 - item_rect(0).width + 1) / 2, 0].max
    fy = face_index / 4 * 96 + 2
    fw = [item_rect(0).width - 4, 92].min
    rect = Rect.new(fx, fy, fw, 92)
    rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
    contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
    bitmap.dispose
  end
  def draw_actor_name(actor, dx, dy, dw = 112)
    reset_font_settings
    contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
    change_color(hp_color(actor))
    draw_text(dx+24, dy, dw-24, line_height, actor.name)
  end
  def draw_actor_action(actor, dx, dy)
    draw_icon(action_icon(actor), dx, dy)
  end
  def action_icon(actor)
    return Icon.no_action if actor.current_action.nil?
    return Icon.no_action if actor.current_action.item.nil?
    return actor.current_action.item.icon_index
  end
  def draw_tp?(actor)
    return actor.draw_tp?
  end
  def draw_mp?(actor)
    return actor.draw_mp?
  end
  def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
    change_color(color1)
    draw_text(dx, dy, dw, line_height, current.to_s, 2)
  end
  def draw_actor_hp(actor, dx, dy, width = 124)
    draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
    change_color(system_color)
    cy = (Font.default_size - contents.font.size) / 2 + 1
    draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
    draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
      hp_color(actor), normal_color)
    end
  def draw_actor_mp(actor, dx, dy, width = 124)
    draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
    change_color(system_color)
    cy = (Font.default_size - contents.font.size) / 2 + 1
    draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
    draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
      mp_color(actor), normal_color)
    end
  def draw_actor_tp(actor, dx, dy, width = 124)
    draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
    change_color(system_color)
    cy = (Font.default_size - contents.font.size) / 2 + 1
    draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
    change_color(tp_color(actor))
    draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
  end
end
class Window_BattleActor < Window_BattleStatus
  def show
    create_flags
    super
  end
  def create_flags
    set_select_flag(:any)
    select(0)
    return if $game_temp.battle_aid.nil?
    if $game_temp.battle_aid.need_selection?
      select(0)
      set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
    elsif $game_temp.battle_aid.for_user?
      battler = BattleManager.actor
      id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
      select(id)
      set_select_flag(:user)
    elsif $game_temp.battle_aid.for_all?
      select(0)
      set_select_flag(:all)
      set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
    elsif $game_temp.battle_aid.for_random?
      select(0)
      set_select_flag(:random) if $game_temp.battle_aid.for_random?
    end
  end
  def set_select_flag(flag)
    @select_flag = flag
    case @select_flag
    when :all, :all_dead, :random
      @cursor_all = true
    else
      @cursor_all = false
    end
  end
  def update_cursor
    if @cursor_all
      cursor_rect.set(0, 0, contents.width, contents.height)
      self.top_row = 0
    elsif @index < 0
      cursor_rect.empty
    else
      ensure_cursor_visible
      cursor_rect.set(item_rect(@index))
    end
  end
  def cursor_movable?
    return false if @select_flag == :user
    return super
  end
  def current_item_enabled?
    return true if $game_temp.battle_aid.nil?
    if $game_temp.battle_aid.need_selection?
      member = $game_party.battle_members[@index]
      return member.dead? if $game_temp.battle_aid.for_dead_friend?
    elsif $game_temp.battle_aid.for_dead_friend?
      for member in $game_party.battle_members
        return true if member.dead?
      end
      return false
    end
    return true
  end
end
class Window_BattleStatusAid < Window_BattleStatus
  attr_accessor :status_window
  def initialize
    super
    self.visible = false
    self.openness = 255
  end
  def window_width; return 128; end
  def show
    super
    refresh
  end
  def refresh
    contents.clear
    return if @status_window.nil?
    draw_item(@status_window.index)
  end
  def item_rect(index)
    return Rect.new(0, 0, contents.width, contents.height)
  end
end
class Window_BattleEnemy < Window_Selectable
  def initialize(info_viewport)
    super(0, Graphics.height, window_width, fitting_height(1))
    refresh
    self.visible = false
    @info_viewport = info_viewport
  end
  def col_max; return item_max; end
  def show
    create_flags
    super
  end
  def create_flags
    set_select_flag(:any)
    select(0)
    return if $game_temp.battle_aid.nil?
    if $game_temp.battle_aid.need_selection?
      select(0)
    elsif $game_temp.battle_aid.for_all?
      select(0)
      set_select_flag(:all)
    elsif $game_temp.battle_aid.for_random?
      select(0)
      set_select_flag(:random)
    end
  end
  def set_select_flag(flag)
    @select_flag = flag
    case @select_flag
    when :all, :random
      @cursor_all = true
    else
      @cursor_all = false
    end
  end
  def select_all?
    return true if @select_flag == :all
    return true if @select_flag == :random
    return false
  end
  def update_cursor
    if @cursor_all
      cursor_rect.set(0, 0, contents.width, contents.height)
      self.top_row = 0
    elsif @index < 0
      cursor_rect.empty
    else
      ensure_cursor_visible
      cursor_rect.set(item_rect(@index))
    end
  end
  def cursor_movable?
    return false if @select_flag == :user
    return super
  end
  def current_item_enabled?
    return true if $game_temp.battle_aid.nil?
    if $game_temp.battle_aid.need_selection?
      member = $game_party.battle_members[@index]
      return member.dead? if $game_temp.battle_aid.for_dead_friend?
    elsif $game_temp.battle_aid.for_dead_friend?
      for member in $game_party.battle_members
        return true if member.dead?
      end
      return false
    end
    return true
  end
  def enemy; @data[index]; end
  def refresh
    make_item_list
    create_contents
    draw_all_items
  end
  def make_item_list
    @data = $game_troop.alive_members
    @data.sort! { |a,b| a.screen_x <=> b.screen_x }
  end
  def draw_item(index); return; end
  def update
    super
    return unless active
    enemy.sprite_effect_type = :whiten
    return unless select_all?
    for enemy in $game_troop.alive_members
      enemy.sprite_effect_type = :whiten
    end
  end
end
class Window_BattleHelp < Window_Help
  attr_accessor :actor_window
  attr_accessor :enemy_window
  def update
    super
    if !self.visible and @text != ""
      @text = ""
      return refresh
    end
    update_battler_name
  end
  def update_battler_name
    return unless @actor_window.active || @enemy_window.active
    if @actor_window.active
      battler = $game_party.battle_members[@actor_window.index]
    elsif @enemy_window.active
      battler = @enemy_window.enemy
    end
    if special_display?
      refresh_special_case(battler)
    else
      refresh_battler_name(battler) if battler_name(battler) != @text
    end
  end
  def battler_name(battler)
    text = battler.name.clone
    return text
  end
  def refresh_battler_name(battler)
    contents.clear
    reset_font_settings
    change_color(normal_color)
    @text = battler_name(battler)
    icons = battler.state_icons + battler.buff_icons
    dy = icons.size <= 0 ? line_height / 2 : 0
    draw_text(0, dy, contents.width, line_height, @text, 1)
    dx = (contents.width - (icons.size * 24)) / 2
    draw_actor_icons(battler, dx, line_height, contents.width)
  end
  def special_display?
    return false if $game_temp.battle_aid.nil?
    return false if $game_temp.battle_aid.for_user?
    return !$game_temp.battle_aid.need_selection?
  end
  def refresh_special_case(battler)
    if $game_temp.battle_aid.for_opponent?
      if $game_temp.battle_aid.for_all?
        text = YEA::BATTLE::HELP_TEXT_ALL_FOES
      else
        case $game_temp.battle_aid.number_of_targets
        when 1
          text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
        else
          number = $game_temp.battle_aid.number_of_targets
          text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
        end
      end
    else
      if $game_temp.battle_aid.for_dead_friend?
        text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
      elsif $game_temp.battle_aid.for_random?
        case $game_temp.battle_aid.number_of_targets
        when 1
          text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
        else
          number = $game_temp.battle_aid.number_of_targets
          text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
        end
      else
        text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
      end
    end
    return if text == @text
    @text = text
    contents.clear
    reset_font_settings
    draw_text(0, 0, contents.width, line_height*2, @text, 1)
  end
end
class Window_SkillList < Window_Selectable
  def spacing
    return 8 if $game_party.in_battle
    return super
  end
end
class Window_ItemList < Window_Selectable
  def spacing
    return 8 if $game_party.in_battle
    return super
  end
end
class Scene_Battle < Scene_Base
  attr_accessor :enemy_window
  attr_accessor :info_viewport
  attr_accessor :spriteset
  attr_accessor :status_window
  attr_accessor :status_aid_window
  attr_accessor :subject
  alias scene_battle_create_all_windows_abe create_all_windows
  def create_all_windows
    scene_battle_create_all_windows_abe
    create_battle_status_aid_window
    set_help_window
  end
  alias scene_battle_create_info_viewport_abe create_info_viewport
  def create_info_viewport
    scene_battle_create_info_viewport_abe
    @status_window.refresh
  end
  def create_battle_status_aid_window
    @status_aid_window = Window_BattleStatusAid.new
    @status_aid_window.status_window = @status_window
    @status_aid_window.x = Graphics.width - @status_aid_window.width
    @status_aid_window.y = Graphics.height - @status_aid_window.height
  end
  def create_help_window
    @help_window = Window_BattleHelp.new
    @help_window.hide
  end
  def set_help_window
    @help_window.actor_window = @actor_window
    @help_window.enemy_window = @enemy_window
  end
  alias scene_battle_create_skill_window_abe create_skill_window
  def create_skill_window
    scene_battle_create_skill_window_abe
    @skill_window.height = @info_viewport.rect.height
    @skill_window.width = Graphics.width - @actor_command_window.width
    @skill_window.y = Graphics.height - @skill_window.height
  end
  alias scene_battle_create_item_window_abe create_item_window
  def create_item_window
    scene_battle_create_item_window_abe
    @item_window.height = @skill_window.height
    @item_window.width = @skill_window.width
    @item_window.y = Graphics.height - @item_window.height
  end
  alias scene_battle_next_command_abe next_command
  def next_command
    @status_window.show
    redraw_current_status
    @actor_command_window.show
    @status_aid_window.hide
    scene_battle_next_command_abe
  end
  alias scene_battle_prior_command_abe prior_command
  def prior_command
    redraw_current_status
    scene_battle_prior_command_abe
  end
  def redraw_current_status
    return if @status_window.index < 0
    @status_window.draw_item(@status_window.index)
  end
  alias scene_battle_command_attack_abe command_attack
  def command_attack
    $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
    scene_battle_command_attack_abe
  end
  alias scene_battle_command_skill_abe command_skill
  def command_skill
    scene_battle_command_skill_abe
    @status_window.hide
    @actor_command_window.hide
    @status_aid_window.show
  end
  alias scene_battle_command_item_abe command_item
  def command_item
    scene_battle_command_item_abe
    @status_window.hide
    @actor_command_window.hide
    @status_aid_window.show
  end
  def on_skill_ok
    @skill = @skill_window.item
    $game_temp.battle_aid = @skill
    BattleManager.actor.input.set_skill(@skill.id)
    BattleManager.actor.last_skill.object = @skill
    if @skill.for_opponent?
      select_enemy_selection
    elsif @skill.for_friend?
      select_actor_selection
    else
      @skill_window.hide
      next_command
      $game_temp.battle_aid = nil
    end
  end
  alias scene_battle_on_skill_cancel_abe on_skill_cancel
  def on_skill_cancel
    scene_battle_on_skill_cancel_abe
    @status_window.show
    @actor_command_window.show
    @status_aid_window.hide
  end
  def on_item_ok
    @item = @item_window.item
    $game_temp.battle_aid = @item
    BattleManager.actor.input.set_item(@item.id)
    if @item.for_opponent?
      select_enemy_selection
    elsif @item.for_friend?
      select_actor_selection
    else
      @item_window.hide
      next_command
      $game_temp.battle_aid = nil
    end
    $game_party.last_item.object = @item
  end
  alias scene_battle_on_item_cancel_abe on_item_cancel
  def on_item_cancel
    scene_battle_on_item_cancel_abe
    @status_window.show
    @actor_command_window.show
    @status_aid_window.hide
  end
  alias scene_battle_select_actor_selection_abe select_actor_selection
  def select_actor_selection
    @status_aid_window.refresh
    scene_battle_select_actor_selection_abe
    @status_window.hide
    @skill_window.hide
    @item_window.hide
    @help_window.show
  end
  alias scene_battle_on_actor_ok_abe on_actor_ok
  def on_actor_ok
    $game_temp.battle_aid = nil
    scene_battle_on_actor_ok_abe
    @status_window.show
    if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
      @actor_command_window.visible = !@confirm_command_window.visible
    else
      @actor_command_window.show
    end
    @status_aid_window.hide
  end
  alias scene_battle_on_actor_cancel_abe on_actor_cancel
  def on_actor_cancel
    BattleManager.actor.input.clear
    @status_aid_window.refresh
    $game_temp.battle_aid = nil
    scene_battle_on_actor_cancel_abe
    case @actor_command_window.current_symbol
    when :skill
      @skill_window.show
    when :item
      @item_window.show
    end
  end
  alias scene_battle_select_enemy_selection_abe select_enemy_selection
  def select_enemy_selection
    @status_aid_window.refresh
    scene_battle_select_enemy_selection_abe
    @help_window.show
  end
  alias scene_battle_on_enemy_ok_abe on_enemy_ok
  def on_enemy_ok
    $game_temp.battle_aid = nil
    scene_battle_on_enemy_ok_abe
  end
  alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
  def on_enemy_cancel
    BattleManager.actor.input.clear
    @status_aid_window.refresh
    $game_temp.battle_aid = nil
    scene_battle_on_enemy_cancel_abe
    if @skill_window.visible || @item_window.visible
      @help_window.show
    else
      @help_window.hide
    end
  end
  def end_battle_conditions?
    return true if $game_party.members.empty?
    return true if $game_party.all_dead?
    return true if $game_troop.all_dead?
    return true if BattleManager.aborting?
    return false
  end
  def refresh_status
    #如果你是程序员,请顺手帮忙优化下这里,谢谢。
    @status_window.refresh
    for i in $game_party.battle_members
      @status_window.draw_item($game_party.battle_members.index(i))
    end
  end
end
[/pre]

点评

不知道..........我也是偶然发现的  发表于 2015-12-28 14:14
求教一下这脚本里用来标记敌人的是哪一段?看着效果不错啊,也想用用  发表于 2015-12-28 13:01
可以用。  发表于 2015-12-27 21:56
回复

使用道具 举报

梦石
0
星屑
2019
在线时间
940 小时
注册时间
2015-10-26
回帖
293

开拓者

发表于 2015-12-27 19:24:09 | 显示全部楼层
无标题.png

  1. #==============================================================================
  2. # +++ MOG - Battle Cursor (1.0) +++
  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. #
  13. #==============================================================================

  14. #==============================================================================
  15. # ■ CURSOR SETTING
  16. #==============================================================================
  17. module MOG_BATTLE_CURSOR
  18.   #Definição da posição do cursor em relação ao alvo.
  19.   CURSOR_POSITION = [-45, 15]#[-45, -16]
  20.   #Definição da posição do nome do alvo.
  21.   CURSOR_NAME_POSITION = [-10, 35]
  22.   #Ativar efeito deslizar.
  23.   CURSOR_SLIDE_EFFECT = true
  24.   #Ativar animação de levitação.
  25.   CURSOR_FLOAT_EFFECT = true
  26.   #Definição da prioridade do cursor.
  27.   CURSOR_Z = 0
  28. end

  29. #==============================================================================
  30. # ■ Game Temp
  31. #==============================================================================
  32. class Game_Temp
  33.   
  34.   attr_accessor :battle_cursor
  35.   
  36.   #--------------------------------------------------------------------------
  37.   # ● Initialize
  38.   #--------------------------------------------------------------------------  
  39.   alias mog_battle_cursor_initialize initialize
  40.   def initialize
  41.       @battle_cursor = [0,0,false,""]
  42.       mog_battle_cursor_initialize
  43.   end  
  44.   
  45. end

  46. #==============================================================================
  47. # ■ Spriteset Battle Cursor
  48. #==============================================================================
  49. class Sprite_Battle_Cursor < Sprite
  50.   include MOG_BATTLE_CURSOR
  51.   
  52.   #--------------------------------------------------------------------------
  53.   # ● Initialize
  54.   #--------------------------------------------------------------------------        
  55.   def initialize(viewport = nil)
  56.       super(viewport)
  57.       $game_temp.battle_cursor = [0,0,false,""]
  58.       self.bitmap = Cache.system("Battle_Cursor")
  59.       self.visible = $game_temp.battle_cursor[2]
  60.       self.z = CURSOR_Z
  61.       self.z = 10 if $mog_rgss3_battle_hud != nil
  62.       @cursor_name = Sprite.new
  63.       @cursor_name.bitmap = Bitmap.new(120,32)
  64.       @cursor_name.z = self.z + 1
  65.       @cursor_name.bitmap.font.size = 16
  66.       @cursor_name_enemy = $game_temp.battle_cursor[3]
  67.       @cursor_name_position = [CURSOR_NAME_POSITION[0] ,CURSOR_NAME_POSITION[1]]
  68.       @cursor_float = [0,0]
  69.       refresh_cursor_name
  70.   end
  71.   
  72.   #--------------------------------------------------------------------------
  73.   # ● Dispose Sprite
  74.   #--------------------------------------------------------------------------         
  75.   def dispose
  76.       super
  77.       dispose_sprite_cursor
  78.   end
  79.   
  80.   #--------------------------------------------------------------------------
  81.   # ● Dispose Sprite Cursor
  82.   #--------------------------------------------------------------------------            
  83.   def dispose_sprite_cursor
  84.       if @cursor_name != nil
  85.          @cursor_name.bitmap.dispose
  86.          @cursor_name.dispose
  87.       end
  88.       self.bitmap.dispose
  89.   end

  90.   #--------------------------------------------------------------------------
  91.   # ● Refresh Cursor Name
  92.   #--------------------------------------------------------------------------              
  93.   def refresh_cursor_name
  94.       @cursor_name_enemy = $game_temp.battle_cursor[3]
  95.       @cursor_name.bitmap.clear
  96.       @cursor_name.bitmap.draw_text(0,0,120,32,@cursor_name_enemy.to_s,1)
  97.   end

  98.   #--------------------------------------------------------------------------
  99.   # ● Update
  100.   #--------------------------------------------------------------------------            
  101.   def update
  102.       super
  103.       update_sprite_cursor
  104.   end

  105.   #--------------------------------------------------------------------------
  106.   # ● Update Sprite Cursor
  107.   #--------------------------------------------------------------------------              
  108.   def update_sprite_cursor
  109.       update_visible
  110.       update_cursor_float_effect
  111.       execute_move(0,self.x,$game_temp.battle_cursor[0])
  112.       execute_move(1,self.y,$game_temp.battle_cursor[1] + @cursor_float[1])
  113.       update_sprite_name
  114.   end

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

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

  229. #==============================================================================
  230. # ■ Battle Cursor Index
  231. #==============================================================================
  232. module Battle_Cursor_index
  233.   include MOG_BATTLE_CURSOR
  234.   #--------------------------------------------------------------------------
  235.   # ● Check Index Limit
  236.   #--------------------------------------------------------------------------      
  237.   def check_index_limit
  238.       self.index = 0 if self.index >= item_max
  239.       self.index = (item_max - 1) if self.index < 0
  240.   end      
  241.   
  242.   #--------------------------------------------------------------------------
  243.   # ● Set Cursor Position Enemy
  244.   #--------------------------------------------------------------------------   
  245.   def set_cursor_position_enemy
  246.       return if !self.active
  247.       $game_temp.battle_cursor[0] = $game_troop.alive_members[self.index].screen_x + CURSOR_POSITION[0] rescue nil
  248.       $game_temp.battle_cursor[1] = $game_troop.alive_members[self.index].screen_y + CURSOR_POSITION[1] rescue nil
  249.       $game_temp.battle_cursor[3] = $game_troop.alive_members[self.index].name rescue nil
  250.       $game_temp.battle_cursor = [0,0,false,0] if $game_temp.battle_cursor[0] == nil
  251.   end
  252.   
  253.   #--------------------------------------------------------------------------
  254.   # ● Set Cursor Position Actor
  255.   #--------------------------------------------------------------------------   
  256.   def set_cursor_position_actor
  257.       return if !self.active
  258.       $game_temp.battle_cursor[0] = $game_party.members[self.index].screen_x + CURSOR_POSITION[0] rescue nil
  259.       $game_temp.battle_cursor[1] = $game_party.members[self.index].screen_y + CURSOR_POSITION[1] rescue nil
  260.       $game_temp.battle_cursor[3] = $game_party.members[self.index].name rescue nil
  261.       $game_temp.battle_cursor = [0,0,false,0] if $game_temp.battle_cursor[0] == nil
  262.   end  
  263.   
  264.   #--------------------------------------------------------------------------
  265.   # ● Process Cursor Move
  266.   #--------------------------------------------------------------------------
  267.   def process_cursor_move
  268.       return unless cursor_movable?
  269.       last_index = @index
  270.       cursor_move_index(+1) if Input.repeat?(:DOWN)
  271.       cursor_move_index(-1) if Input.repeat?(:UP)
  272.       cursor_move_index(+1) if Input.repeat?(:RIGHT)
  273.       cursor_move_index(-1) if Input.repeat?(:LEFT)
  274.       if @index != last_index
  275.          Sound.play_cursor
  276.       end
  277.   end

  278.   #--------------------------------------------------------------------------
  279.   # ● Process Cursor Move Index
  280.   #--------------------------------------------------------------------------  
  281.   def cursor_move_index(value = 0)
  282.       self.index += value
  283.       check_index_limit
  284.   end

  285. end

  286. #==============================================================================
  287. # ■ Window_BattleActor
  288. #==============================================================================
  289. class Window_BattleActor < Window_BattleStatus
  290.   include Battle_Cursor_index
  291.   
  292.   #--------------------------------------------------------------------------
  293.   # ● Update
  294.   #--------------------------------------------------------------------------  
  295.   def update
  296.       super
  297.       set_cursor_position_actor
  298.   end  

  299.   #--------------------------------------------------------------------------
  300.   # ● Show
  301.   #--------------------------------------------------------------------------
  302.   alias mog_battle_cursor_show show
  303.   def show
  304.       if @info_viewport
  305.          set_cursor_position_actor
  306.          $game_temp.battle_cursor[2] = true
  307.       end
  308.       mog_battle_cursor_show
  309.   end

  310.   #--------------------------------------------------------------------------
  311.   # ● Hide
  312.   #--------------------------------------------------------------------------
  313.   alias mog_battle_cursor_hide hide
  314.   def hide
  315.       if @info_viewport
  316.           $game_temp.battle_cursor[2] = false
  317.       end
  318.       mog_battle_cursor_hide
  319.   end  
  320.   
  321. end

  322. #==============================================================================
  323. # ■ Window_BattleEnemy
  324. #==============================================================================
  325. class Window_BattleEnemy < Window_Selectable
  326.   include Battle_Cursor_index
  327.   
  328.   #--------------------------------------------------------------------------
  329.   # ● Update
  330.   #--------------------------------------------------------------------------  
  331.   def update
  332.       super
  333.       set_cursor_position_enemy
  334.   end

  335.   #--------------------------------------------------------------------------
  336.   # ● Show
  337.   #--------------------------------------------------------------------------
  338.   alias mog_battle_cursor_show show
  339.   def show
  340.       if @info_viewport
  341.          set_cursor_position_enemy
  342.          $game_temp.battle_cursor[2] = true
  343.       end
  344.       mog_battle_cursor_show
  345.   end

  346.   #--------------------------------------------------------------------------
  347.   # ● Hide
  348.   #--------------------------------------------------------------------------
  349.   alias mog_battle_cursor_hide hide
  350.   def hide
  351.       if @info_viewport
  352.           $game_temp.battle_cursor[2] = false
  353.       end
  354.       mog_battle_cursor_hide
  355.   end  
  356.   
  357. end

  358. $mog_rgss3_battle_cursor = true
复制代码

点评

缺少文件 Battle_Cursor  发表于 2015-12-27 19:41
回复

使用道具 举报

梦石
0
星屑
50
在线时间
25 小时
注册时间
2012-10-9
回帖
19
 楼主| 发表于 2015-12-27 19:48:51 | 显示全部楼层
本帖最后由 Diamaid 于 2015-12-27 19:50 编辑

就是这样的选择怪物,不是在下方状态栏选择,当然下面的 QQ截图20151227194154.png 这种状态栏和血条都很棒。。。之后再开悬赏问,总之现在就是想要这种光标选择怪物的脚本
我问你,你就是我的马石打吗
回复

使用道具 举报

梦石
0
星屑
2019
在线时间
940 小时
注册时间
2015-10-26
回帖
293

开拓者

发表于 2015-12-27 19:54:15 | 显示全部楼层
Battle_Cursor.png

放在\Graphics\System 里面,命名为Battle_Cursor.png
不喜欢这个图片的话换一个也行
回复

使用道具 举报

梦石
0
星屑
6963
在线时间
1557 小时
注册时间
2011-6-14
回帖
425
发表于 2015-12-27 20:10:10 | 显示全部楼层
我知道有另一种的选敌脚本 不知道楼主需不需要 ~6QPNN)[5%OMVEQ`59M%2NN.jpg

点评

那发来我试试看能不能用  发表于 2015-12-27 21:45
我这个是另一种选敌方式,选中敌人时被敌人身上就会闪烁,然后最上方会出现敌人的信息,你看那个淡白色的敌人就是被选中的  发表于 2015-12-27 21:37
并没有  发表于 2015-12-27 21:33
233 难道你没用过rmxp  发表于 2015-12-27 21:24
不不不。。我甚至连你的光标都看不到。。  发表于 2015-12-27 21:14
回复

使用道具 举报

梦石
0
星屑
50
在线时间
25 小时
注册时间
2012-10-9
回帖
19
 楼主| 发表于 2015-12-27 20:59:25 | 显示全部楼层
踢腿水上飘 发表于 2015-12-27 19:54
放在\Graphics\System 里面,命名为Battle_Cursor.png
不喜欢这个图片的话换一个也行 ...


可以使用也没有报错,但是光标跟根本没有指向怪物。。我知道设置距离就可以了,问题是纯萌新完全看不懂脚本。。 QQ截图20151227205511.png
我问你,你就是我的马石打吗
回复

使用道具 举报

梦石
0
星屑
2019
在线时间
940 小时
注册时间
2015-10-26
回帖
293

开拓者

发表于 2015-12-27 21:26:02 | 显示全部楼层
Diamaid 发表于 2015-12-27 20:59
可以使用也没有报错,但是光标跟根本没有指向怪物。。我知道设置距离就可以了,问题是纯萌新完全看不懂脚 ...

好像是
  1.   def update_visible
  2.       self.visible = $game_temp.battle_cursor[2]
  3.       if !self.visible
  4.          self.x = -64
  5.          self.y = -64
  6.       end  
  7.   end  
复制代码
这一段,反正就是调 X Y后面的数字

点评

并没有任何改变。  发表于 2015-12-27 21:32
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部