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

Project1

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

[已经过期] 问一下,有没有va的队友自动攻击脚本?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
492 小时
注册时间
2013-6-15
帖子
206
跳转到指定楼层
1
发表于 2013-9-12 17:24:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
rt,见到其他版有队友自动攻击系统,表示本va党也想要啊

Lv2.观梦者

梦石
0
星屑
585
在线时间
923 小时
注册时间
2011-5-11
帖子
438
2
发表于 2013-9-13 13:03:38 手机端发表。 | 只看该作者
本帖最后由 345912390 于 2013-9-13 18:54 编辑

简单的方法就是给角色加个自动战斗状态。如果角色有自动战斗状态再次.点击自动战斗命令时,取消那个态就可以了.

脚本搬运一一,没测试,不解释.
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Command Autobattle v1.01
  4. # -- Last Updated: 2011.12.26
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-CommandAutobattle"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2011.12.26 - Bug Fixed: Autobattle cancelled after each battle.
  17. # 2011.12.12 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # Anyone remember the Autobattle command from RPG Maker 2000? Well, now it's
  23. # back and you can choose to tack it onto the Party Command Window or the Actor
  24. # Command Window. When autobattle is selected, it will let the game determine
  25. # what action to use for the party and/or actors depending on the game's A.I.
  26. #
  27. # Furthermore, there is an option to have Autobattle continously remain in
  28. # effect if selected from the Party Command Window. When Autobattle is selected
  29. # in the Actor Command Window, it'll cause the game to automatically choose an
  30. # action for that actor instead.
  31. #
  32. # In addition to this, there exists the functionality of having all battle
  33. # members but the first member autobattle. This feature can be turned off.
  34. #
  35. #==============================================================================
  36. # ▼ Instructions
  37. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  38. # To install this script, open up your script editor and copy/paste this script
  39. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  40. #
  41. # Adjust the settings in the module to your liking.
  42. #
  43. #==============================================================================
  44. # ▼ Compatibility
  45. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  46. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  47. # it will run with RPG Maker VX without adjusting.
  48. #
  49. #==============================================================================
  50.  
  51. module YEA
  52.   module AUTOBATTLE
  53.  
  54.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  55.     # - Party Autobattle Command Settings -
  56.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  57.     # Adjust the command settings for Autobattle under the Party Command Window
  58.     # here. If you decide to let Party Autobattle be continuous, it will keep
  59.     # going until the player decides to cancel it with X.
  60.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  61.     ENABLE_PARTY_AUTOBATTLE = true      # Enables autobattle in Party Window.
  62.     PARTY_COMMAND_NAME  = "自动"        # Text that appears for Autobattle.
  63.     PARTY_SHOW_SWITCH   = 0             # Switch used to show Autobattle.
  64.     PARTY_ENABLE_SWITCH = 0             # Switch used to enable Autobattle.
  65.     # Note: For both of the switches, if they are set to 0, then the feature
  66.     # will not be used at all. The command will always be shown and/or the
  67.     # command will always be enabled.
  68.  
  69.     # These settings adjust continous autobattle. If enabled, these settings
  70.     # will be applied. Otherwise, they won't be.
  71.     ENABLE_CONTINOUS = true             # If true, autobattle is continous.
  72.     DISABLE_MESSAGE = "自动战斗中"
  73.  
  74.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  75.     # - Actor Autobattle Command Settings -
  76.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  77.     # Adjust the command settings for Autobattle under the Actor Command Window
  78.     # here. Actors do not have continous autobattle. Instead, they just simply
  79.     # choose whatever action the game decides is most suitable for them.
  80.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  81.     ENABLE_ACTOR_AUTOBATTLE = true      # Enables autobattle in Party Window.
  82.     ACTOR_COMMAND_NAME  = "自动"        # Text that appears for Autobattle.
  83.     ACTOR_SHOW_SWITCH   = 0             # Switch used to show Autobattle.
  84.     ACTOR_ENABLE_SWITCH = 0             # Switch used to enable Autobattle.
  85.     # Note: For both of the switches, if they are set to 0, then the feature
  86.     # will not be used at all. The command will always be shown and/or the
  87.     # command will always be enabled.
  88.  
  89.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  90.     # - Secondary Members Autobattle -
  91.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  92.     # For those who only want to grant command control to the first actor in
  93.     # battle, enable the setting below. All of the battle members who aren't
  94.     # first in line will automatically choose their action for the turn.
  95.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  96.     ENABLE_SECONDARY_AUTOBATTLE = false
  97.  
  98.   end # AUTOBATTLE
  99. end # YEA
  100.  
  101. #==============================================================================
  102. # ▼ Editting anything past this point may potentially result in causing
  103. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  104. # halitosis so edit at your own risk.
  105. #==============================================================================
  106.  
  107. #==============================================================================
  108. # ■ BattleManager
  109. #==============================================================================
  110.  
  111. module BattleManager
  112.  
  113.   #--------------------------------------------------------------------------
  114.   # alias method: process_victory
  115.   #--------------------------------------------------------------------------
  116.   class <<self; alias battlemanager_process_victory_cab process_victory; end
  117.   def self.process_victory
  118.     SceneManager.scene.close_disable_autobattle_window
  119.     return battlemanager_process_victory_cab
  120.   end
  121.  
  122.   #--------------------------------------------------------------------------
  123.   # alias method: process_abort
  124.   #--------------------------------------------------------------------------
  125.   class <<self; alias battlemanager_process_abort_cab process_abort; end
  126.   def self.process_abort
  127.     SceneManager.scene.close_disable_autobattle_window
  128.     return battlemanager_process_abort_cab
  129.   end
  130.  
  131.   #--------------------------------------------------------------------------
  132.   # alias method: process_defeat
  133.   #--------------------------------------------------------------------------
  134.   class <<self; alias battlemanager_process_defeat_cab process_defeat; end
  135.   def self.process_defeat
  136.     SceneManager.scene.close_disable_autobattle_window
  137.     return battlemanager_process_defeat_cab
  138.   end
  139.  
  140. end # BattleManager
  141.  
  142. #==============================================================================
  143. # ■ Game_Temp
  144. #==============================================================================
  145.  
  146. class Game_Temp
  147.  
  148.   #--------------------------------------------------------------------------
  149.   # public instance variables
  150.   #--------------------------------------------------------------------------
  151.   attr_accessor :continous_autobattle
  152.  
  153. end # Game_Temp
  154.  
  155. #==============================================================================
  156. # ■ Game_BattlerBase
  157. #==============================================================================
  158.  
  159. class Game_BattlerBase
  160.  
  161.   #--------------------------------------------------------------------------
  162.   # alias method: auto_battle?
  163.   #--------------------------------------------------------------------------
  164.   alias game_battlerbase_auto_battle_cab auto_battle?
  165.   def auto_battle?
  166.     return true if continuous_autobattle?
  167.     return true if secondary_auto_battle?
  168.     return game_battlerbase_auto_battle_cab
  169.   end
  170.  
  171.   #--------------------------------------------------------------------------
  172.   # new method: continuous_autobattle?
  173.   #--------------------------------------------------------------------------
  174.   def continuous_autobattle?
  175.     return false unless actor?
  176.     return $game_temp.continous_autobattle
  177.   end
  178.  
  179.   #--------------------------------------------------------------------------
  180.   # new method: secondary_auto_battle?
  181.   #--------------------------------------------------------------------------
  182.   def secondary_auto_battle?
  183.     return false unless actor?
  184.     return false if index == 0
  185.     return YEA::AUTOBATTLE::ENABLE_SECONDARY_AUTOBATTLE
  186.   end
  187.  
  188. end # Game_BattlerBase
  189.  
  190. #==============================================================================
  191. # ■ Game_Unit
  192. #==============================================================================
  193.  
  194. class Game_Unit
  195.  
  196.   #--------------------------------------------------------------------------
  197.   # alias method: make_actions
  198.   #--------------------------------------------------------------------------
  199.   alias game_unit_make_actions_cab make_actions
  200.   def make_actions
  201.     game_unit_make_actions_cab
  202.     refresh_autobattler_status_window
  203.   end
  204.  
  205.   #--------------------------------------------------------------------------
  206.   # new method: refresh_autobattler_status_window
  207.   #--------------------------------------------------------------------------
  208.   def refresh_autobattler_status_window
  209.     return unless SceneManager.scene_is?(Scene_Battle)
  210.     return unless self.is_a?(Game_Party)
  211.     SceneManager.scene.refresh_autobattler_status_window
  212.   end
  213.  
  214. end # Game_Unit
  215.  
  216. #==============================================================================
  217. # ■ Window_PartyCommand
  218. #==============================================================================
  219.  
  220. class Window_PartyCommand < Window_Command
  221.  
  222.   #--------------------------------------------------------------------------
  223.   # alias method: make_command_list
  224.   #--------------------------------------------------------------------------
  225.   alias window_partycommand_cab make_command_list
  226.   def make_command_list
  227.     window_partycommand_cab
  228.     return if $imported["YEA-BattleCommandList"]
  229.     add_autobattle_command if YEA::AUTOBATTLE::ENABLE_PARTY_AUTOBATTLE
  230.   end
  231.  
  232.   #--------------------------------------------------------------------------
  233.   # new method: add_autobattle_command
  234.   #--------------------------------------------------------------------------
  235.   def add_autobattle_command
  236.     return unless show_autobattle?
  237.     text = YEA::AUTOBATTLE::PARTY_COMMAND_NAME
  238.     add_command(text, :autobattle, enable_autobattle?)
  239.   end
  240.  
  241.   #--------------------------------------------------------------------------
  242.   # new method: show_autobattle?
  243.   #--------------------------------------------------------------------------
  244.   def show_autobattle?
  245.     return true if YEA::AUTOBATTLE::PARTY_SHOW_SWITCH <= 0
  246.     return $game_switches[YEA::AUTOBATTLE::PARTY_SHOW_SWITCH]
  247.   end
  248.  
  249.   #--------------------------------------------------------------------------
  250.   # new method: enable_autobattle?
  251.   #--------------------------------------------------------------------------
  252.   def enable_autobattle?
  253.     return true if YEA::AUTOBATTLE::PARTY_ENABLE_SWITCH <= 0
  254.     return $game_switches[YEA::AUTOBATTLE::PARTY_ENABLE_SWITCH]
  255.   end
  256.  
  257. end # Window_PartyCommand
  258.  
  259. #==============================================================================
  260. # ■ Window_ActorCommand
  261. #==============================================================================
  262.  
  263. class Window_ActorCommand < Window_Command
  264.  
  265.   #--------------------------------------------------------------------------
  266.   # alias method: make_command_list
  267.   #--------------------------------------------------------------------------
  268.   alias window_actorcommand_make_command_list_cab make_command_list
  269.   def make_command_list
  270.     return if @actor.nil?
  271.     unless $imported["YEA-BattleCommandList"]
  272.       add_autobattle_command if YEA::AUTOBATTLE::ENABLE_ACTOR_AUTOBATTLE
  273.     end
  274.     window_actorcommand_make_command_list_cab
  275.   end
  276.  
  277.   #--------------------------------------------------------------------------
  278.   # new method: add_autobattle_command
  279.   #--------------------------------------------------------------------------
  280.   def add_autobattle_command
  281.     return unless show_autobattle?
  282.     text = YEA::AUTOBATTLE::ACTOR_COMMAND_NAME
  283.     add_command(text, :autobattle, enable_autobattle?)
  284.   end
  285.  
  286.   #--------------------------------------------------------------------------
  287.   # new method: show_autobattle?
  288.   #--------------------------------------------------------------------------
  289.   def show_autobattle?
  290.     return true if YEA::AUTOBATTLE::ACTOR_SHOW_SWITCH <= 0
  291.     return $game_switches[YEA::AUTOBATTLE::ACTOR_SHOW_SWITCH]
  292.   end
  293.  
  294.   #--------------------------------------------------------------------------
  295.   # new method: enable_autobattle?
  296.   #--------------------------------------------------------------------------
  297.   def enable_autobattle?
  298.     return true if YEA::AUTOBATTLE::ACTOR_ENABLE_SWITCH <= 0
  299.     return $game_switches[YEA::AUTOBATTLE::ACTOR_ENABLE_SWITCH]
  300.   end
  301.  
  302. end # Window_ActorCommand
  303.  
  304. #==============================================================================
  305. # ■ Window_DisableAutobattle
  306. #==============================================================================
  307.  
  308. class Window_DisableAutobattle < Window_Base
  309.  
  310.   #--------------------------------------------------------------------------
  311.   # initialize
  312.   #--------------------------------------------------------------------------
  313.   def initialize
  314.     super(64, 0, Graphics.width - 128, fitting_height(1))
  315.     self.y = Graphics.height - fitting_height(1) + 12
  316.     self.opacity = 0
  317.     self.z = 1000
  318.     hide
  319.     refresh
  320.   end
  321.  
  322.   #--------------------------------------------------------------------------
  323.   # refresh
  324.   #--------------------------------------------------------------------------
  325.   def refresh
  326.     contents.clear
  327.     draw_background(contents.rect)
  328.     text = YEA::AUTOBATTLE::DISABLE_MESSAGE
  329.     draw_text(contents.rect, text, 1)
  330.   end
  331.  
  332.   #--------------------------------------------------------------------------
  333.   # draw_background
  334.   #--------------------------------------------------------------------------
  335.   def draw_background(rect)
  336.     temp_rect = rect.clone
  337.     temp_rect.width /= 2
  338.     contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
  339.     temp_rect.x = temp_rect.width
  340.     contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
  341.   end
  342.  
  343.   #--------------------------------------------------------------------------
  344.   # back_color1
  345.   #--------------------------------------------------------------------------
  346.   def back_color1; return Color.new(0, 0, 0, 192); end
  347.  
  348.   #--------------------------------------------------------------------------
  349.   # back_color2
  350.   #--------------------------------------------------------------------------
  351.   def back_color2; return Color.new(0, 0, 0, 0); end
  352.  
  353. end # Window_DisableAutobattle
  354.  
  355. #==============================================================================
  356. # ■ Scene_Battle
  357. #==============================================================================
  358.  
  359. class Scene_Battle < Scene_Base
  360.  
  361.   #--------------------------------------------------------------------------
  362.   # alias method: create_all_windows
  363.   #--------------------------------------------------------------------------
  364.   alias scene_battle_create_all_windows_cab create_all_windows
  365.   def create_all_windows
  366.     $game_temp.continous_autobattle = false
  367.     scene_battle_create_all_windows_cab
  368.     create_disable_autobattle_window
  369.   end
  370.  
  371.   #--------------------------------------------------------------------------
  372.   # alias method: create_party_command_window
  373.   #--------------------------------------------------------------------------
  374.   alias create_party_command_window_cab create_party_command_window
  375.   def create_party_command_window
  376.     create_party_command_window_cab
  377.     @party_command_window.set_handler(:autobattle, method(:command_pautobattle))
  378.   end
  379.  
  380.   #--------------------------------------------------------------------------
  381.   # new method: command_pautobattle
  382.   #--------------------------------------------------------------------------
  383.   def command_pautobattle
  384.     for member in $game_party.battle_members
  385.       next unless member.inputable?
  386.       member.make_auto_battle_actions
  387.     end
  388.     $game_temp.continous_autobattle = YEA::AUTOBATTLE::ENABLE_CONTINOUS
  389.     @disable_autobattle_window.show if $game_temp.continous_autobattle
  390.     refresh_autobattler_status_window
  391.     turn_start
  392.   end
  393.  
  394.   #--------------------------------------------------------------------------
  395.   # new method: create_disable_autobattle_window
  396.   #--------------------------------------------------------------------------
  397.   def create_disable_autobattle_window
  398.     @disable_autobattle_window = Window_DisableAutobattle.new
  399.   end
  400.  
  401.   #--------------------------------------------------------------------------
  402.   # alias method: update
  403.   #--------------------------------------------------------------------------
  404.   alias scene_battle_update_cab update
  405.   def update
  406.     scene_battle_update_cab
  407.     update_continous_autobattle_window
  408.   end
  409.  
  410.   #--------------------------------------------------------------------------
  411.   # alias method: update_basic
  412.   #--------------------------------------------------------------------------
  413.   alias scene_battle_update_basic_cab update_basic
  414.   def update_basic
  415.     scene_battle_update_basic_cab
  416.     update_continous_autobattle_window
  417.   end
  418.  
  419.   #--------------------------------------------------------------------------
  420.   # new method: update_continous_autobattle_window
  421.   #--------------------------------------------------------------------------
  422.   def update_continous_autobattle_window
  423.     return unless @disable_autobattle_window.visible
  424.     opacity = $game_message.visible ? 0 : 255
  425.     @disable_autobattle_window.contents_opacity = opacity
  426.     close_disable_autobattle_window if Input.press?(:B)
  427.   end
  428.  
  429.   #--------------------------------------------------------------------------
  430.   # new method: close_disable_autobattle_window
  431.   #--------------------------------------------------------------------------
  432.   def close_disable_autobattle_window
  433.     Sound.play_cancel if Input.press?(:B) && @disable_autobattle_window.visible
  434.     $game_temp.continous_autobattle = false
  435.     @disable_autobattle_window.hide
  436.   end
  437.  
  438.   #--------------------------------------------------------------------------
  439.   # alias method: create_actor_command_window
  440.   #--------------------------------------------------------------------------
  441.   alias create_actor_command_window_cab create_actor_command_window
  442.   def create_actor_command_window
  443.     create_actor_command_window_cab
  444.     @actor_command_window.set_handler(:autobattle, method(:command_aautobattle))
  445.   end
  446.  
  447.   #--------------------------------------------------------------------------
  448.   # new method: command_aautobattle
  449.   #--------------------------------------------------------------------------
  450.   def command_aautobattle
  451.     BattleManager.actor.make_auto_battle_actions
  452.     next_command
  453.   end
  454.  
  455.   #--------------------------------------------------------------------------
  456.   # new method: refresh_autobattler_status_window
  457.   #--------------------------------------------------------------------------
  458.   def refresh_autobattler_status_window
  459.     for member in $game_party.battle_members
  460.       next unless member.auto_battle?
  461.       @status_window.draw_item(member.index)
  462.     end
  463.   end
  464.  
  465. end # Scene_Battle
  466.  
  467. #==============================================================================
  468. #
  469. # ▼ End of File
  470. #
  471. #==============================================================================
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 16:18

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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