查看: 2367|回复: 5

[已经过期] RTAB-cp战斗脚本背景描绘

[复制链接]
梦石
0
星屑
138
在线时间
304 小时
注册时间
2014-4-11
回帖
319
发表于 2014-8-10 15:08:09 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 VIPArcher 于 2014-8-10 15:52 编辑

这是一个行动条那样的脚本
求解一下这个脚本的行动条的描绘在哪里
我把【生成战斗cp条】这一段的    @cpgauge_back.bitmap.gradient_fill_rect(0, 0, 400, 16, Color.new(0, 255, 0), Color.new(255, 0, 0))
改成了 @cpgague_back.bitmap = Cache.system("boom.png")
那个背景还是渐变色条……


#RTAB战斗系统 For RPG Maker VX Ace 编写者:SLICK

[pre lang="ruby" line="1"]#encoding:utf-8
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
#  战斗画面
#==============================================================================

class Scene_Battle < Scene_Base
  attr_accessor :cp_quota
  attr_accessor :rtab_wait
  attr_accessor :active_members
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  def start
    super
    @cp_quota = 0
    create_spriteset
    create_all_windows
    BattleManager.method_wait_for_message = method(:wait_for_message)
  end
  #--------------------------------------------------------------------------
  # ● 战斗开始
  #--------------------------------------------------------------------------
  def battle_start
    @rtab_wait = true
    @active_members = []
    BattleManager.battle_start
    set_cp_quota
    process_event
    #start_party_command_selection
  end
  #--------------------------------------------------------------------------
  # ● 获取敌我双方人物的平均行动速度并决定CP槽的Quota值
  #--------------------------------------------------------------------------
  def set_cp_quota
    sss = 0.0
    for iii in $game_party.members
      sss += iii.param(6)
    end
    sss /= $game_party.members.size
    @cp_quota = sss * 200
    @spriteset.cp_quota = @cp_quota
    for iii in $game_party.members + $game_troop.members
      iii.cp_quota = @cp_quota
    end
  end
  #--------------------------------------------------------------------------
  # ● 进行下一个指令输入
  #--------------------------------------------------------------------------
  def next_command
    if BattleManager.next_command
      start_actor_command_selection
    else
      turn_start(@active_members)
    end
  end
  #--------------------------------------------------------------------------
  # ● 返回上一个指令输入
  #--------------------------------------------------------------------------
  def prior_command
    if BattleManager.prior_command
      start_actor_command_selection
    else
      start_party_command_selection
    end
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    if BattleManager.in_turn?
      process_event
      process_action
    else
      if @rtab_wait
        for iii in $game_party.members + $game_troop.members
          iii.in_turn = false
          iii.rtab_cp += iii.param(6)
          if iii.rtab_cp >= iii.cp_quota
            @active_members.push(iii)
            iii.in_turn = true
          end
        end
        if @active_members.size > 0
          @rtab_wait = false
          start_party_command_selection
        end
      end
    end
    BattleManager.judge_win_loss
  end
  #--------------------------------------------------------------------------
  # ● 回合开始
  #--------------------------------------------------------------------------
  def turn_start(members)
    @party_command_window.close
    @actor_command_window.close
    @status_window.unselect
    @subject = nil
    BattleManager.turn_start(members)
    @log_window.wait
    @log_window.clear
  end
  #--------------------------------------------------------------------------
  # ● 回合结束
  #--------------------------------------------------------------------------
  def turn_end
    @active_members.each do |battler|
      battler.on_turn_end
      refresh_status
      @log_window.display_auto_affected_status(battler)
      @log_window.wait_and_clear
    end
    BattleManager.turn_end
    process_event
    @rtab_wait = true
    @active_members = []
  end
  #--------------------------------------------------------------------------
  # ● 处理战斗行动
  #--------------------------------------------------------------------------
  def process_action
    return if scene_changing?
    if !@subject || !@subject.current_action
      @subject = BattleManager.next_subject
    end
    return turn_end unless @subject
    if @subject.current_action
      @subject.current_action.prepare
      if @subject.current_action.valid?
        @status_window.open
        execute_action
      end
      @subject.remove_current_action
    end
    process_action_end unless @subject.current_action
  end
  #--------------------------------------------------------------------------
  # ● 开始队伍指令的选择
  #--------------------------------------------------------------------------
  def start_party_command_selection
    unless scene_changing?
      refresh_status
      @status_window.unselect
      @status_window.open
      if BattleManager.input_start
        BattleManager.clear_actor
        BattleManager.next_command
        @status_window.select(BattleManager.actor.index)
        @actor_command_window.setup(BattleManager.actor)
      else
        @party_command_window.deactivate
        @actor_command_window.close
        turn_start(@active_members)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 生成角色指令窗口
  #--------------------------------------------------------------------------
  def create_actor_command_window
    @actor_command_window = Window_ActorCommand.new
    @actor_command_window.viewport = @info_viewport
    @actor_command_window.set_handler(:attack, method(:command_attack))
    @actor_command_window.set_handler(:skill,  method(:command_skill))
    @actor_command_window.set_handler(:guard,  method(:command_guard))
    @actor_command_window.set_handler(:item,   method(:command_item))
    @actor_command_window.set_handler(:cancel, method(:prior_command))
    @actor_command_window.set_handler(:escape, method(:command_escape))
    @actor_command_window.x = Graphics.width
  end
  #--------------------------------------------------------------------------
  # ● 指令“撤退”
  #--------------------------------------------------------------------------
  def command_escape
    unless BattleManager.process_escape
      turn_start(@active_members)
      for iii in @active_members
        iii.rtab_cp = 0
      end
    end
  end
