Advertisement
Archeia

Yanfly Engine Ace - Visual Battlers v1.01

Mar 30th, 2014
1,595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 25.93 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Visual Battlers v1.01
  4. # -- Last Updated: 2012.07.24
  5. # -- Level: Easy
  6. # -- Requires: n/a
  7. #
  8. # ▼ Modified by:
  9. # -- Yami
  10. # -- Kread-Ex
  11. # -- Archeia_Nessiah
  12. #==============================================================================
  13.  
  14. $imported = {} if $imported.nil?
  15. $imported["YEA-VisualBattlers"] = true
  16.  
  17. #==============================================================================
  18. # ▼ Updates
  19. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20. # 2012.12.18 - Added preset views and able to change direction in-game.
  21. # 2012.07.24 - Finished Script.
  22. # 2012.01.05 - Started Script.
  23. #
  24. #==============================================================================
  25. # ▼ Introduction
  26. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27. # This script provides a visual for all actors by default charsets. The actions
  28. # and movements are alike Final Fantasy 1, only move forward and backward when
  29. # start and finish actions.
  30. #
  31. #==============================================================================
  32. # ▼ Instructions
  33. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  34. # To change the player direction in-game, use the snippet below in a script
  35. # call:
  36. #
  37. # $game_system.party_direction = n
  38. #
  39. # To install this script, open up your script editor and copy/paste this script
  40. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  41. #
  42. #==============================================================================
  43. # ▼ Compatibility
  44. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  45. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  46. # it will run with RPG Maker VX without adjusting.
  47. #
  48. #==============================================================================
  49.  
  50. module YEA
  51.   module VISUAL_BATTLERS
  52.    
  53.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  54.     # - Party Location Setting -
  55.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  56.     # These settings are adjusted for Party Location. Each Actor will have
  57.     # coordinates calculated by below formula. There are two samples coordinates
  58.     # below, change PARTY_DIRECTION to the base index you want to use.
  59.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  60.     PARTY_DIRECTION = 6 # This direction is opposite from actual direction.
  61.    
  62.     PARTY_LOCATION_BASE_COORDINATES ={
  63.     # Index => [base_x, base_y, mod_x, mod_y],
  64.           2 => [   250,    290,    40,     0], #UP
  65.           4 => [   150,    280,    20,   -20], #LEFT
  66.           3 => [   460,    280,    30,   -10], #RIGHT
  67.           6 => [   460,    230,    20,    20], #DEFAULT RIGHT
  68.           8 => [   260,    230,    40,     0], #DOWN
  69.     } # Do not remove this.
  70.    
  71.     PARTY_LOCATION_FORMULA_X = "base_x + index * mod_x"
  72.     PARTY_LOCATION_FORMULA_Y = "base_y + index * mod_y"
  73.    
  74.   end # VISUAL_BATTLERS
  75. end # YEA
  76.  
  77. #==============================================================================
  78. #  ▼  Editting anything past this point may potentially result in causing
  79. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  80. # halitosis so edit at your own risk.
  81. #==============================================================================
  82.  
  83. #==============================================================================
  84. # ? ▼  Direction
  85. #==============================================================================
  86.  
  87. module Direction
  88.  
  89.   #--------------------------------------------------------------------------
  90.   # self.correct
  91.   #--------------------------------------------------------------------------
  92.   def self.correct(direction)
  93.     case direction
  94.     when 1; return 4
  95.     when 3; return 6
  96.     when 7; return 4
  97.     when 9; return 6
  98.     else; return direction
  99.     end
  100.   end
  101.  
  102.   #--------------------------------------------------------------------------
  103.   # self.opposite
  104.   #--------------------------------------------------------------------------
  105.   def self.opposite(direction)
  106.     case direction
  107.     when 1; return 6
  108.     when 2; return 8
  109.     when 3; return 4
  110.     when 4; return 6
  111.     when 6; return 4
  112.     when 7; return 6
  113.     when 8; return 2
  114.     when 9; return 4
  115.     else; return direction
  116.     end
  117.   end
  118.  
  119. end # Direction
  120.  
  121. #==============================================================================
  122. # ? ▼  Game_System
  123. #==============================================================================
  124.  
  125. class Game_System; attr_accessor :party_direction; end
  126.  
  127. #==============================================================================
  128. # ? ▼  Game_BattleCharacter
  129. #==============================================================================
  130.  
  131. class Game_BattleCharacter < Game_Character
  132.  
  133.   #--------------------------------------------------------------------------
  134.   # initialize
  135.   #--------------------------------------------------------------------------
  136.   def initialize(actor)
  137.     super()
  138.     setup_actor(actor)
  139.     @move_x_rate = 0
  140.     @move_y_rate = 0
  141.   end
  142.  
  143.   #--------------------------------------------------------------------------
  144.   # setup_actor
  145.   #--------------------------------------------------------------------------
  146.   def setup_actor(actor)
  147.     @actor = actor
  148.     @step_anime = true
  149.     set_graphic(@actor.character_name, @actor.character_index)
  150.     setup_coordinates
  151.     dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION
  152.     direction = Direction.opposite(dr)
  153.     set_direction(Direction.correct(direction))
  154.   end
  155.  
  156.   #--------------------------------------------------------------------------
  157.   # sprite=
  158.   #--------------------------------------------------------------------------
  159.   def sprite=(sprite)
  160.     @sprite = sprite
  161.   end
  162.  
  163.   #--------------------------------------------------------------------------
  164.   # setup_coordinates
  165.   #--------------------------------------------------------------------------
  166.   def setup_coordinates
  167.     location = ($game_system.party_direction ||
  168.     YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
  169.     base_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][0]
  170.     base_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][1]
  171.     mod_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][2]
  172.     mod_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][3]
  173.     @actor.screen_x = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_X)
  174.     @actor.screen_y = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_Y)
  175.     @actor.origin_x = @actor.screen_x
  176.     @actor.origin_y = @actor.screen_y
  177.     @actor.create_move_to(screen_x, screen_y, 1)
  178.   end
  179.  
  180.   #--------------------------------------------------------------------------
  181.   # index
  182.   #--------------------------------------------------------------------------
  183.   def index
  184.     return @actor.index
  185.   end
  186.  
  187.   #--------------------------------------------------------------------------
  188.   # screen_x
  189.   #--------------------------------------------------------------------------
  190.   def screen_x
  191.     return @actor.screen_x
  192.   end
  193.  
  194.   #--------------------------------------------------------------------------
  195.   # screen_y
  196.   #--------------------------------------------------------------------------
  197.   def screen_y
  198.     return @actor.screen_y
  199.   end
  200.  
  201.   #--------------------------------------------------------------------------
  202.   # screen_z
  203.   #--------------------------------------------------------------------------
  204.   def screen_z
  205.     return @actor.screen_z
  206.   end
  207.  
  208. end # Game_BattleCharacter
  209.  
  210. #==============================================================================
  211. # ? ▼  Game_Battler
  212. #==============================================================================
  213.  
  214. class Game_Battler < Game_BattlerBase
  215.  
  216.   #--------------------------------------------------------------------------
  217.   # public instance variables
  218.   #--------------------------------------------------------------------------
  219.   attr_accessor :moved_back
  220.   attr_accessor :origin_x
  221.   attr_accessor :origin_y
  222.   attr_accessor :screen_x
  223.   attr_accessor :screen_y
  224.   attr_accessor :started_turn
  225.  
  226.   #--------------------------------------------------------------------------
  227.   # alias method: execute_damage
  228.   #--------------------------------------------------------------------------
  229.   alias game_battler_execute_damage_vb execute_damage
  230.   def execute_damage(user)
  231.     game_battler_execute_damage_vb(user)
  232.     if @result.hp_damage > 0
  233.       move_backward(24, 6) unless @moved_back
  234.       @moved_back = true
  235.     end
  236.   end
  237.  
  238.   #--------------------------------------------------------------------------
  239.   # face_opposing_party
  240.   #--------------------------------------------------------------------------
  241.   def face_opposing_party
  242.     direction = ($game_system.party_direction ||
  243.     YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
  244.     character.set_direction(Direction.correct(direction)) rescue 0
  245.   end
  246.  
  247.   #--------------------------------------------------------------------------
  248.   # new method: face_coordinate
  249.   #--------------------------------------------------------------------------
  250.   def face_coordinate(destination_x, destination_y)
  251.     x1 = Integer(@screen_x)
  252.     x2 = Integer(destination_x)
  253.     y1 = Graphics.height - Integer(@screen_y)
  254.     y2 = Graphics.height - Integer(destination_y)
  255.     return if x1 == x2 and y1 == y2
  256.     #---
  257.     angle = Integer(Math.atan2((y2-y1),(x2-x1)) * 1800 / Math::PI)
  258.     if (0..225) === angle or (-225..0) === angle
  259.       direction = 6
  260.     elsif (226..675) === angle
  261.       direction = 9
  262.     elsif (676..1125) === angle
  263.       direction = 8
  264.     elsif (1126..1575) === angle
  265.       direction = 7
  266.     elsif (1576..1800) === angle or (-1800..-1576) === angle
  267.       direction = 4
  268.     elsif (-1575..-1126) === angle
  269.       direction = 1
  270.     elsif (-1125..-676) === angle
  271.       direction = 2
  272.     elsif (-675..-226) === angle
  273.       direction = 3
  274.     end
  275.     #---
  276.     character.set_direction(Direction.correct(direction)) rescue 0
  277.   end
  278.  
  279.   #--------------------------------------------------------------------------
  280.   # create_move_to
  281.   #--------------------------------------------------------------------------
  282.   def create_move_to(destination_x, destination_y, frames = 12)
  283.     @destination_x = destination_x
  284.     @destination_y = destination_y
  285.     frames = [frames, 1].max
  286.     @move_x_rate = [(@screen_x - @destination_x).abs / frames, 2].max
  287.     @move_y_rate = [(@screen_y - @destination_y).abs / frames, 2].max
  288.   end
  289.  
  290.   #--------------------------------------------------------------------------
  291.   # update_move_to
  292.   #--------------------------------------------------------------------------
  293.   def update_move_to
  294.     @move_x_rate = 0 if @screen_x == @destination_x || @move_x_rate.nil?
  295.     @move_y_rate = 0 if @screen_y == @destination_y || @move_y_rate.nil?
  296.     value = [(@screen_x - @destination_x).abs, @move_x_rate].min
  297.     @screen_x += (@destination_x > @screen_x) ? value : -value
  298.     value = [(@screen_y - @destination_y).abs, @move_y_rate].min
  299.     @screen_y += (@destination_y > @screen_y) ? value : -value
  300.   end
  301.  
  302.   #--------------------------------------------------------------------------
  303.   # move_forward
  304.   #--------------------------------------------------------------------------
  305.   def move_forward(distance = 24, frames = 12)
  306.     direction = forward_direction
  307.     move_direction(direction, distance, frames)
  308.   end
  309.  
  310.   #--------------------------------------------------------------------------
  311.   # move_backward
  312.   #--------------------------------------------------------------------------
  313.   def move_backward(distance = 24, frames = 12)
  314.     direction = Direction.opposite(forward_direction)
  315.     move_direction(direction, distance, frames)
  316.   end
  317.  
  318.   #--------------------------------------------------------------------------
  319.   # move_direction
  320.   #--------------------------------------------------------------------------
  321.   def move_direction(direction, distance = 24, frames = 12)
  322.     case direction
  323.     when 1; move_x = distance / -2; move_y = distance /  2
  324.     when 2; move_x = distance *  0; move_y = distance *  1
  325.     when 3; move_x = distance / -2; move_y = distance /  2
  326.     when 4; move_x = distance * -1; move_y = distance *  0
  327.     when 6; move_x = distance *  1; move_y = distance *  0
  328.     when 7; move_x = distance / -2; move_y = distance / -2
  329.     when 8; move_x = distance *  0; move_y = distance * -1
  330.     when 9; move_x = distance /  2; move_y = distance / -2
  331.     else; return
  332.     end
  333.     destination_x = @screen_x + move_x
  334.     destination_y = @screen_y + move_y
  335.     create_move_to(destination_x, destination_y, frames)
  336.   end
  337.  
  338.   #--------------------------------------------------------------------------
  339.   # forward_direction
  340.   #--------------------------------------------------------------------------
  341.   def forward_direction
  342.     return ($game_system.party_direction ||
  343.     YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
  344.   end
  345.  
  346.   #--------------------------------------------------------------------------
  347.   # move_origin
  348.   #--------------------------------------------------------------------------
  349.   def move_origin
  350.     create_move_to(@origin_x, @origin_y)
  351.     face_coordinate(@origin_x, @origin_y)
  352.     @moved_back = false
  353.   end
  354.  
  355.   #--------------------------------------------------------------------------
  356.   # moving?
  357.   #--------------------------------------------------------------------------
  358.   def moving?
  359.     return false if dead? || !exist?
  360.     return @move_x_rate != 0 || @move_y_rate != 0
  361.   end
  362.  
  363. end # Game_Battler
  364.  
  365. #==============================================================================
  366. # ? ▼  Game_Actor
  367. #==============================================================================
  368.  
  369. class Game_Actor < Game_Battler
  370.  
  371.   #--------------------------------------------------------------------------
  372.   # overwrite method: use_sprite?
  373.   #--------------------------------------------------------------------------
  374.   def use_sprite?
  375.     return true
  376.   end
  377.  
  378.   #--------------------------------------------------------------------------
  379.   # new method: screen_x
  380.   #--------------------------------------------------------------------------
  381.   def screen_x
  382.     return @screen_x rescue 0
  383.   end
  384.  
  385.   #--------------------------------------------------------------------------
  386.   # new method: screen_y
  387.   #--------------------------------------------------------------------------
  388.   def screen_y
  389.     return @screen_y rescue 0
  390.   end
  391.  
  392.   #--------------------------------------------------------------------------
  393.   # new method: screen_z
  394.   #--------------------------------------------------------------------------
  395.   def screen_z
  396.     return 100
  397.   end
  398.  
  399.   #--------------------------------------------------------------------------
  400.   # new method: sprite
  401.   #--------------------------------------------------------------------------
  402.   def sprite
  403.     index = $game_party.battle_members.index(self)
  404.     return SceneManager.scene.spriteset.actor_sprites[index]
  405.   end
  406.  
  407.   #--------------------------------------------------------------------------
  408.   # new method: character
  409.   #--------------------------------------------------------------------------
  410.   def character
  411.     return sprite.character_base
  412.   end
  413.  
  414.   #--------------------------------------------------------------------------
  415.   # face_opposing_party
  416.   #--------------------------------------------------------------------------
  417.   def face_opposing_party
  418.     dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION
  419.     direction = Direction.opposite(dr)
  420.     character.set_direction(Direction.correct(direction)) rescue 0
  421.   end
  422.  
  423.   #--------------------------------------------------------------------------
  424.   # forward_direction
  425.   #--------------------------------------------------------------------------
  426.   def forward_direction
  427.     return Direction.opposite(($game_system.party_direction ||
  428.     YEA::VISUAL_BATTLERS::PARTY_DIRECTION))
  429.   end
  430.  
  431. end # Game_Actor
  432.  
  433. #==============================================================================
  434. # ? ▼  Game_Enemy
  435. #==============================================================================
  436.  
  437. class Game_Enemy < Game_Battler
  438.  
  439.   #--------------------------------------------------------------------------
  440.   # new method: sprite
  441.   #--------------------------------------------------------------------------
  442.   def sprite
  443.     return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
  444.   end
  445.  
  446.   #--------------------------------------------------------------------------
  447.   # new method: character
  448.   #--------------------------------------------------------------------------
  449.   def character
  450.     return sprite
  451.   end
  452.  
  453. end # Game_Enemy
  454.  
  455. #==============================================================================
  456. # ? ▼  Game_Troop
  457. #==============================================================================
  458.  
  459. class Game_Troop < Game_Unit
  460.  
  461.   #--------------------------------------------------------------------------
  462.   # alias method: setup
  463.   #--------------------------------------------------------------------------
  464.   alias game_troop_setup_vb setup
  465.   def setup(troop_id)
  466.     game_troop_setup_vb(troop_id)
  467.     set_coordinates
  468.   end
  469.  
  470.   #--------------------------------------------------------------------------
  471.   # new method: set_coordinates
  472.   #--------------------------------------------------------------------------
  473.   def set_coordinates
  474.     for member in members
  475.       member.origin_x = member.screen_x
  476.       member.origin_y = member.screen_y
  477.       member.create_move_to(member.screen_x, member.screen_y, 1)
  478.     end
  479.   end
  480.  
  481. end # Game_Troop
  482.  
  483. #==============================================================================
  484. # ? ▼  Sprite_Battler
  485. #==============================================================================
  486.  
  487. class Sprite_Battler < Sprite_Base
  488.  
  489.   #--------------------------------------------------------------------------
  490.   # public instance_variable
  491.   #--------------------------------------------------------------------------
  492.   attr_accessor :character_base
  493.   attr_accessor :character_sprite
  494.  
  495.   #--------------------------------------------------------------------------
  496.   # alias method: dispose
  497.   #--------------------------------------------------------------------------
  498.   alias sprite_battler_dispose_vb dispose
  499.   def dispose
  500.     dispose_character_sprite
  501.     sprite_battler_dispose_vb
  502.   end
  503.  
  504.   #--------------------------------------------------------------------------
  505.   # new method: dispose_character_sprite
  506.   #--------------------------------------------------------------------------
  507.   def dispose_character_sprite
  508.     @character_sprite.dispose unless @character_sprite.nil?
  509.   end
  510.  
  511.   #--------------------------------------------------------------------------
  512.   # alias method: update
  513.   #--------------------------------------------------------------------------
  514.   alias sprite_battler_update_vb update
  515.   def update
  516.     sprite_battler_update_vb
  517.     return if @battler.nil?
  518.     update_move_to
  519.     update_character_base
  520.     update_character_sprite
  521.   end
  522.  
  523.   #--------------------------------------------------------------------------
  524.   # new method: update_character_base
  525.   #--------------------------------------------------------------------------
  526.   def update_character_base
  527.     return if @character_base.nil?
  528.     @character_base.update
  529.   end
  530.  
  531.   #--------------------------------------------------------------------------
  532.   # new method: update_character_sprite
  533.   #--------------------------------------------------------------------------
  534.   def update_character_sprite
  535.     return if @character_sprite.nil?
  536.     @character_sprite.update
  537.   end
  538.  
  539.   #--------------------------------------------------------------------------
  540.   # new method: update_move_to
  541.   #--------------------------------------------------------------------------
  542.   def update_move_to
  543.     @battler.update_move_to
  544.   end
  545.  
  546.   #--------------------------------------------------------------------------
  547.   # new method: moving?
  548.   #--------------------------------------------------------------------------
  549.   def moving?
  550.     return false if @battler.nil?
  551.     return @battler.moving?
  552.   end
  553.  
  554. end # Sprite_Battler
  555.  
  556. #==============================================================================
  557. # ? ▼  Sprite_BattleCharacter
  558. #==============================================================================
  559.  
  560. class Sprite_BattleCharacter < Sprite_Character
  561.  
  562.   #--------------------------------------------------------------------------
  563.   # initialize
  564.   #--------------------------------------------------------------------------
  565.   def initialize(viewport, character = nil)
  566.     super(viewport, character)
  567.     character.sprite = self
  568.   end
  569.  
  570. end # Sprite_BattleCharacter
  571.  
  572. #==============================================================================
  573. # ? ▼  Spriteset_Battle
  574. #==============================================================================
  575.  
  576. class Spriteset_Battle
  577.  
  578.   #--------------------------------------------------------------------------
  579.   # public instance_variable
  580.   #--------------------------------------------------------------------------
  581.   attr_accessor :actor_sprites
  582.   attr_accessor :enemy_sprites
  583.  
  584.   #--------------------------------------------------------------------------
  585.   # overwrite method: create_actors
  586.   #--------------------------------------------------------------------------
  587.   def create_actors
  588.     total = $game_party.max_battle_members
  589.     @current_party = $game_party.battle_members.clone
  590.     @actor_sprites = Array.new(total) { Sprite_Battler.new(@viewport1) }
  591.     for actor in $game_party.battle_members
  592.       @actor_sprites[actor.index].battler = actor
  593.       create_actor_sprite(actor)
  594.     end
  595.   end
  596.  
  597.   #--------------------------------------------------------------------------
  598.   # new method: create_actor_sprite
  599.   #--------------------------------------------------------------------------
  600.   def create_actor_sprite(actor)
  601.     character = Game_BattleCharacter.new(actor)
  602.     character_sprite = Sprite_BattleCharacter.new(@viewport1, character)
  603.     @actor_sprites[actor.index].character_base = character
  604.     @actor_sprites[actor.index].character_sprite = character_sprite
  605.     actor.face_opposing_party
  606.   end
  607.  
  608.   #--------------------------------------------------------------------------
  609.   # alias method: update_actors
  610.   #--------------------------------------------------------------------------
  611.   alias spriteset_battle_update_actors_vb update_actors
  612.   def update_actors
  613.     if @current_party != $game_party.battle_members
  614.       dispose_actors
  615.       create_actors
  616.     end
  617.     spriteset_battle_update_actors_vb
  618.   end
  619.  
  620.   #--------------------------------------------------------------------------
  621.   # new method: moving?
  622.   #--------------------------------------------------------------------------
  623.   def moving?
  624.     return battler_sprites.any? {|sprite| sprite.moving? }
  625.   end
  626.  
  627. end # Spriteset_Battle
  628.  
  629. #==============================================================================
  630. # ? ▼  Scene_Battle
  631. #==============================================================================
  632.  
  633. class Scene_Battle < Scene_Base
  634.  
  635.   #--------------------------------------------------------------------------
  636.   # public instance variables
  637.   #--------------------------------------------------------------------------
  638.   attr_accessor :spriteset
  639.  
  640.   #--------------------------------------------------------------------------
  641.   # alias method: process_action_end
  642.   #--------------------------------------------------------------------------
  643.   alias scene_battle_process_action_end_vb process_action_end
  644.   def process_action_end
  645.     start_battler_move_origin
  646.     scene_battle_process_action_end_vb
  647.   end
  648.  
  649.   #--------------------------------------------------------------------------
  650.   # alias method: execute_action
  651.   #--------------------------------------------------------------------------
  652.   alias scene_battle_execute_action_vb execute_action
  653.   def execute_action
  654.     start_battler_move_forward
  655.     scene_battle_execute_action_vb
  656.   end
  657.  
  658.   #--------------------------------------------------------------------------
  659.   # new method: start_battler_move_forward
  660.   #--------------------------------------------------------------------------
  661.   def start_battler_move_forward
  662.     return if @subject.started_turn
  663.     @subject.started_turn = true
  664.     @subject.move_forward
  665.     wait_for_moving
  666.   end
  667.  
  668.   #--------------------------------------------------------------------------
  669.   # new method: start_battler_move_origin
  670.   #--------------------------------------------------------------------------
  671.   def start_battler_move_origin
  672.     @subject.started_turn = nil
  673.     move_battlers_origin
  674.     wait_for_moving
  675.     @subject.face_opposing_party rescue 0
  676.   end
  677.  
  678.   #--------------------------------------------------------------------------
  679.   # new method: move_battlers_origin
  680.   #--------------------------------------------------------------------------
  681.   def move_battlers_origin
  682.     for member in all_battle_members
  683.       next if member.dead?
  684.       next unless member.exist?
  685.       member.move_origin
  686.     end
  687.   end
  688.  
  689.   #--------------------------------------------------------------------------
  690.   # new method: wait_for_moving
  691.   #--------------------------------------------------------------------------
  692.   def wait_for_moving
  693.     update_for_wait
  694.     update_for_wait while @spriteset.moving?
  695.   end
  696.  
  697. end # Scene_Battle
  698.  
  699. #==============================================================================
  700. #
  701. #  ▼  End of File
  702. #
  703. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement