Make an enemy move in battle.

I need a script that makes the enemy sprite move in battle, changing its position on the battlefield, just like a picture, using X and Y coordinates. An example of how an enemy can move is like the Demon Wall from Final Fantasy IV: each turn, the Demon Wall moves closer to the player characters (in sideview perspective, the system I'm using in my project), coming from the left to the right of the screen. So, can someone please do a script that does this for me?
that is a bit more complex than you think, especially if you already changed to sideview scripts.
at minimum you would have to give a link to the websites of the sideview script you're using, so that someone can check if this is even possible with that script.
Oh, but the sideview system that I'm using is just Victor's Actors Battlers, who merely give the playable characters a visible sprite, using a battler sprite.
doesn't matter what it does or how it works, whoever helps you needs to see the code to guarantee compatibility.
I'm using is just Victor's Actors Battlers,
"Just using Actor Battlers" is not a "I'm just using the most simplest side view script ever"
Far from it.

The solution may be simple though.
Since you are using VS actor battlers, you must have VS animated battlers.
So all you need to do is set a condition to have the enemy after each turn to perform an action.
In that action you program whatever you want the character to do.
I don't use animated battlers because the actor sprites will be static, like in old Pokemon games, and I don't have the talent to make animated sprites.
changing its position on the battlefield
I wrote this to align with the built in code.
You need to set the formation to custom and then you can use this.
Spoiler: R2 - Move Battler for Victor Sant Actor Battlers
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Move Battler                 ║  Version: 1.01     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║   Move the position of the battler  ╠════════════════════╣
# ║   use for Victor Sant Actor Battler ║    20 Jul 2023     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║   Use comments to utilize the scripts custom position    ║
# ║   function to move the battlers.                         ║
# ║                                                          ║
# ║   Move left and up                                       ║
# ║     comment: <advance position pos: x, y>                ║
# ║       pos is the actor position number in the custom     ║
# ║       settings. i.e. 1, 2, 3, 4                          ║
# ║       x is the amount to move the battler left           ║
# ║       y is the amount to move the battler up             ║
# ║                                                          ║
# ║   Move right and down                                    ║
# ║     comment: <reverse position pos: x, y>                ║
# ║       pos is the actor position number in the custom     ║
# ║       settings. i.e. 1, 2, 3, 4                          ║
# ║       x is the amount to move the battler right          ║
# ║       y is the amount to move the battler down           ║
# ║                                                          ║
# ║   The comment does not accept negative numbers.          ║
# ║   This is why there are two comments.                    ║
# ║                                                          ║
# ║   Repeat the same as above for enemies                   ║
# ║                                                          ║
# ║   Move left and up                                       ║
# ║     comment: <enemy advance position pos: x, y>          ║
# ║       pos is the actor position number in the custom     ║
# ║       settings. i.e. 1, 2, 3, 4                          ║
# ║       x is the amount to move the battler left           ║
# ║       y is the amount to move the battler up             ║
# ║                                                          ║
# ║   Move right and down                                    ║
# ║     comment: <enemy reverse position pos: x, y>          ║
# ║       pos is the actor position number in the custom     ║
# ║       settings. i.e. 1, 2, 3, 4                          ║
# ║       x is the amount to move the battler right          ║
# ║       y is the amount to move the battler down           ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker - Except Nudity           ║
# ╚══════════════════════════════════════════════════════════╝


class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Alias method: comment_call
  #--------------------------------------------------------------------------
  alias :r2_comment_call_actor_battlers :comment_call
  def comment_call
    advance_position
    reverse_position
    enemy_advance_position
    enemy_reverse_position
    r2_comment_call_actor_battlers
  end
  #--------------------------------------------------------------------------
  # * New method: advance_position
  #--------------------------------------------------------------------------
  def advance_position
    regexp = /<ADVANCE[ _-]POSITION[ _-](\d+):[ _-](\d+),[ _-](\d+)>/i
    note.scan(regexp) do |i, x, y|
      $game_custom_positions[i.to_i][:x] = $game_custom_positions[i.to_i][:x] - x.to_i
      $game_custom_positions[i.to_i][:y] = $game_custom_positions[i.to_i][:y] - y.to_i
    end
  end
  #--------------------------------------------------------------------------
  # * New method: reverse_position
  #--------------------------------------------------------------------------
  def reverse_position
    regexp = /<REVERSE[ _-]POSITION[ _-](\d+):[ _-](\d+),[ _-](\d+)>/i
    note.scan(regexp) do |i, x, y|
      $game_custom_positions[i.to_i][:x] = $game_custom_positions[i.to_i][:x] + x.to_i
      $game_custom_positions[i.to_i][:y] = $game_custom_positions[i.to_i][:y] + y.to_i
    end
  end
  #--------------------------------------------------------------------------
  # * New method: enemy_advance_position
  #--------------------------------------------------------------------------
  def enemy_advance_position
    regexp = /<ENEMY[ _-]ADVANCE[ _-]POSITION[ _-](\d+):[ _-](\d+),[ _-](\d+)>/i
    note.scan(regexp) do |i, x, y|
      $game_troop.members[i.to_i].screen_x -= x.to_i
      $game_troop.members[i.to_i].screen_y -= y.to_i
    end
  end
  #--------------------------------------------------------------------------
  # * New method: enemy_reverse_position
  #--------------------------------------------------------------------------
  def enemy_reverse_position
    regexp = /<ENEMY[ _-]REVERSE[ _-]POSITION[ _-](\d+):[ _-](\d+),[ _-](\d+)>/i
    note.scan(regexp) do |i, x, y|
      $game_troop.members[i.to_i].screen_x += x.to_i
      $game_troop.members[i.to_i].screen_y += y.to_i
    end
  end
end

How you control which battler to move I leave to you to figure out.
In my tests I placed this in a comment event and called the CE from the skill used.
I wrote this to align with the built in code.
You need to set the formation to custom and then you can use this.
Spoiler: R2 - Move Battler for Victor Sant Actor Battlers
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Move Battler                 ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║   Move the position of the battler  ╠════════════════════╣
# ║   use for Victor Sant Actor Battler ║    20 Jul 2023     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║   Use comments to utilize the scripts custom position    ║
# ║   function to move the battlers.                         ║
# ║                                                          ║
# ║   Move left and up                                       ║
# ║     comment: <advance position pos: x, y>                ║
# ║       pos is the actor position number in the custom     ║
# ║       settings. i.e. 1, 2, 3, 4                          ║
# ║       x is the amount to move the battler left           ║
# ║       y is the amount to move the battler up             ║
# ║                                                          ║
# ║   Move right and down                                    ║
# ║     comment: <reverse position pos: x, y>                ║
# ║       pos is the actor position number in the custom     ║
# ║       settings. i.e. 1, 2, 3, 4                          ║
# ║       x is the amount to move the battler right          ║
# ║       y is the amount to move the battler down           ║
# ║                                                          ║
# ║   The comment does not accept negative numbers.          ║
# ║   This is why there are two comments.                    ║
# ║                                                          ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker - Except Nudity           ║
# ╚══════════════════════════════════════════════════════════╝


class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Alias method: comment_call
  #--------------------------------------------------------------------------
  alias :r2_comment_call_actor_battlers :comment_call
  def comment_call
    advance_position
    reverse_position
    r2_comment_call_actor_battlers
  end
  #--------------------------------------------------------------------------
  # * New method: advance_position
  #--------------------------------------------------------------------------
  def advance_position
    regexp = /<ADVANCE[ _-]POSITION[ _-](\d+):[ _-](\d+),[ _-](\d+)>/i
    note.scan(regexp) do |i, x, y|
      $game_custom_positions[i.to_i][:x] = $game_custom_positions[i.to_i][:x] - x.to_i
      $game_custom_positions[i.to_i][:y] = $game_custom_positions[i.to_i][:y] - y.to_i
    end
  end
  def reverse_position
    regexp = /<REVERSE[ _-]POSITION[ _-](\d+):[ _-](\d+),[ _-](\d+)>/i
    note.scan(regexp) do |i, x, y|
      $game_custom_positions[i.to_i][:x] = $game_custom_positions[i.to_i][:x] + x.to_i
      $game_custom_positions[i.to_i][:y] = $game_custom_positions[i.to_i][:y] + y.to_i
    end
  end
end

How you control which battler to move I leave to you to figure out.
In my tests I placed this in a comment event and called the CE from the skill used.
OK, it works very well... but only with playable characters. How can I use it to make enemies move, as I requested in the original post?
but only with playable characters. How can I use it to make enemies move, as I requested in the original post?
You said for example... so I never thought of the enemy as one you wanted to move.
You are using nothing to control the enemy correct? Just the default battle placement in the troop tab?

I wonder if there is a script for that already. It would be changing some of the default code.

*Done. Script updated
You said for example... so I never thought of the enemy as one you wanted to move.
You are using nothing to control the enemy correct? Just the default battle placement in the troop tab?

I wonder if there is a script for that already. It would be changing some of the default code.

*Done. Script updated
The example ithat I gave is actually an real enemy in a game that moves, the demon wall from final fantasy iv😀

There is a little nasty bug: the script works perfectly, but only if there are more than one enemy. If there is only one enemy in battle, and if you try to move it, the following error appears:

Screenshot_2.png


Tested in an new fresh project with only the folowing extra scripts: victor basic, victor actors battlers and your script, in that order. Can you please fix this?
Tested in an new fresh project with only the folowing extra scripts: victor basic, victor actors battlers and your script, in that order. Can you please fix this?
Did you use 1 for the enemy id? If so try 0. The Enemy array starts at 0.
Oh, I'm so dumb! I really believed the enemy ID starts with 1, but hey, Its logic, isn't it? Dumb logic by someone who does not understand well about code/programming/stuff, ok.

Now it works now. Thank you very much. You are a life saver.

Problem solved now.

Original thread: https://forums.rpgmakerweb.com/threads/make-an-enemy-move-in-battle.159456/