查看: 1858|回复: 1

[已经解决] MOG Scope 脚本该如何使用?

[复制链接]
梦石
0
星屑
118
在线时间
197 小时
注册时间
2011-1-23
回帖
28
发表于 2016-2-10 23:29:44 | 显示全部楼层 |阅读模式

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

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

×
虽然明白功能是让技能和攻击有范围 使敌人有前后远近的效果
但不知道具体该怎么使用
  1. #==============================================================================
  2. # +++ MOG - Scope EX (v1.5) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]https://atelierrgss.wordpress.com/[/url]
  6. #==============================================================================
  7. # Adiciona a característica de área de impacto da ação baseado na posição
  8. # e o tamanho do sprite do alvo.
  9. # Por exemplo, uma habilidade de explosão vai acertar apenas os inimigos que
  10. # estiverem em volta do alvo inicial.
  11. # O script adiciona também a função de incluir todos os alvos da tela, aliados
  12. # e inimigos juntos.
  13. #==============================================================================
  14. # Adicione a Tag abaixo na caixa de comentários de notas para definir a área de
  15. # impacto da habilidade.
  16. #
  17. # <Scope Range = X1 - X2 - Y1 - Y2>
  18. #
  19. #            Y1
  20. #            
  21. #       X1        X2
  22. #            
  23. #            Y2
  24. #
  25. # Ex ->      <Scope Range = 100 - 32 - 64 - 32>
  26. #
  27. #==============================================================================
  28. # Incluir todos os alvos da tela. (Inimigos e Aliados)
  29. #==============================================================================
  30. #
  31. # <All Targets>
  32. #
  33. #==============================================================================
  34. # Histórico
  35. #==============================================================================
  36. # v1.5 Correção de ativar o sistema sem fazer comentário na caixa de notas.
  37. # v1.4 Compatibilidade com MOG Sprite Actor.
  38. # v1.3 Melhoria no cálculo de área em alvos únicos.
  39. # v1.2 Melhoria no sistema de calculo baseado no tamanho do sprite.
  40. # v1.1 Possibilidade de definir a área específica para cada lado.
  41. #   
  42. #==============================================================================

  43. $imported = {} if $imported.nil?
  44. $imported[:mog_scope_ex] = true

  45. module MOG_SCOPE_EX
  46.   #============================================================================
  47.   # Definição do modo que vai ser calculado a área do alvo.
  48.   #
  49.   # 0 - Baseado apenas na posição X e Y. (ignorando o tamanho do sprite)
  50.   # 1 - Baseado na posição X e Y + o tamanho do sprite do alvo.
  51.   #     (Alvos grandes tem maior area de impacto)
  52.   #
  53.   #============================================================================
  54.   SCOPE_TYPE = 1
  55.   #============================================================================
  56.   # Definição da porcentágem total do tamanho sprite, para ser efetuado o
  57.   # calculo. (Apenas se o valor do SCOPE_TYPE estiver no 1)
  58.   # Por exemplo, definindo o valor de 100% o sistema vai considerar 100% do
  59.   # tamanho do sprite para fazer o calculo.
  60.   #============================================================================
  61.   # SPRITE_SIZE_RANGE = [WIDTH %, HEIGHT %]  
  62.   #============================================================================
  63.   SPRITE_SIZE_RANGE = [80,70]  
  64. end

  65. #==============================================================================
  66. # ■ Game Battler
  67. #==============================================================================
  68. class Game_Battler < Game_BattlerBase
  69.   attr_accessor :sprite_size
  70.   
  71.   #--------------------------------------------------------------------------
  72.   # * Initialize
  73.   #--------------------------------------------------------------------------
  74.   alias mog_scope_ex_initialize initialize
  75.   def initialize
  76.       @sprite_size = [0,0,true]
  77.       mog_scope_ex_initialize
  78.   end

  79. end

  80. #==============================================================================
  81. # ■ Sprite Battler
  82. #==============================================================================
  83. class Sprite_Battler < Sprite_Base

  84.   #--------------------------------------------------------------------------
  85.   # * Update Bitmap
  86.   #--------------------------------------------------------------------------
  87.   alias mog_scope_ex_update_bitmap update_bitmap
  88.   def update_bitmap
  89.       @battler.sprite_size = [bitmap.width,bitmap.height,true] if bitmap
  90.       mog_scope_ex_update_bitmap
  91.   end

  92. end

  93. #==============================================================================
  94. # ■ Scene Battle
  95. #==============================================================================
  96. class Scene_Battle < Scene_Base

  97.   #--------------------------------------------------------------------------
  98.   # * Show Normal Animation
  99.   #--------------------------------------------------------------------------
  100.   alias mog_scope_ex_show_normal_animation show_normal_animation
  101.   def show_normal_animation(targets, animation_id, mirror = false)
  102.       new_targets = []
  103.       targets.each do |t| new_targets.push(t) if t.sprite_size[2] end
  104.       targets = new_targets
  105.       mog_scope_ex_show_normal_animation(targets, animation_id, mirror)
  106.       targets.each do |t| t.sprite_size[2] = true end
  107.   end  
  108.   
  109. end

  110. #==============================================================================
  111. # ■ Game Action
  112. #==============================================================================
  113. class Game_Action
  114.   include MOG_SCOPE_EX
  115.   #--------------------------------------------------------------------------
  116.   # * Make Targets
  117.   #--------------------------------------------------------------------------
  118.   def make_targets
  119.       if $imported[:mog_battler_motion] != nil and $imported[:mog_sprite_actor] != nil
  120.          return @subject.pre_target if @subject != nil and @subject.pre_target != nil
  121.       end
  122.       if !forcing && subject.confusion?
  123.          confusion_target
  124.       elsif item.for_opponent?
  125.          targets_for_opponents
  126.       elsif item.for_friend?
  127.          targets_for_friends
  128.       else
  129.         []
  130.       end
  131.   end  
  132.   
  133.   #--------------------------------------------------------------------------
  134.   # * Confusion Target
  135.   #--------------------------------------------------------------------------
  136.   def confusion_target
  137.       case subject.confusion_level
  138.       when 1 ; new_targets = make_new_targets([opponents_unit.random_target],0)
  139.       when 2
  140.           if rand(2) == 0
  141.             new_targets = make_new_targets([opponents_unit.random_target],0)
  142.           else
  143.             new_targets = make_new_targets([friends_unit.random_target],1)
  144.           end
  145.       else
  146.            new_targets = make_new_targets([friends_unit.random_target],1)  
  147.       end
  148.   end
  149.   
  150.   #--------------------------------------------------------------------------
  151.   # * Targets for Opponents
  152.   #--------------------------------------------------------------------------
  153.   def targets_for_opponents
  154.       if item.for_random?
  155.          org_target = Array.new(item.number_of_targets) { opponents_unit.random_target }
  156.          new_targets = make_new_targets(org_target,0)
  157.       elsif item.for_one?
  158.          num = 1 + (attack? ? subject.atk_times_add.to_i : 0)
  159.          if @target_index < 0
  160.             org_target = [opponents_unit.random_target] * num
  161.             new_targets = make_new_targets(org_target,0)
  162.          else
  163.             org_target = [opponents_unit.smooth_target(@target_index)] * num
  164.             new_targets = make_new_targets(org_target,0)
  165.          end
  166.        else
  167.           return (opponents_unit.alive_members + friends_unit.alive_members) if all_targets
  168.           return opponents_unit.alive_members
  169.       end
  170.   end
  171.   
  172.   #--------------------------------------------------------------------------
  173.   # * All Targets
  174.   #--------------------------------------------------------------------------
  175.   def all_targets
  176.       return true if @item.object.note =~ /<All Targets>/
  177.       return false
  178.   end
  179.   
  180.   #--------------------------------------------------------------------------
  181.   # * Targets for Allies
  182.   #--------------------------------------------------------------------------
  183.   def targets_for_friends
  184.     if item.for_user?
  185.        new_targets = make_new_targets([subject],1)      
  186.     elsif item.for_dead_friend?
  187.         if item.for_one?
  188.            org_target = [friends_unit.smooth_dead_target(@target_index)]
  189.            new_targets = make_new_targets(org_target,2)   
  190.         else
  191.            org_target = friends_unit.dead_members
  192.            new_targets = make_new_targets(org_target,2)           
  193.         end
  194.     elsif item.for_friend?
  195.          if item.for_one?
  196.             org_target = [friends_unit.smooth_target(@target_index)]
  197.             new_targets = make_new_targets(org_target,1)   
  198.          else
  199.             return (opponents_unit.alive_members + friends_unit.alive_members) if all_targets
  200.             return friends_unit.alive_members
  201.          end
  202.     end
  203.   end
  204.   
  205.   #--------------------------------------------------------------------------
  206.   # * Make New Targets
  207.   #--------------------------------------------------------------------------
  208.   def make_new_targets(target,type = 0)
  209.       targets = []
  210.       if all_targets
  211.         members = (opponents_unit.alive_members + friends_unit.alive_members) if type <= 1
  212.         members = friends_unit.dead_members if type == 2      
  213.       else
  214.         members = opponents_unit.alive_members if type == 0
  215.         members = friends_unit.alive_members if type == 1
  216.         members = friends_unit.dead_members if type == 2
  217.       end
  218.       for t in target
  219.           for m in members
  220.               targets.push(m) if t == m
  221.               next if t == m
  222.              (targets.push(m); m.sprite_size[2] = false) if scope_range?(t,m)            
  223.           end
  224.       end
  225.       return targets
  226.   end
  227.   
  228.   #--------------------------------------------------------------------------
  229.   # * Scope Range
  230.   #--------------------------------------------------------------------------
  231.   def scope_range?(user,target)
  232.       t_r2 = [user.screen_x, user.screen_y] rescue nil
  233.       t_r3 = [target.screen_x, target.screen_y] rescue nil
  234.       return false if t_r2 == nil or t_r3 == nil
  235.       s_r = [0,0,0,0] ; s_p = [0,0]
  236.       s_r = [$1.to_i,$2.to_i,$3.to_i,$4.to_i] if @item.object.note =~ /<Scope Range = (\d+) - (\d+) - (\d+) - (\d+)>/
  237.       return false if s_r == [0,0,0,0]
  238.       if SCOPE_TYPE > 0
  239.          s_p = [target.sprite_size[0] / 2, target.sprite_size[1]]
  240.          s_p[0] = s_p[0] * SPRITE_SIZE_RANGE[0] / 100
  241.          s_p[1] = s_p[1] * SPRITE_SIZE_RANGE[1] / 100
  242.       end
  243.       return false if !t_r3[0].between?(t_r2[0] - (s_r[0] + s_p[0]), t_r2[0] + (s_r[1] + s_p[0]))
  244.       return false if !t_r3[1].between?(t_r2[1] - s_r[2], t_r2[1] + s_r[3] + s_p[1])
  245.       return true
  246.   end  
  247.   
  248. end
复制代码


PS:似乎http://www.atelier-rgss.com/的网站翻墙也上不去……
梦石
0
星屑
1736
在线时间
761 小时
注册时间
2013-9-23
回帖
180

开拓者

发表于 2016-2-11 18:47:49 | 显示全部楼层
本帖最后由 午睡的风铃 于 2016-2-11 18:49 编辑

首先请把技能的目标设成单个敌人或单个队友或使用者

技能备注里
<Scope Range = 120 - 120 - 64 - 40>
目标两侧120像素,向上64像素,向下40像素
技能对上述范围内的目标生效

<All Targets>
范围内全部目标,不分敌我 = =
如果备注里填入
<All Targets>
<Scope Range = 544 - 544 - 416 - 416>
那好吧,这是一个地地道道的全屏范围的技能,当然你的画面尺寸是544*416.


精灵尺寸,大概是给怪物图设个尺寸来代替怪物图原本的尺寸
SPRITE_SIZE_RANGE = [80,70]
范围类型,大概是0表示用怪物图原本的尺寸,而1是用上面设置的尺寸
SCOPE_TYPE = 1
以上两个设定会影响到范围的计算,细微之处不是很确定。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部