end

#encoding:utf-8
#==============================================================================
# ■ Window_ActorCommand
#------------------------------------------------------------------------------
#  战斗画面中,选择角色行动的窗口。
#==============================================================================

class Window_ActorCommand < Window_Command
  #--------------------------------------------------------------------------
  # ● 生成指令列表
  #--------------------------------------------------------------------------
  def make_command_list
    return unless @actor
    add_attack_command
    add_skill_commands
    add_guard_command
    add_item_command
    add_escape_command
  end
  #--------------------------------------------------------------------------
  # ● 添加撤退指令
  #--------------------------------------------------------------------------
  def add_escape_command
    add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  end
end

#encoding:utf-8
#==============================================================================
# ■ BattleManager
#------------------------------------------------------------------------------
#  战斗过程的管理器。
#==============================================================================

module BattleManager
  #--------------------------------------------------------------------------
  # ● 战斗开始
  #--------------------------------------------------------------------------
  def self.battle_start
    $game_system.battle_count += 1
    $game_party.on_battle_start
    $game_troop.on_battle_start
    $game_troop.enemy_names.each do |name|
      $game_message.add(sprintf(Vocab::Emerge, name))
    end
    if @preemptive
      $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
    elsif @surprise
      $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
    end
    wait_for_message
  end
  #--------------------------------------------------------------------------
  # ● 遇敌时的处理
  #--------------------------------------------------------------------------
  def self.on_encounter
    @preemptive = false
    @surprise = false
  end
  #--------------------------------------------------------------------------
  # ● 回合开始
  #--------------------------------------------------------------------------
  def self.turn_start(members)
    @phase = :turn
    clear_actor
    $game_troop.increase_turn(members)
    make_action_orders(members)
  end
  #--------------------------------------------------------------------------
  # ● 生成行动顺序
  #--------------------------------------------------------------------------
  def self.make_action_orders(members)
    @action_battlers = []
    for iii in $game_party.members
      if members.include?(iii)
        @action_battlers.push(iii) unless @surprise
      end
    end
    for iii in $game_troop.members
      if members.include?(iii)
        @action_battlers.push(iii) unless @preemptive
      end
    end
    @action_battlers.each {|battler| battler.make_speed }
    @action_battlers.sort! {|a,b| b.speed - a.speed }
  end
end

#encoding:utf-8
#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
#  处理战斗者的类。Game_Actor 和 Game_Enemy 类的父类。
#==============================================================================

class Game_Battler < Game_BattlerBase
  attr_accessor :turn_count
  attr_accessor :rtab_cp
  attr_accessor :cp_quota
  attr_accessor :in_turn
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  alias neoinitialize initialize
  def initialize
    @turn_count = 0
    @rtab_cp = 0
    @cp_quota = 100
    @in_turn = false
    neoinitialize
  end
  #--------------------------------------------------------------------------
  # ● 战斗开始处理
  #--------------------------------------------------------------------------
  def on_battle_start
    @turn_count = 0
    @rtab_cp = 0
    @cp_quota = 100
    @in_turn = false
    init_tp unless preserve_tp?
  end
  #--------------------------------------------------------------------------
  # ● 处理伤害
  #    调用前需要设置好
  #    @result.hp_damage   @result.mp_damage
  #    @result.hp_drain    @result.mp_drain
  #--------------------------------------------------------------------------
  def execute_damage(user)
    on_damage(@result.hp_damage) if @result.hp_damage > 0
    self.hp -= @result.hp_damage
    self.mp -= @result.mp_damage
    user.hp += @result.hp_drain
    user.mp += @result.mp_drain
    # 受伤后计算CP退后量
    cpback = @result.hp_damage + @result.mp_damage
    cpback = (cpback < 0 ? 0 : cpback)
    pent = 100.0 * cpback / self.mhp
    cppentback = ((5 + pent / 10) * self.cp_quota / 100).to_i
    @rtab_cp -= cppentback
    @rtab_cp = (@rtab_cp < 0 ? 0 : @rtab_cp)
  end
  #--------------------------------------------------------------------------
  # ● 判定是否可以输入指令
  #--------------------------------------------------------------------------
  def inputable?
    normal? && !auto_battle? && @in_turn
  end
  #--------------------------------------------------------------------------
  # ● 回合结束处理
  #--------------------------------------------------------------------------
  def on_turn_end
    @result.clear
    regenerate_all
    update_state_turns
    update_buff_turns
    remove_states_auto(2)
    # 该角色的回合计数加1并清空CP
    @turn_count += 1
    @rtab_cp = 0
  end
end

#encoding:utf-8
#==============================================================================
# ■ Game_Troop
#------------------------------------------------------------------------------
#  管理敌群和战斗相关资料的类,也可执行如战斗事件管理之类的功能。
#   本类的实例请参考 $game_troop 。
#==============================================================================

