Project1

标题: RTAB-cp战斗脚本背景描绘 [打印本页]

作者: fox1313304    时间: 2014-8-10 15:08
标题: RTAB-cp战斗脚本背景描绘
本帖最后由 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

RUBY 代码复制
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Scene_Battle
  4. #------------------------------------------------------------------------------
  5. #  战斗画面
  6. #==============================================================================
  7.  
  8. class Scene_Battle < Scene_Base
  9.   attr_accessor :cp_quota
  10.   attr_accessor :rtab_wait
  11.   attr_accessor :active_members
  12.   #--------------------------------------------------------------------------
  13.   # ● 开始处理
  14.   #--------------------------------------------------------------------------
  15.   def start
  16.     super
  17.     @cp_quota = 0
  18.     create_spriteset
  19.     create_all_windows
  20.     BattleManager.method_wait_for_message = method(:wait_for_message)
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 战斗开始
  24.   #--------------------------------------------------------------------------
  25.   def battle_start
  26.     @rtab_wait = true
  27.     @active_members = []
  28.     BattleManager.battle_start
  29.     set_cp_quota
  30.     process_event
  31.     #start_party_command_selection
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 获取敌我双方人物的平均行动速度并决定CP槽的Quota值
  35.   #--------------------------------------------------------------------------
  36.   def set_cp_quota
  37.     sss = 0.0
  38.     for iii in $game_party.members
  39.       sss += iii.param(6)
  40.     end
  41.     sss /= $game_party.members.size
  42.     @cp_quota = sss * 200
  43.     @spriteset.cp_quota = @cp_quota
  44.     for iii in $game_party.members + $game_troop.members
  45.       iii.cp_quota = @cp_quota
  46.     end
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 进行下一个指令输入
  50.   #--------------------------------------------------------------------------
  51.   def next_command
  52.     if BattleManager.next_command
  53.       start_actor_command_selection
  54.     else
  55.       turn_start(@active_members)
  56.     end
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 返回上一个指令输入
  60.   #--------------------------------------------------------------------------
  61.   def prior_command
  62.     if BattleManager.prior_command
  63.       start_actor_command_selection
  64.     else
  65.       start_party_command_selection
  66.     end
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● 更新画面
  70.   #--------------------------------------------------------------------------
  71.   def update
  72.     super
  73.     if BattleManager.in_turn?
  74.       process_event
  75.       process_action
  76.     else
  77.       if @rtab_wait
  78.         for iii in $game_party.members + $game_troop.members
  79.           iii.in_turn = false
  80.           iii.rtab_cp += iii.param(6)
  81.           if iii.rtab_cp >= iii.cp_quota
  82.             @active_members.push(iii)
  83.             iii.in_turn = true
  84.           end
  85.         end
  86.         if @active_members.size > 0
  87.           @rtab_wait = false
  88.           start_party_command_selection
  89.         end
  90.       end
  91.     end
  92.     BattleManager.judge_win_loss
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 回合开始
  96.   #--------------------------------------------------------------------------
  97.   def turn_start(members)
  98.     @party_command_window.close
  99.     @actor_command_window.close
  100.     @status_window.unselect
  101.     @subject = nil
  102.     BattleManager.turn_start(members)
  103.     @log_window.wait
  104.     @log_window.clear
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 回合结束
  108.   #--------------------------------------------------------------------------
  109.   def turn_end
  110.     @active_members.each do |battler|
  111.       battler.on_turn_end
  112.       refresh_status
  113.       @log_window.display_auto_affected_status(battler)
  114.       @log_window.wait_and_clear
  115.     end
  116.     BattleManager.turn_end
  117.     process_event
  118.     @rtab_wait = true
  119.     @active_members = []
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● 处理战斗行动
  123.   #--------------------------------------------------------------------------
  124.   def process_action
  125.     return if scene_changing?
  126.     if !@subject || !@subject.current_action
  127.       @subject = BattleManager.next_subject
  128.     end
  129.     return turn_end unless @subject
  130.     if @subject.current_action
  131.       @subject.current_action.prepare
  132.       if @subject.current_action.valid?
  133.         @status_window.open
  134.         execute_action
  135.       end
  136.       @subject.remove_current_action
  137.     end
  138.     process_action_end unless @subject.current_action
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● 开始队伍指令的选择
  142.   #--------------------------------------------------------------------------
  143.   def start_party_command_selection
  144.     unless scene_changing?
  145.       refresh_status
  146.       @status_window.unselect
  147.       @status_window.open
  148.       if BattleManager.input_start
  149.         BattleManager.clear_actor
  150.         BattleManager.next_command
  151.         @status_window.select(BattleManager.actor.index)
  152.         @actor_command_window.setup(BattleManager.actor)
  153.       else
  154.         @party_command_window.deactivate
  155.         @actor_command_window.close
  156.         turn_start(@active_members)
  157.       end
  158.     end
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● 生成角色指令窗口
  162.   #--------------------------------------------------------------------------
  163.   def create_actor_command_window
  164.     @actor_command_window = Window_ActorCommand.new
  165.     @actor_command_window.viewport = @info_viewport
  166.     @actor_command_window.set_handler(:attack, method(:command_attack))
  167.     @actor_command_window.set_handler(:skill,  method(:command_skill))
  168.     @actor_command_window.set_handler(:guard,  method(:command_guard))
  169.     @actor_command_window.set_handler(:item,   method(:command_item))
  170.     @actor_command_window.set_handler(:cancel, method(:prior_command))
  171.     @actor_command_window.set_handler(:escape, method(:command_escape))
  172.     @actor_command_window.x = Graphics.width
  173.   end
  174.   #--------------------------------------------------------------------------
  175.   # ● 指令“撤退”
  176.   #--------------------------------------------------------------------------
  177.   def command_escape
  178.     unless BattleManager.process_escape
  179.       turn_start(@active_members)
  180.       for iii in @active_members
  181.         iii.rtab_cp = 0
  182.       end
  183.     end
  184.   end
  185. end
  186.  
  187. #encoding:utf-8
  188. #==============================================================================
  189. # ■ Window_ActorCommand
  190. #------------------------------------------------------------------------------
  191. #  战斗画面中,选择角色行动的窗口。
  192. #==============================================================================
  193.  
  194. class Window_ActorCommand < Window_Command
  195.   #--------------------------------------------------------------------------
  196.   # ● 生成指令列表
  197.   #--------------------------------------------------------------------------
  198.   def make_command_list
  199.     return unless @actor
  200.     add_attack_command
  201.     add_skill_commands
  202.     add_guard_command
  203.     add_item_command
  204.     add_escape_command
  205.   end
  206.   #--------------------------------------------------------------------------
  207.   # ● 添加撤退指令
  208.   #--------------------------------------------------------------------------
  209.   def add_escape_command
  210.     add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  211.   end
  212. end
  213.  
  214. #encoding:utf-8
  215. #==============================================================================
  216. # ■ BattleManager
  217. #------------------------------------------------------------------------------
  218. #  战斗过程的管理器。
  219. #==============================================================================
  220.  
  221. module BattleManager
  222.   #--------------------------------------------------------------------------
  223.   # ● 战斗开始
  224.   #--------------------------------------------------------------------------
  225.   def self.battle_start
  226.     $game_system.battle_count += 1
  227.     $game_party.on_battle_start
  228.     $game_troop.on_battle_start
  229.     $game_troop.enemy_names.each do |name|
  230.       $game_message.add(sprintf(Vocab::Emerge, name))
  231.     end
  232.     if @preemptive
  233.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  234.     elsif @surprise
  235.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  236.     end
  237.     wait_for_message
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # ● 遇敌时的处理
  241.   #--------------------------------------------------------------------------
  242.   def self.on_encounter
  243.     @preemptive = false
  244.     @surprise = false
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ● 回合开始
  248.   #--------------------------------------------------------------------------
  249.   def self.turn_start(members)
  250.     @phase = :turn
  251.     clear_actor
  252.     $game_troop.increase_turn(members)
  253.     make_action_orders(members)
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ● 生成行动顺序
  257.   #--------------------------------------------------------------------------
  258.   def self.make_action_orders(members)
  259.     @action_battlers = []
  260.     for iii in $game_party.members
  261.       if members.include?(iii)
  262.         @action_battlers.push(iii) unless @surprise
  263.       end
  264.     end
  265.     for iii in $game_troop.members
  266.       if members.include?(iii)
  267.         @action_battlers.push(iii) unless @preemptive
  268.       end
  269.     end
  270.     @action_battlers.each {|battler| battler.make_speed }
  271.     @action_battlers.sort! {|a,b| b.speed - a.speed }
  272.   end
  273. end
  274.  
  275. #encoding:utf-8
  276. #==============================================================================
  277. # ■ Game_Battler
  278. #------------------------------------------------------------------------------
  279. #  处理战斗者的类。Game_Actor 和 Game_Enemy 类的父类。
  280. #==============================================================================
  281.  
  282. class Game_Battler < Game_BattlerBase
  283.   attr_accessor :turn_count
  284.   attr_accessor :rtab_cp
  285.   attr_accessor :cp_quota
  286.   attr_accessor :in_turn
  287.   #--------------------------------------------------------------------------
  288.   # ● 初始化对象
  289.   #--------------------------------------------------------------------------
  290.   alias neoinitialize initialize
  291.   def initialize
  292.     @turn_count = 0
  293.     @rtab_cp = 0
  294.     @cp_quota = 100
  295.     @in_turn = false
  296.     neoinitialize
  297.   end
  298.   #--------------------------------------------------------------------------
  299.   # ● 战斗开始处理
  300.   #--------------------------------------------------------------------------
  301.   def on_battle_start
  302.     @turn_count = 0
  303.     @rtab_cp = 0
  304.     @cp_quota = 100
  305.     @in_turn = false
  306.     init_tp unless preserve_tp?
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ● 处理伤害
  310.   #    调用前需要设置好
  311.   #    @result.hp_damage   @result.mp_damage
  312.   #    @result.hp_drain    @result.mp_drain
  313.   #--------------------------------------------------------------------------
  314.   def execute_damage(user)
  315.     on_damage(@result.hp_damage) if @result.hp_damage > 0
  316.     self.hp -= @result.hp_damage
  317.     self.mp -= @result.mp_damage
  318.     user.hp += @result.hp_drain
  319.     user.mp += @result.mp_drain
  320.     # 受伤后计算CP退后量
  321.     cpback = @result.hp_damage + @result.mp_damage
  322.     cpback = (cpback < 0 ? 0 : cpback)
  323.     pent = 100.0 * cpback / self.mhp
  324.     cppentback = ((5 + pent / 10) * self.cp_quota / 100).to_i
  325.     @rtab_cp -= cppentback
  326.     @rtab_cp = (@rtab_cp < 0 ? 0 : @rtab_cp)
  327.   end
  328.   #--------------------------------------------------------------------------
  329.   # ● 判定是否可以输入指令
  330.   #--------------------------------------------------------------------------
  331.   def inputable?
  332.     normal? && !auto_battle? && @in_turn
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ● 回合结束处理
  336.   #--------------------------------------------------------------------------
  337.   def on_turn_end
  338.     @result.clear
  339.     regenerate_all
  340.     update_state_turns
  341.     update_buff_turns
  342.     remove_states_auto(2)
  343.     # 该角色的回合计数加1并清空CP
  344.     @turn_count += 1
  345.     @rtab_cp = 0
  346.   end
  347. end
  348.  
  349. #encoding:utf-8
  350. #==============================================================================
  351. # ■ Game_Troop
  352. #------------------------------------------------------------------------------
  353. #  管理敌群和战斗相关资料的类,也可执行如战斗事件管理之类的功能。
  354. #   本类的实例请参考 $game_troop 。
  355. #==============================================================================
  356.  
  357. class Game_Troop < Game_Unit
  358.   #--------------------------------------------------------------------------
  359.   # ● 增加回合
  360.   #--------------------------------------------------------------------------
  361.   def increase_turn(members)
  362.     troop.pages.each {|page| @event_flags[page] = false if page.span == 1 }
  363.     turnmax = []
  364.     for iii in members
  365.       turnmax.push(iii.turn_count)
  366.     end
  367.     @turn_count = turnmax.max
  368.   end
  369. end
  370.  
  371. #encoding:utf-8
  372. #==============================================================================
  373. # ■ Spriteset_Battle
  374. #------------------------------------------------------------------------------
  375. #  处理战斗画面的精灵的类。本类在 Scene_Battle 类的内部使用。
  376. #==============================================================================
  377.  
  378. class Spriteset_Battle
  379.   attr_accessor :icons
  380.   attr_accessor :cp_quota
  381.   #--------------------------------------------------------------------------
  382.   # ● 初始化对象
  383.   #--------------------------------------------------------------------------
  384.   def initialize
  385.     @cp_quota = 100
  386.     create_viewports
  387.     create_battleback1
  388.     create_battleback2
  389.     create_enemies
  390.     create_actors
  391.     create_pictures
  392.     create_timer
  393.     create_rtabcp_gauge
  394.     update
  395.   end
  396.   #--------------------------------------------------------------------------
  397.   # ● 生成战斗CP条
  398.   #--------------------------------------------------------------------------
  399.   def create_rtabcp_gauge
  400.     @cpgauge_back= Sprite.new(@viewport3)
  401.     @cpgauge_back.bitmap = Bitmap.new(400, 8)
  402.     @cpgauge_back.bitmap.gradient_fill_rect(0, 0, 400, 16, Color.new(0, 255, 0), Color.new(255, 0, 0))
  403.     @cpgauge_back.x = 16
  404.     @cpgauge_back.y = 16
  405.     # 为战斗中的各个角色生成其图标
  406.     @icons = {}
  407.     for iii in $game_party.members
  408.       @icons[iii] = Sprite.new(@viewport3)
  409.       @icons[iii].bitmap = Bitmap.new("Graphics/System/bicon1.png")
  410.       @icons[iii].ox = 12
  411.       @icons[iii].oy = 12
  412.       @icons[iii].x = 16
  413.       @icons[iii].y = 20
  414.     end
  415.     for iii in $game_troop.members
  416.       @icons[iii] = Sprite.new(@viewport3)
  417.       @icons[iii].bitmap = Bitmap.new("Graphics/System/bicon2.png")
  418.       @icons[iii].ox = 12
  419.       @icons[iii].oy = 12
  420.       @icons[iii].x = 16
  421.       @icons[iii].y = 20
  422.     end
  423.   end
  424.   #--------------------------------------------------------------------------
  425.   # ● 释放
  426.   #--------------------------------------------------------------------------
  427.   def dispose
  428.     dispose_battleback1
  429.     dispose_battleback2
  430.     dispose_enemies
  431.     dispose_actors
  432.     dispose_pictures
  433.     dispose_timer
  434.     dispose_viewports
  435.     dispose_rtabcp_gauge
  436.   end
  437.   #--------------------------------------------------------------------------
  438.   # ● 消灭战斗CP条
  439.   #--------------------------------------------------------------------------
  440.   def dispose_rtabcp_gauge
  441.     @cpgauge_back.bitmap.dispose
  442.     @cpgauge_back.dispose
  443.     for iii in $game_party.members
  444.       @icons[iii].bitmap.dispose
  445.       @icons[iii].dispose
  446.     end
  447.     for iii in $game_troop.members
  448.       @icons[iii].bitmap.dispose
  449.       @icons[iii].dispose
  450.     end
  451.   end
  452.   #--------------------------------------------------------------------------
  453.   # ● 更新画面
  454.   #--------------------------------------------------------------------------
  455.   def update
  456.     update_battleback1
  457.     update_battleback2
  458.     update_enemies
  459.     update_actors
  460.     update_cp
  461.     update_pictures
  462.     update_timer
  463.     update_viewports
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ● 更新CP条
  467.   #--------------------------------------------------------------------------
  468.   def update_cp
  469.     for iii in $game_party.members + $game_troop.members
  470.       @icons[iii].x = 16 + 400 * iii.rtab_cp / @cp_quota
  471.       @icons[iii].visible = iii.alive?
  472.     end
  473.   end
  474. end

作者: VIPArcher    时间: 2014-8-10 16:16
401 行改成 @cpgauge_back.bitmap = Bitmap.new("Graphics/System/boom.png")
删掉402行
未测试
作者: fox1313304    时间: 2014-8-11 12:00

  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 [email protected]     
  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 [email protected]
  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
复制代码

作者: fox1313304    时间: 2014-8-11 12:11
我把自己的行动条素材拉长到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 (7.19 KB, 下载次数: 18)

QQ图片20140811120846.jpg

作者: VIPArcher    时间: 2014-8-11 12:47
本帖最后由 VIPArcher 于 2014-8-11 16:14 编辑

那你就这么改试试,不要删掉那几句
改成这样
你复制这个进去试一下
你要的是这样的效果吧?
我没出现你说的情况


作者: fox1313304    时间: 2014-8-11 13:04
  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 改成这样 好了 行动条有了 接下来就是血条不见了的问题…………救命




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1