设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1541|回复: 4
打印 上一主题 下一主题

[已经解决] 默认系统战斗中怎么选择敌人时让敌人白闪烁?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
48 小时
注册时间
2009-5-16
帖子
16
跳转到指定楼层
1
发表于 2014-5-19 19:15:26 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
就是选择敌人A时,敌人不停闪烁,选择敌人B时敌人A闪烁停止,敌人B不停闪烁...有这样的脚本吗?smi24|

Lv2.观梦者 (暗夜天使)

卑微的梦

梦石
0
星屑
517
在线时间
820 小时
注册时间
2013-2-23
帖子
1185

短篇九勇士组季军

2
发表于 2014-5-19 19:19:59 | 只看该作者
  1. #==============================================================================
  2. # +++ MOG - Battle Cursor (1.2) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com/
  6. #==============================================================================
  7. # Sistema de cursor animado de batalha nos sprites dos battlers.
  8. #==============================================================================
  9. # Arquivo necessário. (Graphics/System)
  10. #
  11. # Battle_Cursor.png
  12. #
  13. #==============================================================================

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

  29. $imported = {} if $imported.nil?
  30. $imported[:mog_battle_cursor] = true

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

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

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

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

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

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

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

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

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

  286. end

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

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

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

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

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

  347.   #--------------------------------------------------------------------------
  348.   # ● Hide
  349.   #--------------------------------------------------------------------------
  350.   alias mog_battle_cursor_hide hide
  351.   def hide
  352.       if @info_viewport
  353.           $game_temp.battle_cursor[2] = false
  354.       end
  355.       mog_battle_cursor_hide
  356.   end  
  357.   
  358. end
复制代码
上传的附件放到Graphics/System文件夹里。

Battle_Cursor.png (5.98 KB, 下载次数: 33)

Battle_Cursor.png

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
48 小时
注册时间
2009-5-16
帖子
16
3
 楼主| 发表于 2014-5-19 19:34:09 | 只看该作者
亲,第285行报错从[/url] != last_index之后就都是红色的了。。。能帮我看看吗?smi24|

点评

因为论坛的@功能,所以只要有@的地方会自动生成一段代码,只要按照楼下的改就行了  发表于 2014-5-19 19:41
回复 支持 反对

使用道具 举报

david_ng223 该用户已被删除
4
发表于 2014-5-19 19:39:34 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
48 小时
注册时间
2009-5-16
帖子
16
5
 楼主| 发表于 2014-5-19 19:57:53 | 只看该作者
谢谢两位帮忙~发现一个问题是286行,当if @Index != last_index后   Sound.play_cursor这个音效就不停播放,而不是像原版只播放一次,问题在哪里呢smi24|

点评

现在好了,找到原因了,把283,284行改成原版的就可以了~  发表于 2014-5-19 20:45
不停地播放?  发表于 2014-5-19 20:36
还是不行...问题依然存在,我找了下Sound.play_cursor用在其他地方,格式都没错,头大了  发表于 2014-5-19 20:16
删掉第285行试试看  发表于 2014-5-19 20:10
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-25 11:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表