查看: 4447|回复: 19

[已经解决] 横版战斗如何加入血条和指针

[复制链接]
梦石
0
星屑
50
在线时间
33 小时
注册时间
2011-4-4
回帖
21
发表于 2013-11-1 14:44:59 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 q577757 于 2013-11-4 15:36 编辑

怎么在每个战斗行走图脚下加一个血条?
战斗下方框框内选取敌人如何变为 指针选取敌人,在要选的敌人行走图前面加个箭头或者让选择的敌人身体变亮一些
梦石
0
星屑
3348
在线时间
1120 小时
注册时间
2009-4-15
回帖
761
发表于 2013-11-1 15:00:49 | 显示全部楼层
这个……这个……
第一个血条脚本蛮多地方有的,随便挑个给你吧。http://rpg.blue/thread-252003-1-1.html
第二个可以使用http://www.66rpg.com/articles/5129里的第四个脚本,这个是高亮显示被选中敌人的。
箭头的脚本我正好有,但是贴出来好长啊,俺不会改成滚动的。

评分

参与人数 1星屑 +150 收起 理由
Sion + 150 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
199
在线时间
248 小时
注册时间
2012-4-29
回帖
313
发表于 2013-11-1 15:25:36 | 显示全部楼层
tan12345 发表于 2013-11-1 15:00
这个……这个……
第一个血条脚本蛮多地方有的,随便挑个给你吧。http://rpg.blue/thread-252003-1-1. ...

同求箭头选定敌人!!!
你的意思就是要打架咯?
回复

使用道具 举报

梦石
0
星屑
50
在线时间
33 小时
注册时间
2011-4-4
回帖
21
 楼主| 发表于 2013-11-1 15:29:07 | 显示全部楼层
tan12345 发表于 2013-11-1 15:00
这个……这个……
第一个血条脚本蛮多地方有的,随便挑个给你吧。http://rpg.blue/thread-252003-1-1. ...

偶去试试
回复

使用道具 举报

梦石
0
星屑
3348
在线时间
1120 小时
注册时间
2009-4-15
回帖
761
发表于 2013-11-1 15:34:34 | 显示全部楼层
魔力的觉醒 发表于 2013-11-1 15:25
同求箭头选定敌人!!!

MOG有脚本是箭头的,MOG_Battle_Cursor这个脚本就是在战斗时可以用箭头选择敌人,不过他的箭头在底部,可以通过设定改到左边或右边,我的脚本是基于他这个的脚本上改的,加了好多自己的元素,不太适合通用……
回复

使用道具 举报

梦石
0
星屑
50
在线时间
33 小时
注册时间
2011-4-4
回帖
21
 楼主| 发表于 2013-11-1 15:39:42 | 显示全部楼层
本帖最后由 q577757 于 2013-11-1 15:41 编辑
tan12345 发表于 2013-11-1 15:00
这个……这个……
第一个血条脚本蛮多地方有的,随便挑个给你吧。http://rpg.blue/thread-252003-1-1. ...


第一个是有血条 但是在横版系统下出现错误。。。
提示战斗显示血条第45行错误
#--------------------------------------------------------------------------
  # ● 生成位图
  #--------------------------------------------------------------------------
  def create_bitmap
    @last_hp = @battler.hp
    bw = 96
    bh = 6
    self.bitmap = Bitmap.new(bw, bh)
    self.bitmap.fill_rect(0, 0, bw, bh, Color.new(32,32,64))
