Project1

标题: 这套战斗中显示角色战斗图的脚本如何可以显示五人以上? [打印本页]

作者: hcm    时间: 2013-12-29 10:39
标题: 这套战斗中显示角色战斗图的脚本如何可以显示五人以上?
如下脚本,只能显示四人的战斗图,第五人以上会空着,
我查看过全部但是没发现有关于人数的限定的脚本。
请问如何解决?
  1. #==============================================================================
  2. # +++ MOG - ACTOR PICTURE CM  (v1.3) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com/
  6. #==============================================================================
  7. # Apresenta a imagem do personagem durante a seleção de comandos, com efeitos
  8. # animados.
  9. #==============================================================================
  10. # ● Definindo o nome das imagens dos battlers.
  11. #==============================================================================
  12. # 1 - As imagens devem ser gravadas na pasta
  13. #
  14. # GRAPHICS/PICTURES
  15. #
  16. # 2 - Nomeie os  arquivos de imagens da seguinte forma.
  17. #
  18. #
  19. # ACTOR + ID
  20. #
  21. # EG
  22. #
  23. # ACTOR1.png
  24. #
  25. #==============================================================================

  26. #==============================================================================
  27. # ● Histórico (Version History)
  28. #==============================================================================
  29. # v 1.3 - Melhoria na codificação.
  30. # v 1.2 - Ajuste automático da imagem do battler.
  31. # v 1.1 - Correção do bug de não apagar a imagem quando o battler usa
  32. #         ações de que acertam todos os alvos.
  33. #==============================================================================

  34. module MOG_ACTOR_PICTURE_CM
  35.   #Posição da imagem do battler. (Para fazer ajustes)
  36.   PICTURE_POSITION = [0, 0]  
  37.   
  38.   #Definição da opacidade da imagem.
  39.   PICTURE_OPACITY = 255
  40.   
  41.   #Velocidade de deslize
  42.   SLIDE_SPEED = 30  
  43.   
  44.   #Ativar o efeito da imagem respirando.
  45.   BREATH_EFFECT = true
  46.   
  47.   #Definição da prioridade  da imagem na tela.
  48.   PICTURE_PRIORITY_Z = 103
  49. end

  50. #===============================================================================
  51. # ■ Sprite_Battler_CM
  52. #===============================================================================
  53. class Sprite_Battler_CM < Sprite
  54.   include MOG_ACTOR_PICTURE_CM
  55.   
  56.   #--------------------------------------------------------------------------
  57.   # ● Initialize
  58.   #--------------------------------------------------------------------------  
  59.   def initialize(viewport = nil,battler_id = -1)
  60.       super(viewport)
  61.       filename = "Actor" + battler_id.to_s
  62.       self.bitmap = Cache.picture(filename) rescue nil
  63.       self.bitmap = Cache.picture("") if self.bitmap == nil
  64.       sc = (544 / 2)  - (self.bitmap.width / 2) + PICTURE_POSITION[0]
  65.       @size = [self.bitmap.width + PICTURE_POSITION[0] ,sc]      
  66.       self.visible = false
  67.       self.opacity = 0
  68.       self.z = PICTURE_PRIORITY_Z
  69.       self.ox = 0
  70.       self.oy = self.bitmap.height
  71.       self.x = -@size[0]
  72.       self.y = (Graphics.height + 10) + PICTURE_POSITION[1]      
  73.       @breach_effect = [1.0,0]
  74.       @battler_id = battler_id
  75.       @active =  false
  76.       @cm_visible = false
  77.   end  
  78.   
  79.   #--------------------------------------------------------------------------
  80.   # ● Dispose
  81.   #--------------------------------------------------------------------------  
  82.   def dispose
  83.       super
  84.       self.bitmap.dispose
  85.   end
  86.   
  87.   #--------------------------------------------------------------------------
  88.   # ● Update
  89.   #--------------------------------------------------------------------------  
  90.   def update
  91.       super
  92.       update_slide
  93.   end  
  94.   
  95.   #--------------------------------------------------------------------------
  96.   # ● Active Battler
  97.   #--------------------------------------------------------------------------      
  98.   def active_battler(battler_id)
  99.       @active = @battler_id == battler_id ? true : false
  100.       self.visible = true if @active
  101.       @cm_visible = false if !@active
  102.   end
  103.   
  104.   #--------------------------------------------------------------------------
  105.   # ● Refresh Battler CM
  106.   #--------------------------------------------------------------------------        
  107.   def refresh_battler(cm_visible, battler_index)
  108.       @cm_visible = cm_visible
  109.       active_battler(battler_index)
  110.   end  
  111.   
  112.   #--------------------------------------------------------------------------
  113.   # ● Update Slide
  114.   #--------------------------------------------------------------------------  
  115.   def update_slide
  116.       if !@cm_visible
  117.            self.x -= SLIDE_SPEED if self.x > -@size[0]
  118.            self.opacity -= 25
  119.            if self.x <= -@size[0] or self.opacity == 0
  120.               self.visible = false
  121.               self.opacity = 0
  122.               self.x = -@size[0]
  123.            end   
  124.         else
  125.            self.x += SLIDE_SPEED if self.x < @size[1]
  126.            self.x = @size[1] if self.x > @size[1]
  127.            self.opacity += 10 if self.opacity < PICTURE_OPACITY
  128.            self.opacity = PICTURE_OPACITY if self.opacity > PICTURE_OPACITY
  129.            update_breath_effect
  130.       end         
  131.   end
  132.   
  133.   #--------------------------------------------------------------------------
  134.   # ● Update Breath Effect
  135.   #--------------------------------------------------------------------------   
  136.   def update_breath_effect
  137.       return if !BREATH_EFFECT
  138.       @breach_effect[1] += 1
  139.       case @breach_effect[1]
  140.          when 0..30
  141.              @breach_effect[0] += 0.0004
  142.          when 31..50
  143.              @breach_effect[0] -= 0.0004
  144.          else  
  145.          @breach_effect[1] = 0
  146.          @breach_effect[0] = 1.truncate
  147.       end
  148.       self.zoom_y = @breach_effect[0]
  149.   end  
  150.   
  151. end

  152. #===============================================================================
  153. # ■ Spriteset_Battle
  154. #===============================================================================
  155. class Spriteset_Battle
  156.   
  157.   #--------------------------------------------------------------------------
  158.   # ● Create Actors
  159.   #--------------------------------------------------------------------------   
  160.   alias mog_battler_cm_create_actors create_actors
  161.   def create_actors
  162.       mog_battler_cm_create_actors
  163.       create_battler_pictures
  164.   end
  165.   
  166.   #--------------------------------------------------------------------------
  167.   # ● Dispose
  168.   #--------------------------------------------------------------------------   
  169.   alias mog_battler_cm_dispose dispose
  170.   def dispose
  171.       mog_battler_cm_dispose
  172.       dispose_battler_cm
  173.   end  

  174.   #--------------------------------------------------------------------------
  175.   # ● Update
  176.   #--------------------------------------------------------------------------   
  177.   alias mog_battler_cm_update update
  178.   def update
  179.       mog_battler_cm_update
  180.       update_battler_cm
  181.   end   

  182.   #--------------------------------------------------------------------------
  183.   # ● Create Battler Pictures
  184.   #--------------------------------------------------------------------------   
  185.   def create_battler_pictures
  186.       @battler_pictures = []
  187.       for i in $game_party.battle_members
  188.           @battler_pictures.push(Sprite_Battler_CM.new(@viewport1,i.id))
  189.       end   
  190.   end   
  191.   
  192.   #--------------------------------------------------------------------------
  193.   # ● Dispose Battler CM
  194.   #--------------------------------------------------------------------------   
  195.   def dispose_battler_cm
  196.       return if @battler_pictures == nil
  197.       @battler_pictures.each {|sprite| sprite.dispose }
  198.   end  

  199.   #--------------------------------------------------------------------------
  200.   # ● Update Battler CM
  201.   #--------------------------------------------------------------------------   
  202.   def update_battler_cm
  203.       return if @battler_pictures == nil
  204.       @battler_pictures.each {|sprite| sprite.update }
  205.   end   
  206.      
  207.   #--------------------------------------------------------------------------
  208.   # ● Update CM Pictures
  209.   #--------------------------------------------------------------------------      
  210.   def update_cm_picture(cm_visible, battler_index)
  211.       return if @battler_pictures == nil
  212.       @battler_pictures.each {|sprite| sprite.refresh_battler(cm_visible, battler_index) }
  213.   end  
  214.   
  215. end

  216. #===============================================================================
  217. # ■ Scene_Battle
  218. #===============================================================================
  219. class Scene_Battle < Scene_Base
  220.   
  221.   #--------------------------------------------------------------------------
  222.   # ● Update
  223.   #--------------------------------------------------------------------------        
  224.   alias mog_cm_picture_update update
  225.   def update
  226.       mog_cm_picture_update  
  227.       update_picture_visible
  228.   end  
  229.   
  230.   #--------------------------------------------------------------------------
  231.   # ● Update Battler CM Active
  232.   #--------------------------------------------------------------------------      
  233.   def update_picture_visible
  234.       return if @actor_command_window == nil
  235.       cm_visible = can_cm_picture_visible?      
  236.       cm_id = BattleManager.actor.id rescue -1
  237.       @spriteset.update_cm_picture(cm_visible, cm_id)
  238.   end  
  239.   
  240.   #--------------------------------------------------------------------------
  241.   # ● Can CM Picture Visible
  242.   #--------------------------------------------------------------------------        
  243.   def can_cm_picture_visible?
  244.       return false if (@actor_window.active or @enemy_window.active) rescue return
  245.       return false if BattleManager.actor == nil      
  246.       return true
  247.   end  
  248.   
  249.   #--------------------------------------------------------------------------
  250.   # ● Execute Action
  251.   #--------------------------------------------------------------------------        
  252.   alias mog_cm_picture_execute_action execute_action
  253.   def execute_action
  254.       @spriteset.update_cm_picture(false, -1) if @spriteset != nil
  255.       mog_cm_picture_execute_action
  256.   end
  257.   
  258. end

  259. $mog_rgss3_actor_picture_cm = true
复制代码

作者: fux2    时间: 2013-12-29 11:52
注意193行,取的是battle_members,可参战人员,去改改吧。
作者: hcm    时间: 2013-12-29 12:51
fux2 发表于 2013-12-29 11:52
注意193行,取的是battle_members,可参战人员,去改改吧。

试过了。不行。




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