查看: 3154|回复: 1

[已经解决] 求VA的战斗光标脚本

[复制链接]
梦石
0
星屑
50
在线时间
146 小时
注册时间
2011-9-16
回帖
36
发表于 2012-7-8 12:28:41 | 显示全部楼层 |阅读模式

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

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

×
就是和VX的一个脚本差不多,表示在选择敌人的时候有一个箭头出现在敌人身上而不是在下面选择名字。搜索过了找不到,有的亲们帮帮忙吧
梦石
0
星屑
2378
在线时间
1014 小时
注册时间
2012-4-30
回帖
1459

开拓者

发表于 2012-7-8 13:08:13 | 显示全部楼层
  1. #==============================================================================
  2. # ** Victor Engine - Target Arrow
  3. #------------------------------------------------------------------------------
  4. # Author : Victor Sant
  5. #
  6. # Version History:
  7. #  v 1.00 - 2012.01.15 > First relase
  8. #------------------------------------------------------------------------------
  9. #  This script allows to change target selection to a arrow like selection.
  10. # It's possible to make it animated and set different graphics for enemies
  11. # and actors target selections.
  12. # If using the script 'Victor Engine - Loop Animation', it's also possible
  13. # to make the cursor an animation
  14. #------------------------------------------------------------------------------
  15. # Compatibility
  16. #   Requires the script 'Victor Engine - Basic Module' v 1.09 or higher
  17. #   If used with 'Victor Engine - Custom Basic Actions' paste this one bellow
  18. #   it.
  19. #
  20. # * Overwrite methods (Default)
  21. #   class RPG::UsableItem < RPG::BaseItem
  22. #     def need_selection?
  23. #
  24. #   class Window_BattleEnemy < Window_Selectable
  25. #     def show
  26. #     def hide
  27. #     def cursor_movable?
  28. #     def cursor_down(wrap = false)
  29. #     def cursor_up(wrap = false)
  30. #     def cursor_right(wrap = false)
  31. #     def cursor_left(wrap = false)
  32. #     def update_help
  33. #
  34. #   class Window_BattleActor < Window_BattleStatus
  35. #     def cursor_movable?
  36. #     def cursor_down(wrap = false)
  37. #     def cursor_up(wrap = false)
  38. #     def cursor_right(wrap = false)
  39. #     def cursor_left(wrap = false)
  40. #     def update_help
  41. #     def update_cursor
  42. #
  43. # * Alias methods (Default)
  44. #   class Window_BattleEnemy < Window_Selectable
  45. #     def initialize(info_viewport)
  46. #     def update
  47. #     def dispose
  48. #
  49. #   class Window_BattleActor < Window_BattleStatus
  50. #     def initialize(info_viewport)
  51. #     def update
  52. #     def show
  53. #     def hide
  54. #     def update_cursor
  55. #     def dispose
  56. #
  57. #   class Scene_Battle < Scene_Base
  58. #     def create_actor_window
  59. #     def create_enemy_window
  60. #     def command_attack
  61. #     def on_skill_ok
  62. #     def on_item_ok
  63. #     def on_enemy_cancel
  64. #     def on_actor_cancel
  65. #
  66. #------------------------------------------------------------------------------
  67. # Instructions:
  68. #  To instal the script, open you script editor and paste this script on
  69. #  a new section on bellow the Materials section. This script must also
  70. #  be bellow the scripts 'Victor Engine - Basic'
  71. #
  72. #------------------------------------------------------------------------------
  73. # Skills and Items note tags:
  74. #   Tags to be used on Skills and Items note boxes.
  75. #
  76. #  <target description>
  77. #  string
  78. #  </target description>
  79. #   The target description text, the string is the text, to add a break line
  80. #   use \\n.
  81. #
  82. #------------------------------------------------------------------------------
  83. # Additional instructions:
  84. #
  85. #  The cursors graphics must be in the folder Graphics/System.
  86. #
  87. #  To use animations as cursors you need the script  
  88. #  'Victor Engine - Loop Animation' v 1.02 or higher.
  89. #
  90. #==============================================================================

  91. #==============================================================================
  92. # ** Victor Engine
  93. #------------------------------------------------------------------------------
  94. #   Setting module for the Victor Engine
  95. #==============================================================================

  96. module Victor_Engine
  97.   #--------------------------------------------------------------------------
  98.   # * Set the automatic text control codes
  99.   #   when false, it's needed to add \# on the start of the text to use
  100.   #   control codes
  101.   #--------------------------------------------------------------------------
  102.   VE_ARROW_DEFAULT = {
  103.     name:   "Cursor", # Cursor graphic filename ("filename")
  104.     frames: 3,        # Number of frames of the arrow (1 for no animation)
  105.     speed:  20,       # Cursto animation wait time (60 frames = 1 second)
  106.     height: true,     # Adjust arrow based on target height
  107.     help:   true,     # Show help window when selecting target
  108.     x:      15,        # Coordinate x adjust
  109.     y:      35,        # Coordinate y adjust
  110.    
  111.     move:   0,        # Set move type. 0 : all directions, 1 : left and right
  112.                       # 2 : up and down
  113.     anim:   111,       # Animation ID displayed as arrow. Requires the script
  114.                       # "Victor Engine - Loop Animation", this makes the
  115.                       # arrow a looping battle animation instead of a
  116.                       # simple bitmap graphic
  117.   } # Don't remove
  118.   #--------------------------------------------------------------------------
  119.   # * Custom arrow settings
  120.   #    Set different configuration for arrows based on the window class
  121.   #    it is being shown. It needs to add only the changed values.
  122.   #      type: {setting},
  123.   #      type: actor: or enemy:
  124.   #--------------------------------------------------------------------------
  125.   VE_ARROW_CUSTOM = {
  126.     actor: {name: "Cursor"},
  127.     enemy: {name: "Cursor"},
  128.   } # Don't remove
  129.   #--------------------------------------------------------------------------
  130.   # * Hide skill window during target selection
  131.   #    Since the window is placed above the battlers, the arrow stay behind
  132.   #    the skill window. you can set it false if the window is placed
  133.   #    in a different position with scripts.
  134.   #--------------------------------------------------------------------------
  135.   VE_HIDE_SKILL_WINDOW = true
  136.   #--------------------------------------------------------------------------
  137.   # * Hide item window during target selection
  138.   #    Since the window is placed above the battlers, the arrow stay behind
  139.   #    the item window. you can set it false if the window is placed
  140.   #    in a different position with scripts.
  141.   #--------------------------------------------------------------------------
  142.   VE_HIDE_ITEM_WINDOW = true
  143.   #--------------------------------------------------------------------------
  144.   # * Set the use of target help window
  145.   #--------------------------------------------------------------------------
  146.   VE_USE_TARGET_HELP = true
  147.   #--------------------------------------------------------------------------
  148.   # * Settings for the target help window.
  149.   #--------------------------------------------------------------------------
  150.   VE_TARGET_HELP_WINDOW = {
  151.     text_align:    1,    # Text align, 0: left, 1: center, 2: right
  152.     target_info:   true, # If true show target info, if false show skill name
  153.     all_enemies:   "全部敌人",   # Target info for all enemies actions
  154.     all_actors:    "全部角色",    # Target info for all actors actions
  155.     all_target:    "全部对象",   # Target info for all targets actions
  156.     random_enemy:  "随机 敌人",  # Target info for random enemy actions
  157.     random_actor:  "随机 角色",   # Target info for random actor actions
  158.     random_target: "随机 对象", # Target info for random target actions
  159.   } # Don't remove
  160. end

  161. $imported[:ve_target_arrow] = true

  162. #==============================================================================
  163. # ** RPG::UsableItem
  164. #------------------------------------------------------------------------------
  165. #  This is the superclass for skills and items.
  166. #==============================================================================

  167. class RPG::UsableItem < RPG::BaseItem
  168.   #--------------------------------------------------------------------------
  169.   # * Overwrite method: need_selection?
  170.   #--------------------------------------------------------------------------
  171.   def need_selection?
  172.     @scope > 0
  173.   end
  174. end

  175. #==============================================================================
  176. # ** Window_Selectable
  177. #------------------------------------------------------------------------------
  178. #  This window contains cursor movement and scroll functions.
  179. #==============================================================================

  180. class Window_Selectable < Window_Base
  181.   #--------------------------------------------------------------------------
  182.   # * New method: init_arrow
  183.   #--------------------------------------------------------------------------
  184.   def init_arrow
  185.     @arrows = []
  186.     @arrows_anim = 0
  187.     @arrows_value = VE_ARROW_CUSTOM.dup
  188.     @arrows_value.default = VE_ARROW_DEFAULT.dup
  189.     @arrows_value.each do |key, value|
  190.       arrow = @arrows_value[key]
  191.       arrow[:x]      = VE_ARROW_DEFAULT[:x]      if !value[:x]
  192.       arrow[:y]      = VE_ARROW_DEFAULT[:y]      if !value[:y]
  193.       arrow[:name]   = VE_ARROW_DEFAULT[:name]   if !value[:name]
  194.       arrow[:frames] = VE_ARROW_DEFAULT[:frames] if !value[:frames]
  195.       arrow[:rect]   = VE_ARROW_DEFAULT[:rect]   if !value[:rect]
  196.       arrow[:speed]  = VE_ARROW_DEFAULT[:speed]  if !value[:speed]
  197.       arrow[:anim]   = VE_ARROW_DEFAULT[:anim]   if !value[:anim]
  198.       arrow[:move]   = VE_ARROW_DEFAULT[:move]   if !value[:move]
  199.       arrow[:height] = VE_ARROW_DEFAULT[:height] if !value[:height]
  200.     end
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # * New method: init_arrow_sprite
  204.   #--------------------------------------------------------------------------
  205.   def init_arrow_sprite(forced = false)
  206.     dispose_arrow if @arrows_index != @index || forced
  207.     return unless self.active
  208.     if target_all?
  209.       item_max.times {|i| create_arrow_sprite(i) }
  210.     elsif @index > -1
  211.       create_arrow_sprite(0)
  212.     end
  213.     @arrows_index = @index
  214.     update_arrow_sprite
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # * New method: target_all?
  218.   #--------------------------------------------------------------------------
  219.   def target_all?
  220.     @action && (@action.for_all? || @action.for_random?)
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # * New method: target_self?
  224.   #--------------------------------------------------------------------------
  225.   def target_self?
  226.     @action && @action.for_user?
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # * New method: create_arrow_sprite
  230.   #--------------------------------------------------------------------------
  231.   def create_arrow_sprite(i)
  232.     return if @arrows[i]
  233.     @arrows[i] = Sprite_Base.new
  234.     @arrows[i].bitmap = Cache.system(arrow_filename)
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # * New method: arrow_animation
  238.   #--------------------------------------------------------------------------
  239.   def arrow_animation?
  240.     arrow_animation != 0 && $imported[:ve_loop_animation]
  241.   end
  242.   #--------------------------------------------------------------------------
  243.   # * New method: update_arrow_sprite
  244.   #--------------------------------------------------------------------------
  245.   def update_arrow_sprite
  246.     @arrows.each_index do |i|
  247.       next unless @arrows[i]
  248.       @arrows[i].viewport = sprite(target(i)).viewport
  249.       arrow_animation? ? set_arrow_animation(i) : set_arrow_bitmap(i)
  250.       update_arrow_position(i)
  251.     end
  252.     update_all_arrows
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # * New method: set_arrow_bitmap
  256.   #--------------------------------------------------------------------------
  257.   def set_arrow_bitmap(i)
  258.     bitmap = @arrows[i].bitmap
  259.     arrow_width   = bitmap.width / arrow_frames
  260.     current_frame = arrow_width * @arrows_anim
  261.     @arrows[i].src_rect.set(current_frame, 0, arrow_width, bitmap.height)
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # * New method: set_arrow_animation
  265.   #--------------------------------------------------------------------------
  266.   def set_arrow_animation(i)
  267.     target = target(i)
  268.     return if !target || sprite(target).loop_anim?(:arrow)
  269.     settings = {anim: arrow_animation, type: :arrow, loop: 1}
  270.     sprite(target).add_loop_animation(settings)
  271.   end
  272.   #--------------------------------------------------------------------------
  273.   # * New method: update_arrow_position
  274.   #--------------------------------------------------------------------------
  275.   def update_arrow_position(i)
  276.     adjust = arrow_height ? sprite(target(i)).oy / 2 : 0
  277.     @arrows[i].x  = target(i).screen_x + arrow_x
  278.     @arrows[i].y  = target(i).screen_y + arrow_y - adjust
  279.     @arrows[i].z  = self.z + 100
  280.     @arrows[i].ox = @arrows[i].width  / 2
  281.     @arrows[i].oy = @arrows[i].height / 2
  282.   end
  283.   #--------------------------------------------------------------------------
  284.   # * New method: update_all_arrows
  285.   #--------------------------------------------------------------------------
  286.   def update_all_arrows
  287.     @arrows.each {|arrow| arrow.update }
  288.   end
  289.   #--------------------------------------------------------------------------
  290.   # * New method: sprite
  291.   #--------------------------------------------------------------------------
  292.   def sprite(subject)
  293.     SceneManager.scene.spriteset.sprite(subject)
  294.   end
  295.   #--------------------------------------------------------------------------
  296.   # * New method: arrow_frames
  297.   #--------------------------------------------------------------------------
  298.   def target_window_type
  299.     self.instance_of?(Window_BattleEnemy) ? :enemy : :actor
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # * New method: arrow_filename
  303.   #--------------------------------------------------------------------------
  304.   def arrow_filename
  305.     arrow_animation? ? "" : @arrows_value[target_window_type][:name]
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # * New method: arrow_frames
  309.   #--------------------------------------------------------------------------
  310.   def arrow_frames
  311.     [@arrows_value[target_window_type][:frames], 1].max
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # * New method: arrow_old_rect
  315.   #--------------------------------------------------------------------------
  316.   def arrow_old_rect
  317.     @arrows_value[target_window_type][:rect]
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # * New method: arrow_animspeed
  321.   #--------------------------------------------------------------------------
  322.   def arrow_animspeed
  323.     [@arrows_value[target_window_type][:speed], 1].max
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # * New method: arrow_x
  327.   #--------------------------------------------------------------------------
  328.   def arrow_x
  329.     @arrows_value[target_window_type][:x]
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # * New method: arrow_y
  333.   #--------------------------------------------------------------------------
  334.   def arrow_y
  335.     @arrows_value[target_window_type][:y]
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # * New method: arrow_animation
  339.   #--------------------------------------------------------------------------
  340.   def arrow_animation
  341.     @arrows_value[target_window_type][:anim]
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # * New method: arrow_height
  345.   #--------------------------------------------------------------------------
  346.   def arrow_height
  347.     @arrows_value[target_window_type][:height]
  348.   end
  349.   #--------------------------------------------------------------------------
  350.   # * New method: arrow_move
  351.   #--------------------------------------------------------------------------
  352.   def arrow_move
  353.     @arrows_value[target_window_type][:move]
  354.   end
  355.   #--------------------------------------------------------------------------
  356.   # * New method: help_info
  357.   #--------------------------------------------------------------------------
  358.   def help_info
  359.     VE_TARGET_HELP_WINDOW
  360.   end
  361.   #--------------------------------------------------------------------------
  362.   # * New method: target_description
  363.   #--------------------------------------------------------------------------
  364.   def target_description
  365.     return "" unless @action
  366.     value  = "TARGET DESCRIPTION"
  367.     regexp = /<#{value}>((?:[^<]|<[^\/])*)<\/#{value}>/im
  368.     text   = ""
  369.     @action.note.scan(regexp) do
  370.       info = $1.dup
  371.       info.gsub!(/\r\n/) { "" }
  372.       info.gsub!(/\\n/)  { "\r\n" }
  373.       text += info
  374.     end
  375.     text
  376.   end
  377.   #--------------------------------------------------------------------------
  378.   # * New method: update_target_help
  379.   #--------------------------------------------------------------------------  
  380.   def update_target_help
  381.     text  = target_description
  382.     align = help_info[:text_align]
  383.     @help_window.visible = true
  384.     if text != ""
  385.       @help_window.set_info_text(text, align)
  386.     else
  387.       if help_info[:target_info]
  388.         draw_tartge_info(align)
  389.       else
  390.         @help_window.set_item_text(@action, align)
  391.       end
  392.     end
  393.   end
  394.   #--------------------------------------------------------------------------
  395.   # * New method: draw_tartge_inf
  396.   #--------------------------------------------------------------------------  
  397.   def draw_tartge_info(align)
  398.     if @action.for_one?
  399.       @help_window.set_target_text(target(0), align)
  400.     elsif @action.for_all? && @action.for_random?
  401.       text = help_info[:random_enemies] if @action.for_opponent?
  402.       text = help_info[:random_actors]  if @action.for_friend?
  403.       text = help_info[:random_target]  if @action.for_all_targets?
  404.       @help_window.set_info_text(text, align)
  405.     elsif @action.for_all? && !@action.for_random?
  406.       text = help_info[:all_enemies] if @action.for_opponent?
  407.       text = help_info[:all_actors]  if @action.for_friend?
  408.       text = help_info[:all_target]  if @action.for_all_targets?
  409.       @help_window.set_info_text(text, align)
  410.     end
  411.   end
  412. end

  413. #==============================================================================
  414. # ** Window_Help
  415. #------------------------------------------------------------------------------
  416. #  This window shows skill and item explanations along with actor status.
  417. #==============================================================================

  418. class Window_Help < Window_Base
  419.   #--------------------------------------------------------------------------
  420.   # * New method: set_target_text
  421.   #--------------------------------------------------------------------------
  422.   def set_target_text(target, align = 0)
  423.     if target != @target || @target.name != @text
  424.       @text   = ""
  425.       @target = target
  426.       @align  = align
  427.       target_info
  428.     end
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # * New method: set_info_text
  432.   #--------------------------------------------------------------------------
  433.   def set_info_text(text, align = 0)
  434.     if text != @text
  435.       @text = text
  436.       contents.clear
  437.       adj = @text[/\r\n/i]
  438.       draw_text(0, 0, width, line_height * (adj ? 1 : 2), @text, align)
  439.     end
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # * New method: set_item_text
  443.   #--------------------------------------------------------------------------
  444.   def set_item_text(item, align = 0)
  445.     if item.name != @text
  446.       @text = item.name
  447.       contents.clear
  448.       iw = item.icon_index == 0 ? 0 : 24
  449.       text_width = text_size(@text).width
  450.       x = align == 0 ? 0 : (contents_width - 24 - text_width) / (3 - align)
  451.       draw_icon(item.icon_index, x, line_height / 2, true)
  452.       draw_text(iw + 2, 0, contents_width - iw, line_height * 2, @text, align)
  453.     end
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # * New method: target_info
  457.   #--------------------------------------------------------------------------
  458.   def target_info
  459.     contents.clear
  460.     change_color(hp_color(@target))
  461.     adj = (@target.state_icons + @target.buff_icons).size == 0
  462.     height = line_height * (adj ? 2 : 1)
  463.     draw_text(0, 0, contents_width, height, @target.name, @align)
  464.     draw_target_icons
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # * New method: draw_target_icons
  468.   #--------------------------------------------------------------------------
  469.   def draw_target_icons
  470.     icons = (@target.state_icons + @target.buff_icons)[0, contents_width / 24]
  471.     x = @align == 0 ? 0 : (contents_width - icons.size * 24) / (3 - @align)
  472.     icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, line_height) }
  473.   end
  474. end

  475. #==============================================================================
  476. # ** Window_BattleEnemy
  477. #------------------------------------------------------------------------------
  478. #  This window display a list of enemies on the battle screen.
  479. #==============================================================================

  480. class Window_BattleEnemy < Window_Selectable
  481.   #--------------------------------------------------------------------------
  482.   # * Overwrite method: show
  483.   #--------------------------------------------------------------------------
  484.   def show
  485.     result = super
  486.     select(0)
  487.     init_arrow_sprite(true)
  488.     self.visible = false
  489.     result
  490.    
  491.    
  492.   end
  493.   #--------------------------------------------------------------------------
  494.   # * Overwrite method: hide
  495.   #--------------------------------------------------------------------------
  496.   def hide
  497.     result = super
  498.     dispose_arrow
  499.     result
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # * Overwrite method: cursor_movable?
  503.   #--------------------------------------------------------------------------
  504.   def cursor_movable?
  505.     active && !cursor_all && !target_all? && !target_self?
  506.   end
  507.   #--------------------------------------------------------------------------
  508.   # * Overwrite method: cursor_down
  509.   #--------------------------------------------------------------------------
  510.   def cursor_down(wrap = false)
  511.     select((index + 1) % item_max) if arrow_move != 1
  512.   end
  513.   #--------------------------------------------------------------------------
  514.   # * Overwrite method: cursor_up
  515.   #--------------------------------------------------------------------------
  516.   def cursor_up(wrap = false)
  517.     select((index - 1 + item_max) % item_max) if arrow_move != 1
  518.   end
  519.   #--------------------------------------------------------------------------
  520.   # * Overwrite method: cursor_right
  521.   #--------------------------------------------------------------------------
  522.   def cursor_right(wrap = false)
  523.     select((index + 1) % item_max) if arrow_move != 2
  524.   end
  525.   #--------------------------------------------------------------------------
  526.   # * Overwrite method: cursor_left
  527.   #--------------------------------------------------------------------------
  528.   def cursor_left(wrap = false)
  529.     select((index - 1 + item_max) % item_max) if arrow_move != 2
  530.   end
  531.   #--------------------------------------------------------------------------
  532.   # * Overwrite method: update_help
  533.   #--------------------------------------------------------------------------
  534.   def update_help
  535.     update_target_help
  536.   end
  537.   #--------------------------------------------------------------------------
  538.   # * New method: update_target_help
  539.   #--------------------------------------------------------------------------  
  540.   def update_target_help
  541.     text  = target_description
  542.     align = help_info[:text_align]
  543.    
  544.     @help_window.opacity = 0

  545.     @help_window.y += 35
  546.    
  547.     @help_window.visible = true
  548.     if text != ""
  549.       @help_window.set_info_text(text, align)
  550.     else
  551.       if help_info[:target_info]
  552.         draw_tartge_info(align)
  553.       else
  554.         @help_window.set_item_text(@action, align)
  555.       end
  556.     end
  557.   end
  558.   #--------------------------------------------------------------------------
  559.   # * Alias method: initialize
  560.   #--------------------------------------------------------------------------
  561.   alias :initialize_ve_arrow_arrow :initialize
  562.   def initialize(info_viewport)
  563.     initialize_ve_arrow_arrow(info_viewport)
  564.     init_arrow
  565.   end
  566.   #--------------------------------------------------------------------------
  567.   # * Alias method: update
  568.   #--------------------------------------------------------------------------
  569.   alias :update_ve_arrow_arrow :update
  570.   def update
  571.     update_ve_arrow_arrow
  572.     init_arrow_sprite
  573.     update_arrow_sprite
  574.     return if Graphics.frame_count % arrow_animspeed != 0
  575.     @arrows_anim = (@arrows_anim + 1) % arrow_frames
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # * Alias method: dispose
  579.   #--------------------------------------------------------------------------
  580.   alias :dispose_ve_arrow_arrow :dispose
  581.   def dispose
  582.     dispose_ve_arrow_arrow
  583.     dispose_arrow
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # * New method: init_arrow
  587.   #--------------------------------------------------------------------------
  588.   def set_action(action)
  589.     @action = action
  590.   end
  591.   #--------------------------------------------------------------------------
  592.   # * New method: enemies
  593.   #--------------------------------------------------------------------------
  594.   def enemies
  595.     $game_troop.alive_members
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # * New method: target
  599.   #--------------------------------------------------------------------------
  600.   def target(i)
  601.     target_all? ? enemies[i] : enemy
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # * New method: dispose_arrow
  605.   #--------------------------------------------------------------------------
  606.   def dispose_arrow
  607.     if arrow_animation?
  608.       enemies.each {|enemy| sprite(enemy).end_loop_anim(:arrow) }
  609.     end
  610.     @arrows.each {|arrow| arrow.dispose }
  611.     @arrows.clear
  612.   end
  613. end

  614. #==============================================================================
  615. # ** Window_BattleActor
  616. #------------------------------------------------------------------------------
  617. #  This window display a list of actors on the battle screen.
  618. #==============================================================================

  619. class Window_BattleActor < Window_BattleStatus
  620.   #--------------------------------------------------------------------------
  621.   # * Overwrite method: cursor_movable?
  622.   #--------------------------------------------------------------------------
  623.   def cursor_movable?
  624.     active && !cursor_all && !target_all? && !target_self?
  625.   end
  626.   #--------------------------------------------------------------------------
  627.   # * Overwrite method: cursor_down
  628.   #--------------------------------------------------------------------------
  629.   def cursor_down(wrap = false)
  630.     return if show_actor && arrow_move == 1
  631.     show_actor ? select((index + 1) % item_max) : super
  632.   end
  633.   #--------------------------------------------------------------------------
  634.   # * Overwrite method: cursor_up
  635.   #--------------------------------------------------------------------------
  636.   def cursor_up(wrap = false)
  637.     return if show_actor && arrow_move == 1
  638.     show_actor ? select((index - 1 + item_max) % item_max) : super
  639.   end
  640.   #--------------------------------------------------------------------------
  641.   # * Overwrite method: cursor_right(
  642.   #--------------------------------------------------------------------------
  643.   def cursor_right(wrap = false)
  644.     return if show_actor && arrow_move == 2
  645.     show_actor ? select((index + 1) % item_max) : super
  646.   end
  647.   #--------------------------------------------------------------------------
  648.   # * Overwrite method: cursor_left
  649.   #--------------------------------------------------------------------------
  650.   def cursor_left(wrap = false)
  651.     return if show_actor && arrow_move == 2
  652.     show_actor ? select((index - 1 + item_max) % item_max) :  super
  653.   end
  654.   #--------------------------------------------------------------------------
  655.   # * Overwrite method: update_help
  656.   #--------------------------------------------------------------------------
  657.   def update_help
  658.     update_target_help
  659.   end
  660.   #--------------------------------------------------------------------------
  661.   # * Overwrite method: initialize
  662.   #--------------------------------------------------------------------------
  663.   def update_cursor
  664.     @cursor_all = cursor_all
  665.     super
  666.   end
  667.   #--------------------------------------------------------------------------
  668.   # * Alias method: initialize
  669.   #--------------------------------------------------------------------------
  670.   alias :initialize_ve_arrow_arrow :initialize
  671.   def initialize(info_viewport)
  672.     initialize_ve_arrow_arrow(info_viewport)
  673.     init_arrow if show_actor
  674.   end
  675.   #--------------------------------------------------------------------------
  676.   # * Alias method: update
  677.   #--------------------------------------------------------------------------
  678.   alias :update_ve_arrow_arrow :update
  679.   def update
  680.     update_ve_arrow_arrow
  681.     return unless show_actor
  682.     init_arrow_sprite
  683.     update_arrow_sprite
  684.     return if Graphics.frame_count % arrow_animspeed != 0
  685.     @arrows_anim = (@arrows_anim + 1) % arrow_frames
  686.   end
  687.   #--------------------------------------------------------------------------
  688.   # * Alias method: show
  689.   #--------------------------------------------------------------------------
  690.   alias :show_ve_arrow_arrow :show
  691.   def show
  692.     if show_actor
  693.       result = super
  694.       self.visible = false
  695.       select(0)
  696.       result
  697.     else
  698.       show_ve_arrow_arrow
  699.     end
  700.   end
  701.   #--------------------------------------------------------------------------
  702.   # * Alias method: hide
  703.   #--------------------------------------------------------------------------
  704.   alias :hide_ve_arrow_arrow :hide
  705.   def hide
  706.     result = hide_ve_arrow_arrow
  707.     dispose_arrow if show_actor
  708.     result
  709.   end
  710.   #--------------------------------------------------------------------------
  711.   # * Alias method: dispose
  712.   #--------------------------------------------------------------------------
  713.   alias :update_cursor_ve_arrow_arrow :update_cursor
  714.   def update_cursor
  715.     show_actor ? cursor_rect.empty : update_cursor_ve_arrow_arrow
  716.   end
  717.   #--------------------------------------------------------------------------
  718.   # * Alias method: dispose
  719.   #--------------------------------------------------------------------------
  720.   alias :dispose_ve_arrow_arrow :dispose
  721.   def dispose
  722.     dispose_ve_arrow_arrow
  723.     dispose_arrow if show_actor
  724.   end
  725.   #--------------------------------------------------------------------------
  726.   # * New method: set_action
  727.   #--------------------------------------------------------------------------
  728.   def set_action(action)
  729.     @action = action
  730.   end
  731.   #--------------------------------------------------------------------------
  732.   # * New method: cursor_all
  733.   #--------------------------------------------------------------------------
  734.   def cursor_all
  735.     @action && @action.for_all?
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # * New method: actor
  739.   #--------------------------------------------------------------------------
  740.   def actor
  741.     $game_party.battle_members[@index]
  742.   end
  743.   #--------------------------------------------------------------------------
  744.   # * New method: actors
  745.   #--------------------------------------------------------------------------
  746.   def actors
  747.     $game_party.battle_members
  748.   end
  749.   #--------------------------------------------------------------------------
  750.   # * New method: target
  751.   #--------------------------------------------------------------------------
  752.   def target(i)
  753.     target_all? ? actors[i] : actor
  754.   end
  755.   #--------------------------------------------------------------------------
  756.   # * New method: show_actor
  757.   #--------------------------------------------------------------------------
  758.   def show_actor
  759.     $imported[:ve_actor_battlers]
  760.   end
  761.   #--------------------------------------------------------------------------
  762.   # * New method: dispose_arrow
  763.   #--------------------------------------------------------------------------
  764.   def dispose_arrow
  765.     if arrow_animation?
  766.       actors.each {|actor| sprite(actor).end_loop_anim(:arrow) }
  767.     end
  768.     @arrows.each {|arrow| arrow.dispose }
  769.     @arrows.clear
  770.   end
  771. end

  772. #==============================================================================
  773. # ** Scene_Battle
  774. #------------------------------------------------------------------------------
  775. #  This class performs battle screen processing.
  776. #==============================================================================

  777. class Scene_Battle < Scene_Base
  778.   #--------------------------------------------------------------------------
  779.   # * Alias method: create_actor_window
  780.   #--------------------------------------------------------------------------
  781.   alias :create_actor_window_ve_arrow_arrow :create_actor_window
  782.   def create_actor_window
  783.     create_actor_window_ve_arrow_arrow
  784.     @actor_window.help_window = @help_window if VE_USE_TARGET_HELP
  785.   end
  786.   #--------------------------------------------------------------------------
  787.   # * Alias method: create_enemy_window
  788.   #--------------------------------------------------------------------------
  789.   alias :create_enemy_window_ve_arrow_arrow :create_enemy_window
  790.   def create_enemy_window
  791.     create_enemy_window_ve_arrow_arrow
  792.     @enemy_window.help_window = @help_window if VE_USE_TARGET_HELP
  793.   end
  794.   #--------------------------------------------------------------------------
  795.   # * Alias method: command_attack
  796.   #--------------------------------------------------------------------------
  797.   alias :command_attack_ve_arrow_arrow :command_attack
  798.   def command_attack
  799.     set_window_action($data_skills[BattleManager.actor.attack_skill_id])
  800.     command_attack_ve_arrow_arrow
  801.   end
  802.   #--------------------------------------------------------------------------
  803.   # * Alias method: on_skill_ok
  804.   #--------------------------------------------------------------------------
  805.   alias :on_skill_ok_ve_arrow_arrow :on_skill_ok
  806.   def on_skill_ok
  807.     set_window_action(@skill_window.item)
  808.     on_skill_ok_ve_arrow_arrow
  809.     @skill_window.visible = false if VE_HIDE_SKILL_WINDOW
  810.   end
  811.   #--------------------------------------------------------------------------
  812.   # * Alias method: on_item_ok
  813.   #--------------------------------------------------------------------------
  814.   alias :on_item_ok_ve_arrow_arrow :on_item_ok
  815.   def on_item_ok
  816.     set_window_action(@item_window.item)
  817.     on_item_ok_ve_arrow_arrow
  818.     @item_window.visible = false if VE_HIDE_ITEM_WINDOW
  819.   end
  820.   #--------------------------------------------------------------------------
  821.   # * Alias method: on_enemy_cancel
  822.   #--------------------------------------------------------------------------
  823.   alias :on_enemy_cancel_ve_arrow_arrow :on_enemy_cancel
  824.   def on_enemy_cancel
  825.     on_enemy_cancel_ve_arrow_arrow
  826.     case @actor_command_window.current_symbol
  827.     when :attack then @help_window.visible  = false
  828.     when :skill  then @skill_window.visible = true
  829.     when :item   then @item_window.visible  = true
  830.     end
  831.   end
  832.   #--------------------------------------------------------------------------
  833.   # * Alias method: on_actor_cancel
  834.   #--------------------------------------------------------------------------
  835.   alias :on_actor_cancel_ve_arrow_arrow :on_actor_cancel
  836.   def on_actor_cancel
  837.     on_actor_cancel_ve_arrow_arrow
  838.     case @actor_command_window.current_symbol
  839.     when :attack then @help_window.visible  = false
  840.     when :skill  then @skill_window.visible = true
  841.     when :item   then @item_window.visible  = true
  842.     end
  843.   end
  844.   #--------------------------------------------------------------------------
  845.   # * New method: set_window_action
  846.   #--------------------------------------------------------------------------
  847.   def set_window_action(item)
  848.     @enemy_window.set_action(item) if item.for_opponent?
  849.     @enemy_window.update_help      if item.for_opponent?
  850.     @actor_window.set_action(item) if item.for_friend?
  851.     @actor_window.update_help      if item.for_friend?
  852.   end
  853. end
复制代码


附件:
cursor.png



必须脚本:
  1. #==============================================================================
  2. # ** Victor Engine - Basic Module
  3. #------------------------------------------------------------------------------
  4. # Author : Victor Sant
  5. #
  6. # Version History:
  7. #  v 1.00 - 2011.12.19 > First relase
  8. #  v 1.01 - 2011.12.21 > Added Event Troop notes
  9. #  v 1.02 - 2011.12.22 > Added character frames value
  10. #  v 1.03 - 2011.12.30 > Added Actor and Enemy notes
  11. #  v 1.04 - 2012.01.01 > Added party average level and map actors
  12. #  v 1.05 - 2012.01.04 > Compatibility for Characters Scripts
  13. #  v 1.06 - 2012.01.07 > Compatibility for Fog and Light Effect
  14. #                      > Added new Sprite Character functions
  15. #  v 1.07 - 2012.01.11 > Compatibility for Control Text and Codes
  16. #  v 1.08 - 2012.01.13 > Compatibility for Trait Control
  17. #  v 1.09 - 2012.01.15 > Fixed the Regular Expressions problem with "" and “”
  18. #  v 1.10 - 2012.01.18 > Compatibility for Automatic Battlers
  19. #  v 1.11 - 2012.01.26 > Compatibility for Followers Options
  20. #                        Compatibility for Animated Battle
  21. #------------------------------------------------------------------------------
  22. #   This is the basic script for the system from Victory Engine and is
  23. # required to use the scripts from the engine. This script offer some new
  24. # functions to be used within many scripts of the engine.
  25. #------------------------------------------------------------------------------
  26. # Compatibility
  27. #   Required for the Victor Engine
  28. #
  29. # * Overwrite methods (Default)
  30. #   module Cache
  31. #     def self.character(filename)
  32. #
  33. #   class Sprite_Character < Sprite_Base
  34. #     def set_character_bitmap
  35. #
  36. # * Alias methods (Default)
  37. #   class Game_Interpreter
  38. #     def command_108
  39. #
  40. #   class Window_Base < Window
  41. #     def convert_escape_characters(text)
  42. #
  43. #------------------------------------------------------------------------------
  44. # Instructions:
  45. #  To instal the script, open you script editor and paste this script on
  46. #  a new section on bellow the Materials section.
  47. #
  48. #------------------------------------------------------------------------------
  49. # New functions
  50. #
  51. # * Random number between two vales
  52. #   rand_between(min, max)
  53. #    min : min value
  54. #    max : max value
  55. #   Can be called from any class, this method return an random value between
  56. #   two specific numbers
  57. #
  58. # * Random array value
  59. #   <Array>.random
  60. #   <Array>.random!
  61. #   Returns a random object from the array, the method .random! is destructive,
  62. #   removing the value returned from the array.
  63. #
  64. # * Sum of the numeric values of a array
  65. #   <Array>.sum
  66. #   Returns the sum of all numeric values
  67. #
  68. # * Avarage of all numeric values from the array
  69. #   <Array>.average(float = false)
  70. #    float : float flag
  71. #   Returns the average of all numeric values, if floa is true, the value
  72. #   returned is a float, otherwise it's a integer.
  73. #
  74. # * Note for events
  75. #   <Event>.note
  76. #   By default, events doesn't have note boxes. This command allows to use
  77. #   comments as note boxes, following the same format as the ones on the
  78. #   database. Returns all comments on the active page of the event.
  79. #
  80. # * Comment calls
  81. #   <Event>.comment_call
  82. #   Another function for comment boxes, by default, they have absolutely no
  83. #   effect in game when called. But this method allows to make the comment
  84. #   box to behave like an script call, but with the versatility of the
  85. #   note boxes. Remember that the commands will only take effect if there
  86. #   is scripts to respond to the comment code.
  87. #
  88. #==============================================================================

  89. #==============================================================================
  90. # ** Victor Engine
  91. #------------------------------------------------------------------------------
  92. #   Setting module for the Victor Engine
  93. #==============================================================================

  94. module Victor_Engine
  95. end

  96. $imported = {} if !$imported
  97. $imported[:ve_basic] = true

  98. #==============================================================================
  99. # ** Object
  100. #------------------------------------------------------------------------------
  101. #  This class is the superclass of all other classes.
  102. #==============================================================================

  103. class Object
  104.   #--------------------------------------------------------------------------
  105.   # * Include setting module
  106.   #--------------------------------------------------------------------------
  107.   include Victor_Engine
  108.   #-------------------------------------------------------------------------
  109.   # * New method: rand_between
  110.   #-------------------------------------------------------------------------
  111.   def rand_between(min, max)
  112.     min + rand(max - min + 1)
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # * New method: numeric?
  116.   #--------------------------------------------------------------------------
  117.   def numeric?
  118.     return false
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # * New method: float?
  122.   #--------------------------------------------------------------------------
  123.   def float?
  124.     return false
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # * New method: item?
  128.   #--------------------------------------------------------------------------
  129.   def item?
  130.     return false
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # * New method: skill?
  134.   #--------------------------------------------------------------------------
  135.   def skill?
  136.     return false
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # * New method: file_exist?
  140.   #--------------------------------------------------------------------------
  141.   def file_exist?(path, filename)
  142.     $file_list ||= {}
  143.     $file_list[path] ||= get_file_list(path)
  144.     $file_list[path].include?(filename)
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # * New method: et_file_list
  148.   #--------------------------------------------------------------------------
  149.   def get_file_list(path)
  150.     Dir.entries("#{path}").collect {|name| name.slice(/[^\.]*/) }
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # * New method: character_exist?
  154.   #--------------------------------------------------------------------------
  155.   def character_exist?(filename)
  156.     file_exist?("Graphics/Characters/", filename)
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # * New method: battler_exist?
  160.   #--------------------------------------------------------------------------
  161.   def battler_exist?(filename)
  162.     file_exist?("Graphics/Battlers/", filename)
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # * New method: get_filename
  166.   #--------------------------------------------------------------------------
  167.   def get_filename
  168.     "["'“‘]([^"'”‘”’]+)["'”’]"
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # * New method: make_symbol
  172.   #--------------------------------------------------------------------------
  173.   def make_symbol(string)
  174.     string.downcase.gsub(" ", "_").to_sym
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # * New method: make_string
  178.   #--------------------------------------------------------------------------
  179.   def make_string(symbol)
  180.     symbol.to_s.gsub("_", " ").upcase
  181.   end
  182. end

  183. #==============================================================================
  184. # ** Numeric
  185. #------------------------------------------------------------------------------
  186. #  This is the abstract class for numbers.
  187. #==============================================================================

  188. class Numeric
  189.   #--------------------------------------------------------------------------
  190.   # * New method: numeric?
  191.   #--------------------------------------------------------------------------
  192.   def numeric?
  193.     return true
  194.   end
  195. end

  196. #==============================================================================
  197. # ** Float
  198. #------------------------------------------------------------------------------
  199. #  This is the abstract class for the floating point values.
  200. #==============================================================================

  201. class Float
  202.   #--------------------------------------------------------------------------
  203.   # * New method: float?
  204.   #--------------------------------------------------------------------------
  205.   def float?
  206.     return true
  207.   end
  208. end

  209. #==============================================================================
  210. # ** Array     
  211. #------------------------------------------------------------------------------
  212. #  This class store arbitrary Ruby objects.
  213. #==============================================================================

  214. class Array
  215.   #-------------------------------------------------------------------------
  216.   # * New method: random
  217.   #-------------------------------------------------------------------------
  218.   def random
  219.     self[rand(size)]
  220.   end
  221.   #-------------------------------------------------------------------------
  222.   # * New method: random!
  223.   #-------------------------------------------------------------------------
  224.   def random!
  225.     self.delete_at(rand(size))
  226.   end
  227.   #---------------------------------------------------------------------------
  228.   # * New method: sum
  229.   #---------------------------------------------------------------------------
  230.   def sum
  231.     self.inject(0) {|r, n| r += (n.numeric? ? n : 0)}
  232.   end
  233.   #---------------------------------------------------------------------------
  234.   # * New method: average
  235.   #---------------------------------------------------------------------------
  236.   def average(float = false)
  237.     self.sum / [(float ? size.to_f : size.to_i), 1].max
  238.   end
  239.   #---------------------------------------------------------------------------
  240.   # * New method: next_item
  241.   #---------------------------------------------------------------------------
  242.   def next_item
  243.     item = self.shift
  244.     self.push(item)
  245.     item
  246.   end
  247.   #---------------------------------------------------------------------------
  248.   # * New method: previous_item
  249.   #---------------------------------------------------------------------------
  250.   def previous_item
  251.     item = self.pop
  252.     self.unshift(item)
  253.     item
  254.   end
  255. end

  256. #==============================================================================
  257. # ** RPG::Troop::Page
  258. #------------------------------------------------------------------------------
  259. #  This is the data class for battle events (pages).
  260. #==============================================================================

  261. class RPG::Troop::Page
  262.   #--------------------------------------------------------------------------
  263.   # * New method: note
  264.   #--------------------------------------------------------------------------
  265.   def note
  266.     return "" if !@list || @list.size <= 0
  267.     comment_list = []
  268.     @list.each do |item|
  269.       next unless item && (item.code == 108 || item.code == 408)
  270.       comment_list.push(item.parameters[0])
  271.     end
  272.     comment_list.join("\r\n")
  273.   end
  274. end

  275. #==============================================================================
  276. # ** RPG::Skill
  277. #------------------------------------------------------------------------------
  278. #  This is the data class for skills.
  279. #==============================================================================

  280. class RPG::Skill
  281.   #--------------------------------------------------------------------------
  282.   # * New method: item?
  283.   #--------------------------------------------------------------------------
  284.   def item?
  285.     return false
  286.   end
  287.   #--------------------------------------------------------------------------
  288.   # * New method: skill?
  289.   #--------------------------------------------------------------------------
  290.   def skill?
  291.     return true
  292.   end
  293. end

  294. #==============================================================================
  295. # ** RPG::Item
  296. #------------------------------------------------------------------------------
  297. #  This is the data class for sitems.
  298. #==============================================================================

  299. class RPG::Item
  300.   #--------------------------------------------------------------------------
  301.   # * New method: item?
  302.   #--------------------------------------------------------------------------
  303.   def item?
  304.     return true
  305.   end
  306.   #--------------------------------------------------------------------------
  307.   # * New method: skill?
  308.   #--------------------------------------------------------------------------
  309.   def skill?
  310.     return false
  311.   end
  312. end

  313. #==============================================================================
  314. # ** RPG::UsableItem
  315. #------------------------------------------------------------------------------
  316. #  This is the superclass for skills and items.
  317. #==============================================================================

  318. class RPG::UsableItem < RPG::BaseItem
  319.   #--------------------------------------------------------------------------
  320.   # * New method: for_all_targets?
  321.   #--------------------------------------------------------------------------
  322.   def for_all_targets?
  323.     return false
  324.   end
  325. end

  326. #==============================================================================
  327. # ** Cache
  328. #------------------------------------------------------------------------------
  329. #  This module loads each of graphics, creates a Bitmap object, and retains it.
  330. # To speed up load times and conserve memory, this module holds the created
  331. # Bitmap object in the internal hash, allowing the program to return
  332. # preexisting objects when the same bitmap is requested again.
  333. #==============================================================================

  334. module Cache
  335.   #--------------------------------------------------------------------------
  336.   # * New method: character
  337.   #--------------------------------------------------------------------------
  338.   def self.character(filename, hue = 0)
  339.     load_bitmap("Graphics/Characters/", filename, hue)
  340.   end
  341. end

  342. #==============================================================================
  343. # ** Game_BattlerBase
  344. #------------------------------------------------------------------------------
  345. #  This class handles battlers. It's used as a superclass of the Game_Battler
  346. # classes.
  347. #==============================================================================

  348. class Game_BattlerBase
  349.   #--------------------------------------------------------------------------
  350.   # * Public Instance Variables
  351.   #--------------------------------------------------------------------------
  352.   attr_reader   :buffs
  353.   #--------------------------------------------------------------------------
  354.   # * New method: get_cond
  355.   #--------------------------------------------------------------------------
  356.   def get_cond(text)
  357.     case text.upcase
  358.     when "HIGHER"    then ">"
  359.     when "LOWER"     then "<"
  360.     when "EQUAL"     then "=="
  361.     when "DIFFERENT" then "!="
  362.     else "!="
  363.     end
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # * New method: get_param
  367.   #--------------------------------------------------------------------------
  368.   def get_param(text)
  369.     case text.upcase
  370.     when "MAXHP" then self.mhp
  371.     when "MAXMP" then self.mmp
  372.     when "MAXTP" then self.max_tp
  373.     else eval("self.#{text.downcase}")
  374.     end
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # * New method: get_param_id
  378.   #--------------------------------------------------------------------------
  379.   def get_param_id(text)
  380.     case text.upcase
  381.     when "MAXHP", "HP" then 0
  382.     when "MAXMP", "MP" then 1
  383.     when "ATK" then 2
  384.     when "DEF" then 3
  385.     when "MAT" then 4
  386.     when "MDF" then 5
  387.     when "AGI" then 6
  388.     when "LUK" then 7
  389.     end
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # * New method: danger?
  393.   #--------------------------------------------------------------------------
  394.   def danger?
  395.     hp < mhp * 25 / 100
  396.   end
  397. end

  398. #==============================================================================
  399. # ** Game_Enemy
  400. #------------------------------------------------------------------------------
  401. #  This class handles enemy characters. It's used within the Game_Troop class
  402. # ($game_troop).
  403. #==============================================================================

  404. class Game_Enemy < Game_Battler
  405.   #--------------------------------------------------------------------------
  406.   # * New method: note
  407.   #--------------------------------------------------------------------------
  408.   def note
  409.     enemy ? enemy.note : ""
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # * New method: get_all_notes
  413.   #--------------------------------------------------------------------------
  414.   def get_all_notes
  415.     result = note
  416.     states.compact.each {|state| result += state.note }
  417.     result
  418.   end
  419. end

  420. #==============================================================================
  421. # ** Game_Actor
  422. #------------------------------------------------------------------------------
  423. #  This class handles actors. It's used within the Game_Actors class
  424. # ($game_actors) and referenced by the Game_Party class ($game_party).
  425. #==============================================================================

  426. class Game_Actor < Game_Battler
  427.   #--------------------------------------------------------------------------
  428.   # * New method: note
  429.   #--------------------------------------------------------------------------
  430.   def note
  431.     actor ? actor.note : ""
  432.   end
  433.   #--------------------------------------------------------------------------
  434.   # * New method: hue
  435.   #--------------------------------------------------------------------------
  436.   def hue
  437.     @hue ? @hue : 0
  438.   end
  439.   #--------------------------------------------------------------------------
  440.   # * New method: get_all_notes
  441.   #--------------------------------------------------------------------------
  442.   def get_all_notes
  443.     result = note
  444.     result += self.class.note
  445.     equips.compact.each {|equip| result += equip.note }
  446.     states.compact.each {|state| result += state.note }
  447.     result
  448.   end
  449. end

  450. #==============================================================================
  451. # ** Game_Party
  452. #------------------------------------------------------------------------------
  453. #  This class handles the party. It includes information on amount of gold
  454. # and items. The instance of this class is referenced by $game_party.
  455. #==============================================================================

  456. class Game_Party < Game_Unit
  457.   #--------------------------------------------------------------------------
  458.   # * New method: average_level
  459.   #--------------------------------------------------------------------------
  460.   def average_level
  461.     battle_members.collect {|actor| actor.level }.average
  462.   end
  463. end

  464. #==============================================================================
  465. # ** Game_Map
  466. #------------------------------------------------------------------------------
  467. #  This class handles maps. It includes scrolling and passage determination
  468. # functions. The instance of this class is referenced by $game_map.
  469. #==============================================================================

  470. class Game_Map
  471.   #--------------------------------------------------------------------------
  472.   # * New method: event_list
  473.   #--------------------------------------------------------------------------
  474.   def event_list
  475.     events.values
  476.   end
  477.   #--------------------------------------------------------------------------
  478.   # * New method: note
  479.   #--------------------------------------------------------------------------
  480.   def note
  481.     @map ? @map.note : ""
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # * New method: vehicles
  485.   #--------------------------------------------------------------------------
  486.   def vehicles
  487.     @vehicles
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # * New method: actors
  491.   #--------------------------------------------------------------------------
  492.   def actors
  493.     [$game_player] + $game_player.followers.visible_folloers
  494.   end
  495. end

  496. #==============================================================================
  497. # ** Game_CharacterBase
  498. #------------------------------------------------------------------------------
  499. #  This class deals with characters. Common to all characters, stores basic
  500. # data, such as coordinates and graphics. It's used as a superclass of the
  501. # Game_Character class.
  502. #==============================================================================

  503. class Game_CharacterBase
  504.   #--------------------------------------------------------------------------
  505.   # * Public Instance Variables
  506.   #--------------------------------------------------------------------------
  507.   attr_accessor :move_speed
  508.   attr_accessor :move_frequency
  509.   #--------------------------------------------------------------------------
  510.   # * New method: is_player?
  511.   #--------------------------------------------------------------------------
  512.   def is_player?
  513.     return false
  514.   end
  515.   #--------------------------------------------------------------------------
  516.   # * New method: is_event?
  517.   #--------------------------------------------------------------------------
  518.   def is_event?
  519.     return false
  520.   end
  521.   #--------------------------------------------------------------------------
  522.   # * New method: is_follower?
  523.   #--------------------------------------------------------------------------
  524.   def is_follower?
  525.     return false
  526.   end
  527.   #--------------------------------------------------------------------------
  528.   # * New method: is_vehicle?
  529.   #--------------------------------------------------------------------------
  530.   def is_vehicle?
  531.     return false
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # * New method: frames
  535.   #--------------------------------------------------------------------------
  536.   def frames
  537.     return 3
  538.   end
  539.   #--------------------------------------------------------------------------
  540.   # * New method: hue
  541.   #--------------------------------------------------------------------------
  542.   def hue
  543.     @hue ? @hue : 0
  544.   end
  545. end

  546. #==============================================================================
  547. # ** Game_Player
  548. #------------------------------------------------------------------------------
  549. #  This class handles the player.
  550. # The instance of this class is referenced by $game_map.
  551. #==============================================================================

  552. class Game_Player < Game_Character
  553.   #--------------------------------------------------------------------------
  554.   # * New method: is_player?
  555.   #--------------------------------------------------------------------------
  556.   def is_player?
  557.     return true
  558.   end
  559.   #--------------------------------------------------------------------------
  560.   # * New method: perform_transfer
  561.   #--------------------------------------------------------------------------
  562.   def new_map_id
  563.     @new_map_id
  564.   end
  565.   #--------------------------------------------------------------------------
  566.   # * New method: hue
  567.   #--------------------------------------------------------------------------
  568.   def hue
  569.     actor ? actor.hue : 0
  570.   end
  571. end

  572. #==============================================================================
  573. # ** Game_Follower
  574. #------------------------------------------------------------------------------
  575. #  This class handles the followers. Followers are the actors of the party
  576. # that follows the leader in a line. It's used within the Game_Followers class.
  577. #==============================================================================

  578. class Game_Follower < Game_Character
  579.   #--------------------------------------------------------------------------
  580.   # * New method: is_follower?
  581.   #--------------------------------------------------------------------------
  582.   def is_follower?
  583.     return true
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # * New method: index
  587.   #--------------------------------------------------------------------------
  588.   def index
  589.     @member_index
  590.   end
  591. end

  592. #==============================================================================
  593. # ** Game_Vehicle
  594. #------------------------------------------------------------------------------
  595. #  This class handles vehicles. It's used within the Game_Map class. If there
  596. # are no vehicles on the current map, the coordinates is set to (-1,-1).
  597. #==============================================================================

  598. class Game_Vehicle < Game_Character
  599.   #--------------------------------------------------------------------------
  600.   # * New method: is_vehicle?
  601.   #--------------------------------------------------------------------------
  602.   def is_vehicle?
  603.     return true
  604.   end
  605.   #--------------------------------------------------------------------------
  606.   # * New method: map_id
  607.   #--------------------------------------------------------------------------
  608.   def map_id
  609.     @map_id
  610.   end
  611. end

  612. #==============================================================================
  613. # ** Game_Event
  614. #------------------------------------------------------------------------------
  615. #  This class deals with events. It handles functions including event page
  616. # switching via condition determinants, and running parallel process events.
  617. # It's used within the Game_Map class.
  618. #==============================================================================

  619. class Game_Event < Game_Character
  620.   #--------------------------------------------------------------------------
  621.   # * New method: name
  622.   #--------------------------------------------------------------------------
  623.   def name
  624.     @event.name
  625.   end
  626.   #--------------------------------------------------------------------------
  627.   # * New method: is_event?
  628.   #--------------------------------------------------------------------------
  629.   def is_event?
  630.     return true
  631.   end
  632.   #--------------------------------------------------------------------------
  633.   # * New method: note
  634.   #--------------------------------------------------------------------------
  635.   def note
  636.     return "" if !@page || !@page.list || @page.list.size <= 0
  637.     comment_list = []
  638.     @page.list.each do |item|
  639.       next unless item && (item.code == 108 || item.code == 408)
  640.       comment_list.push(item.parameters[0])
  641.     end
  642.     comment_list.join("\r\n")
  643.   end  
  644. end

  645. #==============================================================================
  646. # ** Game_Interpreter
  647. #------------------------------------------------------------------------------
  648. #  An interpreter for executing event commands. This class is used within the
  649. # Game_Map, Game_Troop, and Game_Event classes.
  650. #==============================================================================

  651. class Game_Interpreter
  652.   #--------------------------------------------------------------------------
  653.   # * Alias method: command_108
  654.   #--------------------------------------------------------------------------
  655.   alias :command_108_ve_basic_module :command_108
  656.   def command_108
  657.     command_108_ve_basic_module
  658.     comment_call
  659.   end
  660.   #--------------------------------------------------------------------------
  661.   # * New method: comment_call
  662.   #--------------------------------------------------------------------------
  663.   def comment_call
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   # * New method: note
  667.   #--------------------------------------------------------------------------
  668.   def note
  669.     @comments ? @comments.join("\r\n") : ""
  670.   end
  671. end

  672. #==============================================================================
  673. # ** Sprite_Character
  674. #------------------------------------------------------------------------------
  675. #  This sprite is used to display characters. It observes a instance of the
  676. # Game_Character class and automatically changes sprite conditions.
  677. #==============================================================================

  678. class Sprite_Character < Sprite_Base
  679.   #--------------------------------------------------------------------------
  680.   # * Overwrite method: set_character_bitmap
  681.   #--------------------------------------------------------------------------
  682.   def set_character_bitmap
  683.     update_character_info
  684.     set_bitmap
  685.     set_bitmap_position
  686.   end
  687.   #--------------------------------------------------------------------------
  688.   # * New method: center_y
  689.   #--------------------------------------------------------------------------
  690.   def actor?
  691.     @character.is_a?(Game_Player) || @character.is_a?(Game_Follower)
  692.   end
  693.   #--------------------------------------------------------------------------
  694.   # * New method: center_y
  695.   #--------------------------------------------------------------------------
  696.   def actor
  697.     actor? ? @character.actor : nil
  698.   end
  699.   #--------------------------------------------------------------------------
  700.   # * New method: update_character_info
  701.   #--------------------------------------------------------------------------
  702.   def update_character_info
  703.   end
  704.   #--------------------------------------------------------------------------
  705.   # * New method: hue
  706.   #--------------------------------------------------------------------------
  707.   def hue
  708.     @character.hue
  709.   end
  710.   #--------------------------------------------------------------------------
  711.   # * New method: set_bitmap
  712.   #--------------------------------------------------------------------------
  713.   def set_bitmap
  714.     self.bitmap = Cache.character(set_bitmap_name, hue)
  715.   end
  716.   #--------------------------------------------------------------------------
  717.   # * New method: set_bitmap_name
  718.   #--------------------------------------------------------------------------
  719.   def set_bitmap_name
  720.     @character_name
  721.   end
  722.   #--------------------------------------------------------------------------
  723.   # * New method: set_bitmap_position
  724.   #--------------------------------------------------------------------------
  725.   def set_bitmap_position
  726.     sign = get_sign
  727.     if sign && sign.include?('$')
  728.       @cw = bitmap.width / @character.frames
  729.       @ch = bitmap.height / 4
  730.     else
  731.       @cw = bitmap.width / (@character.frames * 4)
  732.       @ch = bitmap.height / 8
  733.     end
  734.     self.ox = @cw / 2
  735.     self.oy = @ch
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # * New method: get_sign
  739.   #--------------------------------------------------------------------------
  740.   def get_sign
  741.     @character_name[/^[\!\$]./]
  742.   end
  743. end

  744. #==============================================================================
  745. # ** Sprite_Battler
  746. #------------------------------------------------------------------------------
  747. #  This sprite is used to display battlers. It observes a instance of the
  748. # Game_Battler class and automatically changes sprite conditions.
  749. #==============================================================================

  750. class Sprite_Battler < Sprite_Base
  751.   #--------------------------------------------------------------------------
  752.   # * Public Instance Variables
  753.   #--------------------------------------------------------------------------
  754.   attr_accessor :dmg_mirror
  755.   #--------------------------------------------------------------------------
  756.   # * New method: center_x
  757.   #--------------------------------------------------------------------------
  758.   def center_x
  759.     self.ox
  760.   end
  761.   #--------------------------------------------------------------------------
  762.   # * New method: center_y
  763.   #--------------------------------------------------------------------------
  764.   def center_y
  765.     self.oy / 2
  766.   end  
  767. end

  768. #==============================================================================
  769. # ** Spriteset_Battle
  770. #------------------------------------------------------------------------------
  771. #  This class brings together battle screen sprites. It's used within the
  772. # Scene_Battle class.
  773. #==============================================================================

  774. class Spriteset_Battle
  775.   #--------------------------------------------------------------------------
  776.   # * New method: sprite
  777.   #--------------------------------------------------------------------------
  778.   def sprite(subject)
  779.     battler_sprites.compact.select {|sprite| sprite.battler == subject }.first
  780.   end
  781. end

  782. #==============================================================================
  783. # ** Window_Base
  784. #------------------------------------------------------------------------------
  785. #  This is a superclass of all windows in the game.
  786. #==============================================================================

  787. class Window_Base < Window
  788.   #--------------------------------------------------------------------------
  789.   # * Alias method: convert_escape_characters
  790.   #--------------------------------------------------------------------------
  791.   alias :convert_escape_ve_basic_module :convert_escape_characters
  792.   def convert_escape_characters(text)
  793.     result = text.to_s.clone
  794.     result = text_replace(result)
  795.     result = convert_escape_ve_basic_module(text)
  796.     result
  797.   end
  798.   #--------------------------------------------------------------------------
  799.   # * New method: text_replace
  800.   #--------------------------------------------------------------------------
  801.   def text_replace(result)
  802.     result.gsub!(/\r/) { "" }
  803.     result.gsub!(/\\/) { "\e" }
  804.     result
  805.   end
  806. end

  807. #==============================================================================
  808. # ** Scene_Battle
  809. #------------------------------------------------------------------------------
  810. #  This class performs battle screen processing.
  811. #==============================================================================

  812. class Scene_Battle < Scene_Base
  813.   #--------------------------------------------------------------------------
  814.   # * Public Instance Variables
  815.   #--------------------------------------------------------------------------
  816.   attr_reader   :spriteset
  817. end
复制代码




点评

@506859867 应该不会错看看是不是脚本冲突。。  发表于 2013-6-11 13:38
有错,800行那里  发表于 2013-6-4 00:35
你好!可以发这个脚本给我么?不知道为什么论坛复制下来的都用不了!谢谢!  发表于 2012-8-9 20:11
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部