Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Guest Sand Golem

SG Auto Battle

Recommended Posts

It's attached so I believe that the file must be still lurking on the site storage. I'm sure that the recent changes to the website is thehe reason why the link is broken.

 

Anyway, I found this from the ancient GDU:

http://z11.invisionfree.com/RMXP_Ultimate/index.php?showtopic=759

 

It's the same script by the same author. The only different is that it's 2008 version, while this thread is posted on 2012. Well I believe there's no update because there's no mention about it on the top post.

 

Hope this helps.

Share this post


Link to post
Share on other sites

Once Marked hands over the keys, I might be able to go searching for it. Though it looks like you already found it.

 

Just in case that other site disappears some day....

#==========================================================================
# ** SG Auto Battle
#==========================================================================
# by sandgolem
# Version 2
# January 15th, 2008
#==========================================================================

module SG
 AutoBattleBase = ['Automatic','Command','Run Away']
 AutoBattleCommands = ['Attack','Repeat','Wait']
 AutoBattleOpac = 160
 AutoBattleSwitch = 0
 AutoBattleX = 64
 AutoBattleY = 59
end

#==========================================================================
#
# To check for updates or find more scripts, visit:
#       http://www.gamebaker.com/rmxp/scripts/
# Our RMVX scripts: http://www.gamebaker.com/rmvx/scripts/
#
# Instructions: http://www.gamebaker.com/rmxp/scripts/e/auto-battle.php
# Discussion/Help: http://forums.gamebaker.com/showthread.php?t=9
#
#==========================================================================

if Object.const_defined?('SDK')
 SDK.log('SG Auto Battle', 'sandgolem', 2, '15.01.08')
 @sg_autobattle_disabled = true if !SDK.enabled?('SG Auto Battle')
end

if !@sg_autobattle_disabled
#--------------------------------------------------------------------------

begin
 SDK.log_overwrite(:Window_PartyCommand, :draw_item)
 SDK.log_overwrite(:Window_PartyCommand, :initialize)
 SDK.log_overwrite(:Window_PartyCommand, :update_cursor_rect)
rescue
end

