Project1

标题: 【可以结贴】求脚本语句,关于战斗中被攻击者的装备问题 [打印本页]

作者: Eric_Zh    时间: 2015-3-6 10:41
标题: 【可以结贴】求脚本语句,关于战斗中被攻击者的装备问题
本帖最后由 Eric_Zh 于 2015-3-7 16:36 编辑

我最近打算写一个战斗脚本,但是有个难题困扰着我。

我打算用IF设置一个条件语句,如果角色攻击时身上携带某种武器或防具,执行IF里的内容,反之执行ELSE的内容。
当角色被攻击时,再设置类似的内容。
不知道怎么写?

------问题补充-------
我自己一直在改脚本,但是由于是初学者,所以碰了不少壁,最近才接近目标,但还差最后一步,如下图所示。

图中划线的部分,我想表达的跟原来描述的意思差不多。
不过这def是属于Scene_Battle的,所以伤害公式里的那个插入Game_Battler的就不好使了(严格来说是实际使用的时候会慢半拍)

(下面是我改过的代码,内容大约在第370行)
RUBY 代码复制
  1. #------------------------------------------------------------------------------#
  2. #  Galv's Timed Button Attacks
  3. #------------------------------------------------------------------------------#
  4. #  For: RPGMAKER VX ACE
  5. #  Version 1.7
  6. #------------------------------------------------------------------------------#
  7. #  2013-04-25 - Version 1.7 - Added compatibility with Yanfly's cast animation
  8. #  2013-04-17 - Version 1.6 - Fixed a pretty big bug with ending battle.
  9. #  2013-04-17 - Version 1.5 - Fixed evaded popup appearing in Yanfly's engine
  10. #                           - when hitting using 'guarantee hit' option. Added
  11. #                           - fix for if battle ends early while indicator live
  12. #  2013-04-08 - Version 1.4 - Fixed bug with defend indicator not showing on
  13. #                           - correct actor.
  14. #  2013-03-15 - Version 1.3 - Fixed animation option
  15. #  2013-03-15 - Version 1.2 - Fixed a bug with not pressing button at all
  16. #  2013-03-15 - Version 1.1 - added option to turn off battle log messages
  17. #                           - disabled hit indicator when actor is confused
  18. #                           - fixed yanfly battle engine compatability bug
  19. #  2013-03-11 - Version 1.0 - release
  20. #------------------------------------------------------------------------------#
  21. #  Adds a graphical indicator to selected attacks that allows the player to
  22. #  press a button at a certain time for the attack to do extra damage or apply
  23. #  a state. Different attacks can use different buttons, graphics and have
  24. #  varied speeds and difficulty.
  25. #
  26. #  NOTES: Put this script below any battle scripts. Tested in default battle
  27. #  system as well as Yanfly's default battle script.
  28. #
  29. #  MORE NOTES: If the indicator disappears too soon, increase the frames of the
  30. #  skill's animation in the Database Animations tab.
  31. #
  32. #------------------------------------------------------------------------------#
  33.  
  34. #------------------------------------------------------------------------------#
  35. #  NOTE TAGS for SKILLS or ITEMS
  36. #------------------------------------------------------------------------------#
  37. #
  38. #  <btnpress>     # Enables the btn press with flash and SE when successful
  39. #      OR
  40. #  <btnpress n>   # Enables the btn press and plays animation n when successful
  41. #                 # This animation cancels the current skill's animation.
  42. #
  43. #   # NOTE: Only one of these is required for a skill.
  44. #
  45. #------------------------------------------------------------------------------#
  46. #  NOTE TAGS for SKILLS or ITEMS (Leaving any of these out will use defaults)
  47. #------------------------------------------------------------------------------#
  48. #
  49. #  <btn x>                 # Use a different button to press (default :X)
  50. #  <btnmsg x>              # Use a different message number when hit successful
  51. #
  52. #  <btnmultiply x>         # Multiply the damage/healing by x (default 2)
  53. #
  54. #  <btnstates x,x,x>       # Apply states with id x when timing is hit.
  55. #  <btnrstates x,x,x>      # Remove states with id x when timing is hit.
  56. #
  57. #  <btnopt a,b,c,d>        # a = start time (delay before indicator moves)
  58. #                          # b = target time (when button should be pressed)
  59. #                          # c = indicator image number to use
  60. #                          # d = difficulty number. Higher is easier to hit
  61. #
  62. #   # The indicator will appear at the start time (a) and shrink down to meet
  63. #   # the target circle at the target time (b) when the player should press
  64. #   # the button.
  65. #   # DEFAULTS: a = 0   b = 31   c = 1   d = 0
  66. #------------------------------------------------------------------------------#
  67. #  EXAMPLES:
  68. #
  69. #  <btnpress 4>               # Enables script and uses animation 4 on success
  70. #  <btn Y>                    # Use the :Y ("s" on the keyboard) button instead
  71. #  <btnmultiply 3>            # 3 x damage
  72. #  <btnstates 2,3>            # Applies states 2 and 3
  73. #  <btnrstates 5,6,7>         # Removes states 5, 6 and 7
  74. #  <btnopt 10,61,2,0>         # Indicator runs from 10-61 frames using image 2
  75. #                             # and no change in difficulty
  76. #  
  77. #------------------------------------------------------------------------------#
  78.  
  79. #------------------------------------------------------------------------------#
  80. #  NOTE TAGS for ACTORS or EQUIPS - These determine a defending timed hit
  81. #------------------------------------------------------------------------------#
  82. #
  83. #  <btnpress>     # Enables an actor or equip defending timed hit.
  84. #      OR
  85. #  <btnpress n>   # Enables def timed hit and plays animation n when successful
  86. #                 # Only use this if you are using a sideview battle script.
  87. #                 # Only works with battle scripts that show animations on actors
  88. #
  89. #  # NOTE: Only one of these is required for an equip or actor.
  90. #
  91. #------------------------------------------------------------------------------#
  92. #  Optional NOTE TAGS for ACTORS or EQUIPS (Leaving any out will use defaults)
  93. #------------------------------------------------------------------------------#
  94.  
  95. #  <btn x>                 # Use a different button to press (default :Z)
  96. #  <btnmsg x>              # Use a different message number when hit successful
  97. #
  98. #  <btnmultiply x>         # Multiply the damage/healing by x (default 0.5)
  99. #
  100. #  <btnstates x,x,x>       # Apply states with id x when timing is hit.
  101. #  <btnrstates x,x,x>      # Remove states with id x when timing is hit.
  102. #
  103. #  <btnopt a,b,c,d>        # a = start time (delay before indicator moves)
  104. #  # DEFAULTS: a = 0   b = 31   c = 3   d = 0
  105. #
  106. #------------------------------------------------------------------------------#
  107.  
  108. ($imported ||= {})["Galv_BtnPress_Hit"] = true
  109. module Galv_BtnAtk
  110.  
  111. #------------------------------------------------------------------------------#  
  112. #  SETUP OPTIONS
  113. #------------------------------------------------------------------------------#
  114.  
  115.   #---------------#
  116.   #  PREFERENCES  #
  117.   #---------------#
  118.  
  119.   GUARANTEE_HIT = false   # If player hits the timing, the attack cannot miss
  120.   SHOW_AS_CRIT = true   # Displays hits on enemy as critical hits.
  121.  
  122.   ATK_MULTIPLIER = 1.5     # Default damage/healing multipliers if the timing is
  123.   DEF_MULTIPLIER = 0.5     # successful for attacking and defending.
  124.  
  125.   DIFFICULTY = 3         # The higher this number, the further away from the
  126.                          # center circle will score a success. 0 is extremely
  127.                          # difficult, the higher this number the easier.
  128.  
  129.   DISABLE_SWITCH = 194   # Turn swith ON to disable this
  130.  
  131.   ATK_BTN = :X           # Default attack button to press. :X is "a"
  132.   DEF_BTN = :Z           # Default defend button to press. :Z is "d"
  133.  
  134.   Y_OFFSET = -50         # 0 is positioned at bottom of a battler.
  135.  
  136.   Y_FRONT_OFFSET = 0     # x and y offset for targeting your party when using a
  137.   X_FRONT_OFFSET = 0     # battle system with no actor x,y locations. By default
  138.                          # it centers at the top of the battle status window.
  139.  
  140.   #---------------#
  141.   #     VOCAB     #
  142.   #---------------#
  143.  
  144.   BATTLE_LOG_TXT = true     # Display battle log text (below) true or false
  145.                              # Displaying battle messages slows down multi-hit
  146.                              # skills in some battle systems.
  147.  
  148.   # Below is a list of battlelog vocab that you can add to and use for timed hit
  149.   TXT = [ # don't touch
  150.  
  151.       "A perfect hit!",      # 0) Default attacking timed hit success
  152.       "Super effective!",    # 1) Default allied spell timed hit success
  153.       "A great block!",      # 2) Default defending timed hit success
  154.  
  155.       "CUSTOM TEST!",        # 3) When <btnmsg 3> notetag
  156.  
  157.       #"Another one",        # 4) Add as many as you need
  158.       #"Another one",        # 5) Add as many as you need
  159.       #"Another one",        # 6) Add as many as you need
  160.       #"Another one",        # 7) Add as many as you need
  161.  
  162.   ] # don't touch
  163.  
  164.   #---------------#
  165.   #   GRAPHICS    #
  166.   #---------------#
  167.  
  168.   TARGET_IMG = "hit_target"         # The inner target that the indicator meets
  169.   INDICATOR_IMG = "hit_indicator"   # The indicator that shrinks to the target
  170.  
  171.   # NOTE: These are the base image names for the graphics. The actual files will
  172.   # have a number appended to them. By default this number is 1, so the file
  173.   # names by default would be: "hit_target1.png", "hit_indicator1.png"
  174.   # This number can be changed using the option notetag so different skills can
  175.   # use a different graphic. Images go in /Graphics/System/ folder.
  176.  
  177.   COLOR_HIT = [0, 255, 0]    # [R,G,B] indicator turns this color when success
  178.   COLOR_MISS = [255, 0, 0]   # [R,G,B] indicator turns this color when fail
  179.  
  180.  
  181.   #---------------#
  182.   #    SOUNDS     #
  183.   #---------------#
  184.   SE_HIT = ["Flash1",100,100]    # "SE_Name", volume, pitch when hit timing
  185.   SE_MISS = ["Buzzer1",85,100]   # "SE_Name", volume, pitch when missed timing
  186.  
  187.  
  188. #------------------------------------------------------------------------------#  
  189. #  END SETUP OPTIONS
  190. #------------------------------------------------------------------------------#
  191.  
  192. end
  193.  
  194.  
  195. class RPG::BaseItem
  196.   def btnpress
  197.     if @btnpress.nil?
  198.       if @note =~ /<btnpress>/i
  199.         @btnpress = 0
  200.       elsif @note =~ /<btnpress[ ](.*)>/i
  201.         @btnpress = $1.to_i
  202.       else
  203.         @btnpress = -1
  204.       end
  205.     end
  206.     @btnpress
  207.   end
  208.   def btnmultiply
  209.     if @btnmultiply.nil?
  210.       if @note =~ /<btnmultiply[ ](.*)>/i
  211.         @btnmultiply = $1.to_f
  212.       else
  213.         if self.is_a?(RPG::Actor) || self.is_a?(RPG::EquipItem)
  214.           @btnmultiply = Galv_BtnAtk::DEF_MULTIPLIER
  215.         else
  216.           @btnmultiply = Galv_BtnAtk::ATK_MULTIPLIER
  217.         end
  218.       end
  219.     end
  220.     @btnmultiply
  221.   end
  222.   def btn
  223.     if @btn.nil?
  224.       if @note =~ /<btn[ ](.*)>/i
  225.         @btn = $1.to_sym
  226.       else
  227.         if self.is_a?(RPG::Actor) || self.is_a?(RPG::EquipItem)
  228.           @btn = Galv_BtnAtk::DEF_BTN
  229.         else
  230.           @btn = Galv_BtnAtk::ATK_BTN
  231.         end
  232.       end
  233.     end
  234.     @btn
  235.   end
  236.   def btnmsg
  237.     if @btnmsg.nil?
  238.       if @note =~ /<btnmsg[ ](.*)>/i
  239.         @btnmsg = $1.to_i
  240.       else
  241.         @btnmsg = nil
  242.       end
  243.     end
  244.     @btnmsg
  245.   end
  246.   def btnstates
  247.     if @btnstates.nil?
  248.       if @note =~ /<btnstates[ ](.*)>/i
  249.         @btnstates = $1.to_s.split(",").map {|i| i.to_i}
  250.       else
  251.         @btnstates = []
  252.       end
  253.     end
  254.     @btnstates
  255.   end
  256.   def btnrstates
  257.     if @btnrstates.nil?
  258.       if @note =~ /<btnrstates[ ](.*)>/i
  259.         @btnrstates = $1.to_s.split(",").map {|i| i.to_i}
  260.       else
  261.         @btnrstates = []
  262.       end
  263.     end
  264.     @btnrstates
  265.   end
  266.   def btnopt
  267.     if @btnopt.nil?
  268.       if @note =~ /<btnopt[ ](.*)>/i
  269.         @btnopt = $1.to_s.split(",").map {|i| i.to_i}
  270.       else
  271.         if self.is_a?(RPG::Actor) || self.is_a?(RPG::EquipItem)
  272.           @btnopt = [0,31,3,0]
  273.         else
  274.           @btnopt = [0,31,1,0]
  275.         end
  276.       end
  277.     end
  278.     @btnopt
  279.   end
  280. end # RPG::BaseItem
  281.  
  282.  
  283. class Game_Temp
  284.   attr_accessor :btncrit
  285.   attr_accessor :btndata
  286.   alias galv_btnhit_gt_initialize initialize
  287.   def initialize
  288.     galv_btnhit_gt_initialize
  289.     @btncrit = false
  290.     @btndata = [2,nil]  # [multipler,vocab]
  291.   end
  292. end # Game_Temp
  293.  
  294.  
  295. class Game_Actor < Game_Battler
  296.   if !$imported["YEA-BattleEngine"]
  297.     attr_accessor :screen_x
  298.     attr_accessor :screen_y
  299.   end
  300. end # Game_Actor < Game_Battler
  301.  
  302.  
  303. class Game_ActionResult
  304.   # Cannot miss if hit button at right time
  305.   alias galv_btnhit_gar_hit? hit?
  306.   def hit?
  307.     if $game_temp.btncrit && Galv_BtnAtk::GUARANTEE_HIT
  308.       @missed = false
  309.       @evaded = false
  310.       @used
  311.     else
  312.       galv_btnhit_gar_hit?
  313.     end
  314.   end
  315.  
  316.   # Modify damage if button is hit and make it show critical
  317.   alias galv_btnhit_gar_make_damage make_damage
  318.   def make_damage(value, item)
  319.     if $game_temp.btncrit
  320.       value = (value * $game_temp.btndata[0]).to_i
  321.       @critical = true if @battler.is_a?(Game_Enemy) && Galv_BtnAtk::SHOW_AS_CRIT
  322.     end
  323.     galv_btnhit_gar_make_damage(value, item)
  324.   end
  325.  
  326. end # Game_ActionResult
  327.  
  328.  
  329. class Window_BattleLog < Window_Selectable
  330.   alias galv_btnhit_wblog_display_critical display_critical
  331.   def display_critical(target, item)
  332.     if $game_temp.btncrit && Galv_BtnAtk::BATTLE_LOG_TXT
  333.       if $game_temp.btndata[1]
  334.         text = $game_temp.btndata[1]
  335.       else
  336.         text = target.actor? ? Galv_BtnAtk::TXT[1] : Galv_BtnAtk::TXT[0]
  337.       end
  338.       add_text(text)
  339.       wait
  340.     else
  341.       galv_btnhit_wblog_display_critical(target, item)
  342.     end
  343.   end
  344. end # Window_BattleLog < Window_Selectable
  345.  
  346.  
  347. class Scene_Battle < Scene_Base
  348.   attr_accessor :btnactive
  349.  
  350.   alias galv_btnhit_sb_update_basic update_basic
  351.   def update_basic
  352.     if @btnactive
  353.       btn_pressed
  354.       @hit_indicator.update if @hit_indicator
  355.     end
  356.     galv_btnhit_sb_update_basic
  357.   end
  358.  
  359.   def hskill
  360.     if @def_opts
  361.       @def_opts
  362.     else
  363.       @subject.current_action.item
  364.     end
  365.   end
  366.  
  367.   def btn_pressed
  368.     return if $game_switches[Galv_BtnAtk::DISABLE_SWITCH] || $game_troop.all_dead?
  369.     if Input.trigger?(hskill.btn) && @hit_indicator.hit?
  370.       $game_temp.btncrit = true
  371.       $game_temp.btndata[0] = hskill.btnmultiply
  372.       btn_addstate if hskill.btnstates
  373.       btn_remstate if hskill.btnrstates
  374.       @hit_indicator.success
  375.       if hskill.btnpress > 0
  376.         show_hit_success_anim(@current_inditargets, hskill.btnpress)
  377.       else
  378.         $game_troop.screen.start_flash(Color.new(255,255,255,255),25)
  379.         RPG::SE.new(Galv_BtnAtk::SE_HIT[0],Galv_BtnAtk::SE_HIT[1],Galv_BtnAtk::SE_HIT[2]).play
  380.       end
  381.       @btnactive = nil
  382.     elsif Input.trigger?(hskill.btn)
  383.       $game_temp.btncrit = false
  384.       @hit_indicator.fail
  385.       RPG::SE.new(Galv_BtnAtk::SE_MISS[0],Galv_BtnAtk::SE_MISS[1],Galv_BtnAtk::SE_MISS[2]).play
  386.       @btnactive = nil
  387.     end
  388.   end
  389.  
  390.   def btn_addstate
  391.     @current_inditargets.each { |t|
  392.       already_dead = t.dead?
  393.       hskill.btnstates.each { |state| t.add_state(state) if !already_dead }
  394.       t.perform_collapse_effect if t.dead? && !already_dead
  395.     }
  396.   end
  397.  
  398.   def btn_remstate
  399.     @current_inditargets.each { |t|
  400.       already_dead = t.dead?
  401.       hskill.btnrstates.each { |state| t.remove_state(state) }
  402.       t.perform_collapse_effect if t.dead? && !already_dead
  403.     }
  404.   end
  405.  
  406.   def show_hit_success_anim(targets, animation_id, mirror = false)
  407.     if $data_animations[animation_id]
  408.       targets[0].animation_id = animation_id
  409.       targets[0].animation_mirror = mirror
  410.     end
  411.   end
  412.  
  413.   alias galv_btnhit_sb_use_item use_item
  414.   def use_item
  415.     galv_btnhit_sb_use_item
  416.     $game_temp.btncrit = false
  417.   end
  418.  
  419.   def do_indicator(targets)
  420.     return if targets.nil? || targets.empty? || @castanim
  421.     @def_opts = nil
  422.     item = @subject.current_action.item
  423.     target = targets[0]
  424.     if @subject.is_a?(Game_Actor) && !@subject.confusion? && item.btnpress >= 0
  425.       $game_temp.btndata[1] = item.btnmsg ? Galv_BtnAtk::TXT[item.btnmsg] : nil
  426.       @current_inditargets = targets
  427.       setup_hit_indicator(item.btnopt)
  428.       @btnactive = true
  429.     elsif target && defender?(target)
  430.       $game_temp.btndata[1] = @def_opts.btnmsg ?
  431.           Galv_BtnAtk::TXT[@def_opts.btnmsg] : Galv_BtnAtk::TXT[2]
  432.       @current_inditargets = targets
  433.       setup_hit_indicator(@def_opts.btnopt)
  434.       @btnactive = true
  435.     end
  436.     update_for_wait
  437.   end
  438.  
  439.   alias galv_btnhit_sb_show_animation show_animation
  440.   def show_animation(targets, animation_id)
  441.     do_indicator(targets)
  442.     galv_btnhit_sb_show_animation(targets, animation_id)
  443.   end
  444.  
  445.   def defender?(target)
  446.     return false if !target.is_a?(Game_Actor)
  447.     return false if @subject.is_a?(Game_Actor)
  448.     defend = -1
  449.     defend = $data_actors[target.id].btnpress
  450.     @def_opts = $data_actors[target.id]
  451.     target.equips.each { |i|
  452.     next if i.nil?
  453.     if i.btnpress > defend
  454.       defend = i.btnpress
  455.       @def_opts = i
  456.     end
  457.     }
  458.     return true if defend >= 0
  459.   end
  460.  
  461.   def setup_hit_indicator(array)
  462.     return if @current_inditargets[0].nil? ||
  463.       $game_switches[Galv_BtnAtk::DISABLE_SWITCH] || $game_troop.all_dead?
  464.  
  465.     if !@current_inditargets.empty? && @current_inditargets[0].screen_x
  466.       x = @current_inditargets[0].screen_x
  467.       y = @current_inditargets[0].screen_y + Galv_BtnAtk::Y_OFFSET
  468.     else
  469.       x = Graphics.width / 2 + Galv_BtnAtk::X_FRONT_OFFSET
  470.       y = Graphics.width / 1.7 + Galv_BtnAtk::Y_FRONT_OFFSET
  471.     end
  472.     @hit_indicator = Timed_Hits.new(x,y,array)
  473.   end
  474.  
  475.   alias galv_btnhit_sb_invoke_item invoke_item
  476.   def invoke_item(target, item)
  477.     if !$imported["YEA-BattleEngine"]
  478.       @btnactive = nil
  479.       @hit_indicator.dispose if @hit_indicator
  480.     end
  481.     galv_btnhit_sb_invoke_item(target, item)
  482.     if $imported["YEA-BattleEngine"]
  483.       @btnactive = nil
  484.       @hit_indicator.dispose if @hit_indicator
  485.     end
  486.   end
  487.  
  488.   alias galv_btnhit_sb_terminate terminate
  489.   def terminate
  490.     galv_btnhit_sb_terminate
  491.     @hit_indicator.dispose if @hit_indicator
  492.   end
  493.  
  494.   if $imported["YEA-CastAnimations"]
  495.     alias galv_btnhit_sb_process_casting_animation process_casting_animation
  496.     def process_casting_animation
  497.       @castanim = true
  498.       item = @subject.current_action.item
  499.       cast_ani = item.cast_ani
  500.       return if cast_ani <= 0
  501.       show_animation([@subject], cast_ani)
  502.       @castanim = false
  503.     end
  504.   end
  505.  
  506. end # Scene_Battle < Scene_Base
  507.  
  508.  
  509. #------------------------------------------------------------------------------#
  510. #  Class Timed_Hits
  511. #------------------------------------------------------------------------------#
  512. class Timed_Hits
  513.   def initialize(x,y,options)
  514.     @x = x
  515.     @y = y
  516.     @opt = options
  517.     @img = @opt[2].to_s
  518.     @start_frame = @opt[0]
  519.     @target_frame = @opt[1]
  520.     @current_frame = 0
  521.     @s = (3.to_f - 0.6) / (@target_frame - @start_frame)
  522.     @d = (Galv_BtnAtk::DIFFICULTY + @opt[3]).to_f * 0.5
  523.     create_hit_indicator
  524.     create_target_indicator
  525.   end
  526.  
  527.   def create_target_indicator
  528.     @hittarget = Sprite.new(@viewport1)
  529.     @hittarget.bitmap = Cache.system(Galv_BtnAtk::TARGET_IMG + @img)
  530.     @hittarget.z = 100
  531.     @hittarget.x = @x - (@hittarget.bitmap.width / 2)
  532.     @hittarget.y = @y - (@hittarget.bitmap.height / 2)
  533.     @hittarget.opacity = 130
  534.   end
  535.  
  536.   def create_hit_indicator
  537.     @hitindi = Sprite.new(@viewport1)
  538.     @hitindi.bitmap = Cache.system(Galv_BtnAtk::INDICATOR_IMG + @img)
  539.     @hitindi.x = @x
  540.     @hitindi.y = @y
  541.     @hitindi.z = 100
  542.     @hitindi.opacity = 0
  543.     @hitindi.zoom_x = 3
  544.     @hitindi.zoom_y = 3
  545.     @hitindi.color = Color.new(0, 0, 0, 0)
  546.   end
  547.  
  548.   def hit?
  549.     @current_frame.between?(@target_frame - @d,@target_frame + @d)
  550.   end
  551.  
  552.   def success
  553.     c = Galv_BtnAtk::COLOR_HIT
  554.     @hitindi.color = Color.new(c[0],c[1],c[2],255)
  555.   end
  556.  
  557.   def fail
  558.     c = Galv_BtnAtk::COLOR_MISS
  559.     @hitindi.color = Color.new(c[0],c[1],c[2],255)
  560.   end
  561.  
  562.   def update
  563.     update_indicators
  564.   end
  565.  
  566.   def update_indicators
  567.     return @current_frame += 1 if @current_frame < @start_frame
  568.     @hitindi.opacity = 100
  569.     @hitindi.zoom_x -= @s
  570.     @hitindi.zoom_y -= @s
  571.     @hitindi.x = @x - (@hitindi.bitmap.width / 2) * @hitindi.zoom_x
  572.     @hitindi.y = @y - (@hitindi.bitmap.height / 2) * @hitindi.zoom_y
  573.     @current_frame += 1
  574.     if @hitindi.zoom_x <= 0
  575.       fail
  576.       SceneManager.scene.btnactive = nil
  577.     end
  578.   end
  579.  
  580.   def dispose
  581.     @hitindi.dispose if @hitindi
  582.     @hittarget.dispose if @hittarget
  583.   end
  584. end # Timed_Hits
   
作者: 欧买歌    时间: 2015-3-6 22:20
做一个公共事件
如果艾里克学会了连续攻击
#内容
否则
#内容
结束

如果你是在脚本中的话,就直接用脚本执行公共事件
$game_temp.common_event_id = 编号
作者: chd114    时间: 2015-3-7 06:08
我的做法是在game_battler里面的def execute_damage(user)下面做···这里面的user就是使用者,不过这么做的话也有个缺陷···如果技能没有命中就不会触发这个效果···
作者: Eric_Zh    时间: 2015-3-7 16:36
方法我已经摸索出来了……虽然不是上面回复那样说的方法,但是也已经达到我预想的目的了。可以结贴了……(具体怎么做到的,可以问我)




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