class Game_Troop < Game_Unit
  #--------------------------------------------------------------------------
  # ● 增加回合
  #--------------------------------------------------------------------------
  def increase_turn(members)
    troop.pages.each {|page| @event_flags

点评

发脚本用工具栏里的<>代码框啊喂.~。~  发表于 2014-8-10 15:50
人生是一场漫长的自杀。

无限の剣制

梦石
0
星屑
10450
在线时间
5019 小时
注册时间
2013-2-28
回帖
4942

开拓者贵宾

发表于 2014-8-10 16:16:59 | 显示全部楼层
401 行改成 @cpgauge_back.bitmap = Bitmap.new("Graphics/System/boom.png")
删掉402行
未测试

点评

还有一些问题~~楼下上图  发表于 2014-8-11 12:12
0.0 用了一下代码框 还是那么长……  发表于 2014-8-11 12:01
行动条有了 然后血条又没了 = = 这是为什么呢…… 血条脚本在下面  发表于 2014-8-11 11:59
回复

使用道具 举报

梦石
0
星屑
138
在线时间
304 小时
注册时间
2014-4-11
回帖
319
 楼主| 发表于 2014-8-11 12:00:25 | 显示全部楼层

  1. #==============================================================================
  2. # +++ MOG - Enemy HP Meter  (v1.0) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com/
  6. #==============================================================================
  7. # Apresenta um medidor animado com o HP do inimigo.
  8. #==============================================================================
  9. # Para ocultar o HP do inimigo use a TAG abaixo na caixa de notas.
  10. #
  11. # <Hide HP>
  12. #
  13. #==============================================================================
  14. # Serão necessários as imagens.
  15. #
  16. # Battle_Enemy_HP_Layout.png
  17. # Battle_Enemy_HP_Meter.png
  18. #
  19. #==============================================================================
  20. module MOG_ENEMY_HP
  21.    #Posição geral do medidor em relação ao battler.
  22.    POSITION_CORRECTION = [0,0]
  23.    #Posição do medidor de HP.
  24.    HP_METER_POSITION = [0,0]
  25.    #Prioridade do medidor na tela.
  26.    PRIORITY_Z = 90   
  27. end

  28. #==============================================================================
  29. # ■ Game Enemy
  30. #==============================================================================
  31. class Game_Enemy < Game_Battler

  32.   attr_accessor :hp_meter_active               
  33.   
  34.   #--------------------------------------------------------------------------
  35.   # ● Initialize
  36.   #--------------------------------------------------------------------------
  37.   alias mog_enemy_hp_initialize initialize
  38.   def initialize(index, enemy_id)
  39.       mog_enemy_hp_initialize(index, enemy_id)
  40.       hide = enemy.note =~ /<Hide HP>/i ? true : false
  41.       @hp_meter_active = [false,hide]
  42.   end  

  43. end

  44. #==============================================================================
  45. # ■ Game_Battler
  46. #==============================================================================
  47. class Game_Battler < Game_BattlerBase
  48.   
  49.   #--------------------------------------------------------------------------
  50.   # ● Item Apply
  51.   #--------------------------------------------------------------------------  
  52.    alias mog_enemy_hp_item_apply item_apply
  53.    def item_apply(user, item)
  54.        mog_enemy_hp_item_apply(user, item)
  55.        if self.is_a?(Game_Enemy)
  56.           self.hp_meter_active[0] = true if @result.hp_damage != 0
  57.        end
  58.    end

  59.   #--------------------------------------------------------------------------
  60.   # ● Regenerate HP
  61.   #--------------------------------------------------------------------------
  62.   alias mog_enemy_hp_regenerate_hp regenerate_hp
  63.   def regenerate_hp
  64.       mog_enemy_hp_regenerate_hp
  65.       if self.is_a?(Game_Enemy)
  66.          self.hp_meter_active[0] = true if @result.hp_damage != 0      
  67.       end         
  68.   end
  69.    
  70. end
  71.   

  72. #==============================================================================
  73. # ■ Battle_Hud
  74. #==============================================================================
  75. class Enemy_HP
  76.   include MOG_ENEMY_HP
  77.   
  78.   #--------------------------------------------------------------------------
  79.   # ● Initialize
  80.   #--------------------------------------------------------------------------   
  81.   def initialize(viewport = nil,enemy,image)
  82.       @enemy = enemy
  83.       @image = image
  84.       @fade_time = -1
  85.       create_layout   
  86.       create_hp_meter      
  87.       b_pos = [enemy.screen_x - (@layout.width / 2) + POSITION_CORRECTION[0], enemy.screen_y + POSITION_CORRECTION[1] - (@layout.height / 2)]
  88.       @layout.opacity = 0
  89.       @org_pos1 = [b_pos[0],b_pos[1]]
  90.       @layout.x = @org_pos1[0]
  91.       @layout.y = @org_pos1[1]
  92.       @layout.visible = false
  93.       @hp_meter.opacity = 0
  94.       @hp_meter.visible = false
  95.       @org_pos2 = [b_pos[0] + HP_METER_POSITION[0], b_pos[1] + HP_METER_POSITION[1]]
  96.       @hp_meter.x = @org_pos2[0]
  97.       @hp_meter.y = @org_pos2[1]
  98.       @hp_meter.viewport = viewport
  99.       @hp_meter.z = PRIORITY_Z
  100.       @layout.viewport = viewport
  101.       @layout.z = PRIORITY_Z
  102.       @enemy.hp_meter_active[0] = false
  103.       [url=home.php?mod=space&uid=94902]@Hide[/url] = @enemy.hp_meter_active[1]
  104.   end
  105.   
  106.   #--------------------------------------------------------------------------
  107.   # ● Create HP Meter
  108.   #--------------------------------------------------------------------------        
  109.   def create_layout
  110.       @layout = Sprite.new
  111.       @layout.bitmap = @image[0]
  112.   end
  113.    
  114.   #--------------------------------------------------------------------------
  115.   # ● Create HP Meter
  116.   #--------------------------------------------------------------------------      
  117.   def create_hp_meter
  118.       @meter_cw = @image[1].width
  119.       @meter_ch = @image[1].height# / 2      
  120.       @hp_meter = Sprite.new
  121.       @hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  122.       @hp_width_old = @meter_cw * @enemy.hp / @enemy.mhp
  123.     end  
  124.   
  125.   #--------------------------------------------------------------------------
  126.   # ● Hp Flow Update
  127.   #--------------------------------------------------------------------------
  128.   def update_hp_flow
  129.       return if !@layout.visible     
  130.       hp_width = @meter_cw * @enemy.hp / @enemy.mhp
  131.       @hp_meter.bitmap.clear      
  132.       execute_damage_flow(hp_width)
  133.       hp_src_rect = Rect.new(0, 0,hp_width, @meter_ch)
  134.       @hp_meter.bitmap.blt(0,0, @image[1], hp_src_rect)
  135.   end
  136.    
  137.   #--------------------------------------------------------------------------
  138.   # ● Execute Damage Flow
  139.   #--------------------------------------------------------------------------
  140.   def execute_damage_flow(hp_width)
  141.       n = (@hp_width_old - hp_width).abs * 3 / 100
  142.       damage_flow = [[n, 2].min,0.5].max
  143.       @hp_width_old -= damage_flow
  144.       if @hp_width_old <= hp_width
  145.          @hp_width_old = hp_width
  146.       end   
  147.       src_rect_old = Rect.new(0,@meter_ch,@hp_width_old, @meter_ch)
  148.       @hp_meter.bitmap.blt(0,0, @image[1], src_rect_old)      
  149.   end   
  150.   
  151.   #--------------------------------------------------------------------------
  152.   # ● Dispose
  153.   #--------------------------------------------------------------------------      
  154.   def dispose
  155.       @layout.bitmap.dispose
  156.       @layout.dispose
  157.       @hp_meter.bitmap.dispose
  158.       @hp_meter.dispose
  159.   end
  160.   
  161.   #--------------------------------------------------------------------------
  162.   # ● Update
  163.   #--------------------------------------------------------------------------      
  164.   def update
  165.       return if @hide
  166.       update_fade   
  167.       update_visible
  168.       update_hp_flow
  169.       refresh if @enemy.hp_meter_active[0]
  170.   end  
  171.   
  172.   #--------------------------------------------------------------------------
  173.   # ● Update Fade
  174.   #--------------------------------------------------------------------------        
  175.   def update_fade
  176.       @fade_time -= 1 if @fade_time > 0
  177.       return if @fade_time != 0
  178.       @layout.opacity -= 10
  179.       @hp_meter.opacity -= 10
  180.       @layout.x += 1
  181.       @hp_meter.x += 1
  182.       @fade_time = -1 if @layout.opacity == 0
  183.   end  
  184.   
  185.   #--------------------------------------------------------------------------
  186.   # ● Update Visible
  187.   #--------------------------------------------------------------------------        
  188.   def update_visible
  189.       return if !@layout.visible
  190.       vis = can_visible?
  191.       @layout.visible = vis
  192.       @hp_meter.visible = vis
  193.   end
  194.   
  195.   #--------------------------------------------------------------------------
  196.   # ● Refresh
  197.   #--------------------------------------------------------------------------         
  198.   def refresh     
  199.       @enemy.hp_meter_active[0] = false
  200.       @layout.opacity = 255
  201.       @hp_meter.opacity = 255   
  202.       @layout.visible = true
  203.       @hp_meter.visible = true
  204.       @fade_time = 60
  205.       @layout.x = @org_pos1[0]
  206.       @layout.y = @org_pos1[1]
  207.       @hp_meter.x = @org_pos2[0]
  208.       @hp_meter.y = @org_pos2[1]      
  209.       hp_width = @meter_cw * @enemy.hp / @enemy.mhp
  210.       @hp_width_old = hp_width if @hp_width_old < hp_width
  211.       update_hp_flow
  212.   end
  213.   
  214.   #--------------------------------------------------------------------------
  215.   # ● Can Visible?
  216.   #--------------------------------------------------------------------------         
  217.   def can_visible?
  218.       return false if @layout.opacity == 0      
  219.       return true
  220.   end
  221.    
  222. end

  223. #==============================================================================
  224. # ■ Spriteset Battle
  225. #==============================================================================
  226. class Spriteset_Battle
  227.   
  228.   #--------------------------------------------------------------------------
  229.   # ● Initialize
  230.   #--------------------------------------------------------------------------  
  231.   alias mog_enemy_hp_initialize initialize
  232.   def initialize
  233.       mog_enemy_hp_initialize
  234.       create_enemy_hp      
  235.   end
  236.   
  237.   #--------------------------------------------------------------------------
  238.   # ● Create Battle Hud
  239.   #--------------------------------------------------------------------------   
  240.   def create_enemy_hp   
  241.       ie1 = Cache.system("Battle_Enemy_HP_Layout")
  242.       ie2 = Cache.system("Battle_Enemy_HP_Meter")
  243.       @enemy_hp_images = [ie1,ie2]
  244.       @enemy_hp = []      
  245.       for i in $game_troop.members
  246.           @enemy_hp.push(Enemy_HP.new(@viewport1,i,@enemy_hp_images))
  247.       end
  248.   end
  249.   
  250.   #--------------------------------------------------------------------------
  251.   # ● Dispose
  252.   #--------------------------------------------------------------------------      
  253.   alias mog_enemy_hp_dispose dispose
  254.   def dispose
  255.       mog_enemy_hp_dispose
  256.       dispose_enemy_hp
  257.   end  
  258.   
  259.   #--------------------------------------------------------------------------
  260.   # ● Dispose Enemy HP
  261.   #--------------------------------------------------------------------------        
  262.   def dispose_enemy_hp
  263.       return if @enemy_hp_images == nil
  264.       @enemy_hp_images.each {|sprite| sprite.dispose }
  265.       @enemy_hp_images.clear
  266.       @enemy_hp.each {|sprite| sprite.dispose }
  267.       @enemy_hp.clear
  268.   end
  269.   
  270.   #--------------------------------------------------------------------------
  271.   # ● Update
  272.   #--------------------------------------------------------------------------        
  273.   alias mog_enemy_hp_update update
  274.   def update
  275.       mog_enemy_hp_update
  276.       update_enemy_hp
  277.   end
  278.   
  279.   #--------------------------------------------------------------------------
  280.   # ● Update Enemy HP
  281.   #--------------------------------------------------------------------------         
  282.   def update_enemy_hp
  283.       return if @enemy_hp_images == nil
  284.       @enemy_hp.each {|sprite| sprite.update }
  285.   end  
  286. end

  287. $mog_rgss3_enemy_hp_meter = true
复制代码
人生是一场漫长的自杀。
回复

使用道具 举报

梦石
0
星屑
138
在线时间
304 小时
注册时间
2014-4-11
回帖
319
 楼主| 发表于 2014-8-11 12:11:38 | 显示全部楼层
我把自己的行动条素材拉长到544像素就出现了图1的情况
  1.   #--------------------------------------------------------------------------
  2.   # ● 生成战斗CP条
  3.   #--------------------------------------------------------------------------
  4.   def create_rtabcp_gauge
  5.     @cpgauge_back= Sprite.new(@viewport3)
  6.     @cpgauge_back.bitmap = Bitmap.new("Graphics/System/boom.png")
  7. #~     @cpgauge_back.bitmap.gradient_fill_rect(0, 0, 400, 16, Color.new(0, 255, 0), Color.new(255, 0, 0))
  8.     @cpgauge_back.x = 0
  9.     @cpgauge_back.y = 16
  10.     # 为战斗中的各个角色生成其图标
  11.     @icons = {}
  12.     for iii in $game_party.members
  13.       @icons[iii] = Sprite.new(@viewport3)
  14.       @icons[iii].bitmap = Bitmap.new("Graphics/System/bicon1.png")
  15.       @icons[iii].ox = 12
  16.       @icons[iii].oy = 12
  17.       @icons[iii].x = 16
  18.       @icons[iii].y = 20
  19.     end
  20.     for iii in $game_troop.members
  21.       @icons[iii] = Sprite.new(@viewport3)
  22.       @icons[iii].bitmap = Bitmap.new("Graphics/System/bicon2.png")
  23.       @icons[iii].ox = 12
  24.       @icons[iii].oy = 12
  25.       @icons[iii].x = 16
  26.       @icons[iii].y = 20
  27.     end
  28.   end
复制代码
看了半天都觉得是这里生成cp条 可是怎么改那个渐变都在
QQ图片20140811120846.jpg

点评

我不想要那个渐变 我要用自己的素材  发表于 2014-8-11 12:55
你要的效果是啥  发表于 2014-8-11 12:19
人生是一场漫长的自杀。
回复

使用道具 举报

无限の剣制

梦石
0
星屑
10450
在线时间
5019 小时
注册时间
2013-2-28
回帖
4942

开拓者贵宾

发表于 2014-8-11 12:47:41 | 显示全部楼层
本帖最后由 VIPArcher 于 2014-8-11 16:14 编辑

那你就这么改试试,不要删掉那几句
改成这样
你复制这个进去试一下如果报错,删掉url什么的,目测会有论坛BUG
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Scene_Battle
  4. #------------------------------------------------------------------------------
  5. #  战斗画面
  6. #==============================================================================

  7. class Scene_Battle < Scene_Base
  8.   attr_accessor :cp_quota
  9.   attr_accessor :rtab_wait
  10.   attr_accessor :active_members
  11.   #--------------------------------------------------------------------------
  12.   # ● 开始处理
  13.   #--------------------------------------------------------------------------
  14.   def start
  15.     super
  16.     @cp_quota = 0
  17.     create_spriteset
  18.     create_all_windows
  19.     BattleManager.method_wait_for_message = method(:wait_for_message)
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 战斗开始
  23.   #--------------------------------------------------------------------------
  24.   def battle_start
  25.     @rtab_wait = true
  26.     @active_members = []
  27.     BattleManager.battle_start
  28.     set_cp_quota
  29.     process_event
  30.     #start_party_command_selection
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 获取敌我双方人物的平均行动速度并决定CP槽的Quota值
  34.   #--------------------------------------------------------------------------
  35.   def set_cp_quota
  36.     sss = 0.0
  37.     for iii in $game_party.members
  38.       sss += iii.param(6)
  39.     end
  40.     sss /= $game_party.members.size
  41.     @cp_quota = sss * 200
  42.     @spriteset.cp_quota = @cp_quota
  43.     for iii in $game_party.members + $game_troop.members
  44.       iii.cp_quota = @cp_quota
  45.     end
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 进行下一个指令输入
  49.   #--------------------------------------------------------------------------
  50.   def next_command
  51.     if BattleManager.next_command
  52.       start_actor_command_selection
  53.     else
  54.       turn_start(@active_members)
  55.     end
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● 返回上一个指令输入
  59.   #--------------------------------------------------------------------------
  60.   def prior_command
  61.     if BattleManager.prior_command
  62.       start_actor_command_selection
  63.     else
  64.       start_party_command_selection
  65.     end
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # ● 更新画面
  69.   #--------------------------------------------------------------------------
  70.   def update
  71.     super
  72.     if BattleManager.in_turn?
  73.       process_event
  74.       process_action
  75.     else
  76.       if @rtab_wait
  77.         for iii in $game_party.members + $game_troop.members
  78.           iii.in_turn = false
  79.           iii.rtab_cp += iii.param(6)
  80.           if iii.rtab_cp >= iii.cp_quota
  81.             @active_members.push(iii)
  82.             iii.in_turn = true
  83.           end
  84.         end
  85.         if @active_members.size > 0
  86.           @rtab_wait = false
  87.           start_party_command_selection
  88.         end
  89.       end
  90.     end
  91.     BattleManager.judge_win_loss
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 回合开始
  95.   #--------------------------------------------------------------------------
  96.   def turn_start(members)
  97.     @party_command_window.close
  98.     @actor_command_window.close
  99.     @status_window.unselect
  100.     @subject = nil
  101.     BattleManager.turn_start(members)
  102.     @log_window.wait
  103.     @log_window.clear
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ● 回合结束
  107.   #--------------------------------------------------------------------------
  108.   def turn_end
  109.     @active_members.each do |battler|
  110.       battler.on_turn_end
  111.       refresh_status
  112.       @log_window.display_auto_affected_status(battler)
  113.       @log_window.wait_and_clear
  114.     end
  115.     BattleManager.turn_end
  116.     process_event
  117.     @rtab_wait = true
  118.     @active_members = []
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 处理战斗行动
  122.   #--------------------------------------------------------------------------
  123.   def process_action
  124.     return if scene_changing?
  125.     if !@subject || !@subject.current_action
  126.       @subject = BattleManager.next_subject
  127.     end
  128.     return turn_end unless @subject
  129.     if @subject.current_action
  130.       @subject.current_action.prepare
  131.       if @subject.current_action.valid?
  132.         @status_window.open
  133.         execute_action
  134.       end
  135.       @subject.remove_current_action
  136.     end
  137.     process_action_end unless @subject.current_action
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 开始队伍指令的选择
  141.   #--------------------------------------------------------------------------
  142.   def start_party_command_selection
  143.     unless scene_changing?
  144.       refresh_status
  145.       @status_window.unselect
  146.       @status_window.open
  147.       if BattleManager.input_start
  148.         BattleManager.clear_actor
  149.         BattleManager.next_command
  150.         @status_window.select(BattleManager.actor.index)
  151.         @actor_command_window.setup(BattleManager.actor)
  152.       else
  153.         @party_command_window.deactivate
  154.         @actor_command_window.close
  155.         turn_start(@active_members)
  156.       end
  157.     end
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ● 生成角色指令窗口
  161.   #--------------------------------------------------------------------------
  162.   def create_actor_command_window
  163.     @actor_command_window = Window_ActorCommand.new
  164.     @actor_command_window.viewport = @info_viewport
  165.     @actor_command_window.set_handler(:attack, method(:command_attack))
  166.     @actor_command_window.set_handler(:skill,  method(:command_skill))
  167.     @actor_command_window.set_handler(:guard,  method(:command_guard))
  168.     @actor_command_window.set_handler(:item,   method(:command_item))
  169.     @actor_command_window.set_handler(:cancel, method(:prior_command))
  170.     @actor_command_window.set_handler(:escape, method(:command_escape))
  171.     @actor_command_window.x = Graphics.width
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● 指令“撤退”
  175.   #--------------------------------------------------------------------------
  176.   def command_escape
  177.     unless BattleManager.process_escape
  178.       turn_start(@active_members)
  179.       for iii in @active_members
  180.         iii.rtab_cp = 0
  181.       end
  182.     end
  183.   end
  184. end

  185. #encoding:utf-8
  186. #==============================================================================
  187. # ■ Window_ActorCommand
  188. #------------------------------------------------------------------------------
  189. #  战斗画面中,选择角色行动的窗口。
  190. #==============================================================================

  191. class Window_ActorCommand < Window_Command
  192.   #--------------------------------------------------------------------------
  193.   # ● 生成指令列表
  194.   #--------------------------------------------------------------------------
  195.   def make_command_list
  196.     return unless @actor
  197.     add_attack_command
  198.     add_skill_commands
  199.     add_guard_command
  200.     add_item_command
  201.     add_escape_command
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 添加撤退指令
  205.   #--------------------------------------------------------------------------
  206.   def add_escape_command
  207.     add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  208.   end
  209. end

  210. #encoding:utf-8
  211. #==============================================================================
  212. # ■ BattleManager
  213. #------------------------------------------------------------------------------
  214. #  战斗过程的管理器。
  215. #==============================================================================

  216. module BattleManager
  217.   #--------------------------------------------------------------------------
  218.   # ● 战斗开始
  219.   #--------------------------------------------------------------------------
  220.   def self.battle_start
  221.     $game_system.battle_count += 1
  222.     $game_party.on_battle_start
  223.     $game_troop.on_battle_start
  224.     $game_troop.enemy_names.each do |name|
  225.       $game_message.add(sprintf(Vocab::Emerge, name))
  226.     end
  227.     if @preemptive
  228.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  229.     elsif @surprise
  230.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  231.     end
  232.     wait_for_message
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ● 遇敌时的处理
  236.   #--------------------------------------------------------------------------
  237.   def self.on_encounter
  238.     @preemptive = false
  239.     @surprise = false
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● 回合开始
  243.   #--------------------------------------------------------------------------
  244.   def self.turn_start(members)
  245.     @phase = :turn
  246.     clear_actor
  247.     $game_troop.increase_turn(members)
  248.     make_action_orders(members)
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ● 生成行动顺序
  252.   #--------------------------------------------------------------------------
  253.   def self.make_action_orders(members)
  254.     @action_battlers = []
  255.     for iii in $game_party.members
  256.       if members.include?(iii)
  257.         @action_battlers.push(iii) unless @surprise
  258.       end
  259.     end
  260.     for iii in $game_troop.members
  261.       if members.include?(iii)
  262.         @action_battlers.push(iii) unless @preemptive
  263.       end
  264.     end
  265.     @action_battlers.each {|battler| battler.make_speed }
  266.     @action_battlers.sort! {|a,b| b.speed - a.speed }
  267.   end
  268. end

  269. #encoding:utf-8
  270. #==============================================================================
  271. # ■ Game_Battler
  272. #------------------------------------------------------------------------------
  273. #  处理战斗者的类。Game_Actor 和 Game_Enemy 类的父类。
  274. #==============================================================================

  275. class Game_Battler < Game_BattlerBase
  276.   attr_accessor :turn_count
  277.   attr_accessor :rtab_cp
  278.   attr_accessor :cp_quota
  279.   attr_accessor :in_turn
  280.   #--------------------------------------------------------------------------
  281.   # ● 初始化对象
  282.   #--------------------------------------------------------------------------
  283.   alias neoinitialize initialize
  284.   def initialize
  285.     @turn_count = 0
  286.     @rtab_cp = 0
  287.     @cp_quota = 100
  288.     @in_turn = false
  289.     neoinitialize
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # ● 战斗开始处理
  293.   #--------------------------------------------------------------------------
  294.   def on_battle_start
  295.     @turn_count = 0
  296.     @rtab_cp = 0
  297.     @cp_quota = 100
  298.     @in_turn = false
  299.     init_tp unless preserve_tp?
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● 处理伤害
  303.   #    调用前需要设置好
  304.   #    @result.hp_damage   @result.mp_damage
  305.   #    @result.hp_drain    @result.mp_drain
  306.   #--------------------------------------------------------------------------
  307.   def execute_damage(user)
  308.     on_damage(@result.hp_damage) if @result.hp_damage > 0
  309.     self.hp -= @result.hp_damage
  310.     self.mp -= @result.mp_damage
  311.     user.hp += @result.hp_drain
  312.     user.mp += @result.mp_drain
  313.     # 受伤后计算CP退后量
  314.     cpback = @result.hp_damage + @result.mp_damage
  315.     cpback = (cpback < 0 ? 0 : cpback)
  316.     pent = 100.0 * cpback / self.mhp
  317.     cppentback = ((5 + pent / 10) * self.cp_quota / 100).to_i
  318.     @rtab_cp -= cppentback
  319.     @rtab_cp = (@rtab_cp < 0 ? 0 : @rtab_cp)
  320.   end
  321.   #--------------------------------------------------------------------------
  322.   # ● 判定是否可以输入指令
  323.   #--------------------------------------------------------------------------
  324.   def inputable?
  325.     normal? && !auto_battle? && @in_turn
  326.   end
  327.   #--------------------------------------------------------------------------
  328.   # ● 回合结束处理
  329.   #--------------------------------------------------------------------------
  330.   def on_turn_end
  331.     @result.clear
  332.     regenerate_all
  333.     update_state_turns
  334.     update_buff_turns
  335.     remove_states_auto(2)
  336.     # 该角色的回合计数加1并清空CP
  337.     @turn_count += 1
  338.     @rtab_cp = 0
  339.   end
  340. end

  341. #encoding:utf-8
  342. #==============================================================================
  343. # ■ Game_Troop
  344. #------------------------------------------------------------------------------
  345. #  管理敌群和战斗相关资料的类,也可执行如战斗事件管理之类的功能。
  346. #   本类的实例请参考 $game_troop 。
  347. #==============================================================================

  348. class Game_Troop < Game_Unit
  349.   #--------------------------------------------------------------------------
  350.   # ● 增加回合
  351.   #--------------------------------------------------------------------------
  352.   def increase_turn(members)
  353.     troop.pages.each {|page| @event_flags= false if page.span == 1 }
  354.     turnmax = []
  355.     for iii in members
  356.       turnmax.push(iii.turn_count)
  357.     end
  358.     @turn_count = turnmax.max
  359.   end
  360. end

  361. #encoding:utf-8
  362. #==============================================================================
  363. # ■ Spriteset_Battle
  364. #------------------------------------------------------------------------------
  365. #  处理战斗画面的精灵的类。本类在 Scene_Battle 类的内部使用。
  366. #==============================================================================

  367. class Spriteset_Battle
  368.   attr_accessor :icons
  369.   attr_accessor :cp_quota
  370.   #--------------------------------------------------------------------------
  371.   # ● 初始化对象
  372.   #--------------------------------------------------------------------------
  373.   def initialize
  374.     @cp_quota = 100
  375.     create_viewports
  376.     create_battleback1
  377.     create_battleback2
  378.     create_enemies
  379.     create_actors
  380.     create_pictures
  381.     create_timer
  382.     create_rtabcp_gauge
  383.     update
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # ● 生成战斗CP条
  387.   #--------------------------------------------------------------------------
  388.   def create_rtabcp_gauge
  389.     @cpgauge_back= Sprite.new(@viewport3)
  390.     @cpgauge_back.bitmap = Bitmap.new(400, 8)
  391.     @cpgauge_back.bitmap.gradient_fill_rect(0, 0, 518, 16, Color.new(0, 255, 0), Color.new(255, 0, 0))
  392.     @cpgauge_back.bitmap = Bitmap.new("Graphics/System/boom.png")
  393.     @cpgauge_back.x = 16
  394.     @cpgauge_back.y = 16
  395.     # 为战斗中的各个角色生成其图标
  396.     @icons = {}
  397.     for iii in $game_party.members
  398.       @icons[iii] = Sprite.new(@viewport3)
  399.       @icons[iii].bitmap = Bitmap.new("Graphics/System/bicon1.png")
  400.       @icons[iii].ox = 12
  401.       @icons[iii].oy = 12
  402.       @icons[iii].x = 16
  403.       @icons[iii].y = 20
  404.     end
  405.     for iii in $game_troop.members
  406.       @icons[iii] = Sprite.new(@viewport3)
  407.       @icons[iii].bitmap = Bitmap.new("Graphics/System/bicon2.png")
  408.       @icons[iii].ox = 12
  409.       @icons[iii].oy = 12
  410.       @icons[iii].x = 16
  411.       @icons[iii].y = 20
  412.     end
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● 释放
  416.   #--------------------------------------------------------------------------
  417.   def dispose
  418.     dispose_battleback1
  419.     dispose_battleback2
  420.     dispose_enemies
  421.     dispose_actors
  422.     dispose_pictures
  423.     dispose_timer
  424.     dispose_viewports
  425.     dispose_rtabcp_gauge
  426.   end
  427.   #--------------------------------------------------------------------------
  428.   # ● 消灭战斗CP条
  429.   #--------------------------------------------------------------------------
  430.   def dispose_rtabcp_gauge
  431.     @cpgauge_back.bitmap.dispose
  432.     @cpgauge_back.dispose
  433.     for iii in $game_party.members
  434.       @icons[iii].bitmap.dispose
  435.       @icons[iii].dispose
  436.     end
  437.     for iii in $game_troop.members
  438.       @icons[iii].bitmap.dispose
  439.       @icons[iii].dispose
  440.     end
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ● 更新画面
  444.   #--------------------------------------------------------------------------
  445.   def update
  446.     update_battleback1
  447.     update_battleback2
  448.     update_enemies
  449.     update_actors
  450.     update_cp
  451.     update_pictures
  452.     update_timer
  453.     update_viewports
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # ● 更新CP条
  457.   #--------------------------------------------------------------------------
  458.   def update_cp
  459.     for iii in $game_party.members + $game_troop.members
  460.       @icons[iii].x = 16 + 400 * iii.rtab_cp / @cp_quota
  461.       @icons[iii].visible = iii.alive?
  462.     end
  463.   end
  464. end
复制代码
你要的是这样的效果吧?
我没出现你说的情况
QQ图片20140804210536.jpg

点评

我这边加了行动条血条就没了 T.T  发表于 2014-8-11 13:33
这个……还是我发的那个图的效果  发表于 2014-8-11 12:56

评分

参与人数 1星屑 +200 收起 理由
taroxd + 200 塞糖

查看全部评分

回复

使用道具 举报

梦石
0
星屑
138
在线时间
304 小时
注册时间
2014-4-11
回帖
319
 楼主| 发表于 2014-8-11 13:04:32 | 显示全部楼层
  1.   def create_rtabcp_gauge
  2.     @cpgauge_back= Sprite.new(@viewport3)
  3. #~     @cpgauge_back.bitmap = Bitmap.new(400, 8)
  4. #~     @cpgauge_back.bitmap.gradient_fill_rect(0, 0, 400, 16, Color.new(0, 0, 0), Color.new(0, 0, 0))
  5.     @cpgauge_back.bitmap = Bitmap.new("Graphics/System/boom.png")
  6.     @cpgauge_back.x = 16
  7.     @cpgauge_back.y = 16
复制代码
@VIPArcher 改成这样 好了 行动条有了 接下来就是血条不见了的问题…………救命

点评

新建的工程是可以的……我的工程就血条没了……改的比较多 估计哪里冲突了  发表于 2014-8-12 10:29
为嘛,我都没问题?你发个范例看看。  发表于 2014-8-11 18:48
T T 还是不行 血条不见了 看来不能用行动条了吗 你有别的行动条脚本吗 横版的  发表于 2014-8-11 18:07
我这里没问题的说,你把3.4行注释去掉,把敌人显血脚本放在这个脚本的下面试试。~。~  发表于 2014-8-11 16:08
没 我这边是3、4行注释掉才显示我的素材 不注释就有那个渐变……  发表于 2014-8-11 15:25
人生是一场漫长的自杀。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部