class Window_PartyCommand < Window_Selectable
 def initialize
   super(0, 0, 640, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.back_opacity = 160
   @commands = SG::AutoBattleBase
   @item_max = 3
   @column_max = 3
   if !$game_switches[SG::AutoBattleSwitch]
     draw_item(0, normal_color)
   else
     draw_item(0, disabled_color)
   end
   draw_item(1, normal_color)
   draw_item(2, $game_temp.battle_can_escape ? normal_color : disabled_color)
   self.index = 1
   self.visible = false
   self.active = false
 end

 def draw_item(index, color)
   self.contents.font.color = color
   rect = Rect.new(65 + index * 170, 0, 150, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.draw_text(rect, @commands[index], 1)
 end

 def update_cursor_rect
   self.cursor_rect.set(65 + index * 170, 0, 150, 32)
 end
end

class Game_Actor < Game_Battler
 attr_accessor :sg_autoaction, :sg_autosecondary, :sg_autotargets
end

class Window_SG_Autobattle < Window_Selectable  
 def initialize
   super(SG::AutoBattleX,SG::AutoBattleY,182,128)
   @item_max = 3
   @commands = SG::AutoBattleCommands
   self.contents = Bitmap.new(150,96)
   self.visible = false
   self.back_opacity = SG::AutoBattleOpac
   self.index = 0
   redraw
 end

 def redraw
   self.contents.clear
   for i in 0...@item_max
     draw_item(i, normal_color)
   end
 end
 
 def draw_item(index, color)
   self.contents.font.color = color
   rect = Rect.new(4,32*index,self.contents.width-8,32)
   self.contents.fill_rect(rect,Color.new(0, 0, 0, 0))
   self.contents.draw_text(rect,@commands[index],1)
 end

 def disable_item(index)
   draw_item(index, disabled_color)
 end
end

class Scene_Battle
 alias_method :sg_autobattle_main, :main
 def main
   @sg_autowindow = Window_SG_Autobattle.new
   @sg_autowindow.active = false
   @sg_autowindow.visible = false
   sg_autobattle_main
   @sg_autowindow.dispose
 end
 
 alias_method :sg_autobattle_update, :update
 def update
   sg_autobattle_update
   if @sg_autowindow.active
     if @sg_autowindow.visible
       sg_update_autowindow
       @sg_autowindow.update
     else
       @sg_autowindow.visible = true
     end
   end
 end
 
 def sg_update_autowindow
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.buzzer_se)
     @sg_autowindow.active = false
     @sg_autowindow.visible = false
     @party_command_window.active = true
     @party_command_window.index = 1
     @phase = 2
   end
   if Input.trigger?(Input::C)
     case @sg_autowindow.index
     when 0
       sg_phase2_allbasic(0)
     when 1
       if $game_temp.battle_turn != 0
         sg_phase2_lastaction
       else
         $game_system.se_play($data_system.buzzer_se)
       end
     when 2
       sg_phase2_allbasic(1)
     end
   end
 end

 def sg_autowindow_setup
   if $game_switches[SG::AutoBattleSwitch]
     $game_system.se_play($data_system.buzzer_se)
     return
   end
   $game_system.se_play($data_system.decision_se)
   @party_command_window.active = false
   @sg_autowindow.active = true
   @phase = 1337
   if $game_temp.battle_turn != 0
     @sg_autowindow.redraw
     @sg_autowindow.index = 1
   else
     @sg_autowindow.disable_item(1)
   end
 end

 def update_phase2
   if Input.trigger?(Input::L)
     @party_command_window.index = 0
     sg_autowindow_setup
   end
   @party_command_window.index = 2 if Input.trigger?(Input::B)
   if Input.trigger?(Input::C)
     case @party_command_window.index
     when 0
       sg_autowindow_setup
     when 1
       $game_system.se_play($data_system.decision_se)
       start_phase3
     when 2
       sg_update2_escape_check
     end
     return
   end
 end

 def sg_update2_escape_check
   if !$game_temp.battle_can_escape
     $game_system.se_play($data_system.buzzer_se)
     return
   end
   $game_system.se_play($data_system.decision_se)
   update_phase2_escape
 end
 
 alias_method :sg_autobattle_start4, :start_phase4
 def start_phase4
   @sg_autowindow.active = false
   @sg_autowindow.visible = false
   for i in $game_party.actors
     i.sg_autoaction = i.current_action.kind
     i.sg_autosecondary = i.current_action.basic if i.sg_autoaction == 0
     i.sg_autosecondary = i.current_action.skill_id if i.sg_autoaction == 1
     i.sg_autosecondary = i.current_action.item_id if i.sg_autoaction == 2
     i.sg_autotargets = i.current_action.target_index
   end
   sg_autobattle_start4
 end
 
 def sg_phase2_allbasic(type)
   $game_system.se_play($data_system.decision_se)
   for i in $game_party.actors
     i.current_action.kind = 0
     i.current_action.basic = type
   end
   start_phase4
 end
 
 def sg_phase2_lastaction
   $game_system.se_play($data_system.decision_se)
   for i in $game_party.actors
     if i.sg_autoaction != nil
       i.current_action.kind = i.sg_autoaction
       i.current_action.basic = i.sg_autosecondary if i.sg_autoaction == 0
       i.current_action.skill_id = i.sg_autosecondary if i.sg_autoaction == 1
       i.current_action.item_id = i.sg_autosecondary if i.sg_autoaction == 2
       i.current_action.target_index = i.sg_autotargets
     else
       i.current_action.kind = 0
       i.current_action.basic = 0
     end
   end
   start_phase4
 end
end

#--------------------------------------------------------------------------
end

#==========================================================================
# End of file! You can find more of my scripts at http://www.gamebaker.com
#==========================================================================

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...