45 if Freya::Gauge_Type.nil? or Freya::Gauge_Type == 0
      hp = ((bw) * @battler.hp_rate).to_i
      self.bitmap.gradient_fill_rect(0, 0, hp, bh, Freya::EnemyHPGa

第二个指针是脸图战斗专用的。。。
回复

使用道具 举报

梦石
0
星屑
199
在线时间
248 小时
注册时间
2012-4-29
回帖
313
发表于 2013-11-1 15:49:21 | 显示全部楼层
本帖最后由 魔力的觉醒 于 2013-11-1 15:50 编辑
tan12345 发表于 2013-11-1 15:34
MOG有脚本是箭头的,MOG_Battle_Cursor这个脚本就是在战斗时可以用箭头选择敌人,不过他的箭头在底部,可 ...


请问是这个吗? 我插进去 没效果怎么回事!!
  1. #==============================================================================
  2. # +++ MOG - Animated Cursor (V1.2) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]http://www.atelier-rgss.com/[/url]
  6. #==============================================================================
  7. # Adiciona um cursor animado nos menus de comandos.
  8. #==============================================================================
  9. # Será necessário ter a imagem
  10. #
  11. # Menu_Cursor.png
  12. #
  13. # gravado na pasta GRAPHICS/SYSTEM/
  14. #==============================================================================
  15. # Ativando a animação do cursor
  16. #
  17. # Basta criar uma imagem que tenha a largura com no minimo o dobro de altura da
  18. # imagem do cursor.
  19. #
  20. # EX
  21. # largura 32 pixel (width) altura 32 pixel = 1 frames de animação.(Sem animação)
  22. # largura 64 pixel (width) altura 32 pixel = 2 frames de animação.
  23. # largura 128 pixel (width) altura 32 pixel = 4 frames de animação.
  24. # largura 256 pixel (width) altura 32 pixel = 8 frames de animação
  25. # Etc...
  26. #
  27. # NOTA
  28. # Não há limite para quantidade de frames de animação, se não quiser a animação
  29. # basta criar uma imagem com a altura proporcional a largura da imagem.
  30. #
  31. #==============================================================================
  32. # ● Histórico (Version History)
  33. #==============================================================================
  34. # v 1.1 - Correção da posição do cursor na cena de batalha.
  35. #==============================================================================

  36. module MOG_MENU_CURSOR
  37.   #Ativar animação do cursor se movimentando para os lados.
  38.   SIDE_ANIMATION = true
  39.   #Definição da posição do cursor. (Ajustes na posição)
  40.   CURSOR_POSITION = [0,0]
  41.   #Definição da velocidade da animação de frames.
  42.   CURSOR_ANIMATION_SPEED = 6
  43. end

  44. #==============================================================================
  45. # ■ Game_System
  46. #==============================================================================
  47. class Game_System
  48.   
  49.   attr_accessor :menu_cursor_name
  50.   
  51.   #--------------------------------------------------------------------------
  52.   # ● Initialize
  53.   #--------------------------------------------------------------------------      
  54.   alias mog_menu_cursor_initialize initialize
  55.   def initialize
  56.       mog_menu_cursor_initialize
  57.       @menu_cursor_name = "Menu_Cursor"
  58.   end  
  59.   
  60. end  

  61. #==============================================================================
  62. # ■ Game_Temp
  63. #==============================================================================
  64. class Game_Temp
  65.   
  66.   attr_accessor :menu_cursor   
  67.    
  68.   #--------------------------------------------------------------------------
  69.   # ● Initialize
  70.   #--------------------------------------------------------------------------      
  71.   alias mog_cursor_sprite_initialize initialize
  72.   def initialize
  73.       mog_cursor_sprite_initialize
  74.       @menu_cursor = [false,0,0,0]
  75.   end  
  76.   
  77. end  

  78. #==============================================================================
  79. # ■ Sprite Cursor
  80. #==============================================================================
  81. class Sprite_Cursor < Sprite
  82.   
  83.   include MOG_MENU_CURSOR
  84.   
  85.   #--------------------------------------------------------------------------
  86.   # ● Initialize
  87.   #--------------------------------------------------------------------------   
  88.   def initialize(viewport = nil , x , y)
  89.       super(viewport)
  90.       @cursor_image = Cache.system($game_system.menu_cursor_name.to_s)
  91.       @frame_max = (@cursor_image.width / @cursor_image.height) rescue 1
  92.       @frame_range = @frame_max > 0 ? (@cursor_image.width  / @frame_max) : 1
  93.       @frame = 0
  94.       @ca_speed = CURSOR_ANIMATION_SPEED
  95.       self.bitmap = Bitmap.new(@frame_range,@frame_range)
  96.       self.z = 10000
  97.       self.opacity = 0
  98.       @cw = self.bitmap.width / 2
  99.       @c_p = [-@cw + CURSOR_POSITION[0],CURSOR_POSITION[1]]
  100.       [url=home.php?mod=space&uid=287812]@mx[/url] = [0,0,0]
  101.       refresh_animation(true)
  102.       update_move
  103.   end
  104.   
  105.   #--------------------------------------------------------------------------
  106.   # ● Dispose
  107.   #--------------------------------------------------------------------------   
  108.   def dispose
  109.       self.bitmap.dispose
  110.       self.bitmap = nil
  111.       @cursor_image.dispose
  112.       super
  113.   end  
  114.   
  115.   #--------------------------------------------------------------------------
  116.   # ● Update
  117.   #--------------------------------------------------------------------------  
  118.   def update
  119.       if cursor_visible?
  120.          self.visible = true
  121.          update_move
  122.          refresh_animation(false)
  123.       else   
  124.          self.visible = false
  125.       end  
  126.   end

  127.   #--------------------------------------------------------------------------
  128.   # ● Initialize
  129.   #--------------------------------------------------------------------------      
  130.   def refresh_animation(start = false)
  131.       @ca_speed += 1
  132.       return if @frame_max == 1 and !start
  133.       return if @ca_speed < CURSOR_ANIMATION_SPEED
  134.       @ca_speed = 0
  135.       self.bitmap.clear
  136.       scr_rect = Rect.new(@frame_range * @frame,0,@frame_range,@frame_range)
  137.       self.bitmap.blt(0,0,@cursor_image, scr_rect)
  138.       @frame += 1
  139.       @frame = 0 if @frame >= @frame_max
  140.   end  
  141.    
  142.   #--------------------------------------------------------------------------
  143.   # ● Cursor Visible?
  144.   #--------------------------------------------------------------------------   
  145.   def cursor_visible?
  146.       px = $game_temp.menu_cursor[2]
  147.       py = $game_temp.menu_cursor[3]
  148.       return false if $game_temp.menu_cursor[1] == 0
  149.       return false if px < 0 or py < 0 or (px == 0 and py == 0)
  150.       return true
  151.   end  
  152.   
  153.   #--------------------------------------------------------------------------
  154.   # ● Update Move
  155.   #--------------------------------------------------------------------------   
  156.   def update_move
  157.       self.opacity += 25
  158.       @new_pos = [$game_temp.menu_cursor[2],$game_temp.menu_cursor[3]]
  159.       execute_animation_s
  160.       execute_move(0,self.x, @new_pos[0] + @mx[1] + @c_p[0])
  161.       execute_move(1,self.y, @new_pos[1] + @c_p[1])
  162.   end  
  163.   
  164.   #--------------------------------------------------------------------------
  165.   # ● Execute Animation S
  166.   #--------------------------------------------------------------------------      
  167.   def execute_animation_s
  168.       return if !SIDE_ANIMATION
  169.       @mx[2] += 1
  170.       return if @mx[2] < 4
  171.       @mx[2] = 0
  172.       @mx[0] += 1
  173.       case @mx[0]
  174.          when 1..7;  @mx[1] += 1            
  175.          when 8..14; @mx[1] -= 1
  176.          else
  177.            @mx[0] = 0
  178.            @mx[1] = 0
  179.       end
  180.   end
  181.   
  182.   #--------------------------------------------------------------------------
  183.   # ● Execute Move
  184.   #--------------------------------------------------------------------------      
  185.   def execute_move(type,cp,np)
  186.       sp = 5 + ((cp - np).abs / 5)
  187.       if cp > np
  188.          cp -= sp
  189.          cp = np if cp < np
  190.       elsif cp < np
  191.          cp += sp
  192.          cp = np if cp > np
  193.       end     
  194.       self.x = cp if type == 0
  195.       self.y = cp if type == 1
  196.   end  
  197.   
  198. end

  199. #==============================================================================
  200. # ■ CURSOR_MENU SPRITE
  201. #==============================================================================
  202. module CURSOR_MENU_SPRITE
  203.   
  204.   #--------------------------------------------------------------------------
  205.   # ● Cursor Sprite Enable
  206.   #--------------------------------------------------------------------------      
  207.   def cursor_sprite_enable
  208.       return if self.index == nil rescue return
  209.       create_cursor_sprite
  210.       update_cursor_sprite
  211.       update_cusor_position
  212.       if !self.active
  213.          $game_temp.menu_cursor[1] -= 1 if $game_temp.menu_cursor[1] > 0
  214.       end
  215.   end
  216.    
  217.   #--------------------------------------------------------------------------
  218.   # ● Create Cursor Sprite
  219.   #--------------------------------------------------------------------------   
  220.   def create_cursor_sprite
  221.       return if @cursor != nil
  222.       return if $game_temp.menu_cursor[0]
  223.       $game_temp.menu_cursor[0] = true
  224.       reset_cursor_position
  225.       @cursor = Sprite_Cursor.new(nil,x,y)
  226.       @cursor_name = $game_system.menu_cursor_name
  227.   end   
  228.   
  229.   #--------------------------------------------------------------------------
  230.   # ● Dispose Cursor Sprite
  231.   #--------------------------------------------------------------------------      
  232.   def dispose_cursor_sprite
  233.       return if @cursor == nil
  234.       $game_temp.menu_cursor[0] = false
  235.       reset_cursor_position
  236.       @cursor.dispose
  237.       @cursor = nil
  238.   end  

  239.   #--------------------------------------------------------------------------
  240.   # ● Reset Cursor Position
  241.   #--------------------------------------------------------------------------        
  242.   def reset_cursor_position
  243.       $game_temp.menu_cursor[1] = 0
  244.       $game_temp.menu_cursor[2] = -32
  245.       $game_temp.menu_cursor[3] = -32
  246.   end  
  247.   
  248.   #--------------------------------------------------------------------------
  249.   # ● Update Cursor
  250.   #--------------------------------------------------------------------------         
  251.   def update_cursor_sprite
  252.       return if @cursor == nil
  253.       @cursor.update
  254.       refresh_cursor_sprite if @cursor_name != $game_system.menu_cursor_name
  255.   end
  256.   
  257.   #--------------------------------------------------------------------------
  258.   # ● Refresh Cursor Sprite
  259.   #--------------------------------------------------------------------------            
  260.   def refresh_cursor_sprite
  261.       @cursor_name = $game_system.menu_cursor_name
  262.       dispose_cursor_sprite
  263.       create_cursor_sprite
  264.   end  
  265.   
  266.   #--------------------------------------------------------------------------
  267.   # ● Update Cursor Position
  268.   #--------------------------------------------------------------------------         
  269.   def update_cusor_position
  270.       return if !can_update_cursor_position?
  271.       x_v = [0,0]
  272.       if SceneManager.scene_is?(Scene_Battle)
  273.           if self.viewport != nil
  274.              x_v = [-self.viewport.ox, self.viewport.rect.y]
  275.           end
  276.       end      
  277.       x_e = (self.cursor_rect.x + self.x) - self.ox
  278.       $game_temp.menu_cursor[2] = x_e + x_v[0]
  279.       y_e = (self.cursor_rect.y + self.y + self.cursor_rect.height / 2) - self.oy
  280.       $game_temp.menu_cursor[3] = y_e + x_v[1]
  281.       $game_temp.menu_cursor[1] = 13
  282.    end
  283.    
  284.   #--------------------------------------------------------------------------
  285.   # ● Can Update Cursor
  286.   #--------------------------------------------------------------------------            
  287.    def can_update_cursor_position?
  288.        return false if !self.active     
  289.        return false if self.index < 0
  290.        return false if !self.visible
  291.        return true
  292.    end  

  293. end

  294. #==============================================================================
  295. # ■ Window Base
  296. #==============================================================================
  297. class Window_Base < Window
  298.   include CURSOR_MENU_SPRITE
  299.   
  300.   #--------------------------------------------------------------------------
  301.   # ● Dispose
  302.   #--------------------------------------------------------------------------              
  303.   alias mog_menu_cursor_base_dispose dispose
  304.   def dispose
  305.       mog_menu_cursor_base_dispose
  306.       dispose_cursor_sprite
  307.   end  

  308.   #--------------------------------------------------------------------------
  309.   # ● Update
  310.   #--------------------------------------------------------------------------              
  311.   alias mog_cursor_update update
  312.   def update
  313.       mog_cursor_update
  314.       cursor_sprite_enable
  315.   end   
  316.   
  317. end

  318. $mog_rgss3_animated_cursor = true
复制代码
你的意思就是要打架咯?
回复

使用道具 举报

梦石
0
星屑
3348
在线时间
1120 小时
注册时间
2009-4-15
回帖
761
发表于 2013-11-1 15:51:42 | 显示全部楼层
q577757 发表于 2013-11-1 15:39
第一个是有血条 但是在横版系统下出现错误。。。
提示战斗显示血条第45行错误
#----------------------- ...

指针那个,你用MOG的脚本吧,有范例但是一时找不到了,范例里脚本名MOG_Battle_Cursor就是指针,可以独立使用。
血条的话站里很多,你搜一下自己挑选吧……甚至MOG里都有血条,也是可以直接独立使用的
回复

使用道具 举报

梦石
0
星屑
3348
在线时间
1120 小时
注册时间
2009-4-15
回帖
761
发表于 2013-11-1 15:57:56 | 显示全部楼层
魔力的觉醒 发表于 2013-11-1 15:49
请问是这个吗? 我插进去 没效果怎么回事!!#======================================================= ...

是这个,至于没效果,我只能说你用的脚本太多了……
你要测试效果很简单,新建个空白的系统,把这个脚本放到main前面,然后把图片也拷贝到相应文件夹,然后战斗,效果就出来了。图片是我自己改动后的效果……
未命名.JPG
回复

使用道具 举报

梦石
0
星屑
199
在线时间
248 小时
注册时间
2012-4-29
回帖
313
发表于 2013-11-1 16:01:46 | 显示全部楼层
tan12345 发表于 2013-11-1 15:57
是这个,至于没效果,我只能说你用的脚本太多了……
你要测试效果很简单,新建个空白的系统,把这个脚本 ...

好吧好吧!!!我的离狂拽炫酷吊炸天永远那么远!!谢谢帮忙啊!
你的意思就是要打架咯?
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部