Random NPC movements, but only left and right OR up and down?

RPG Maker for PS1 had this for NPC random movements. However, I have not seen such thing for VX Ace.

I do know that there is a "script" option in NPC movement options.

Is there a call I could use to make the NPC only walk left or right at random?

Is there also one for only up and down?
Well, there's a "random" option for automatous movement by default.
I am aware of that and I use that. However, that is for all directions. I want two-directional random movements for some NPCs.
Hm, I suppose you could do it with conditionals, or the "Turn 90 degrees Right or Left" command.
It is just baffling how you are unwilling to reflect anything and just move on to make the next request for help.
Code:
move_straight([4,6][rand.round])

?
It is just baffling how you are unwilling to reflect anything and just move on to make the next request for help.
Similarly baffling is how the same people keep coming back to answer those requests. 😛
If you want them to randomly just go up and down, why not just make a moveroute going:
↓↓↑↑↓↑↓↓↓↓↑↑↓↓↓↓↑↑↑↑↑↑↓↓↑↑↓↑↓↓↑↑↑ (Skip if can not move)

This way it seems pretty random to the player, even though it is scripted. The longer you make the sequence, the more random it will be.

You can make it not skip if can not move, but then you have to make sure you don't use more ↓ or ↑ then you have space to walk that direction.

Instead of up and down, you could do "1 step forward" a couple of times, then "Turn 180 degrees"

Hm, I suppose you could do it with conditionals, or the "Turn 90 degrees Right or Left" command.
When you use the 90 degrees option, you're switching between ↔ and ↕. If you want to stay on the same line, you got to use 180 degrees.

(Sorry, double post. Didn't notice.)
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Event move fixed line        ║  Version: 1.01     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║                                     ╠════════════════════╣
# ║   Script Function                   ║    31 Dec 2023     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Requires: nil                                            ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Cause event to move horizontally or vertically           ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║   Place a comment in the event with either               ║
# ║      <move horizontal>  or  <move vertical>              ║
# ║                                                          ║
# ║ Make the event set to random movement                    ║
# ║                                                          ║
# ║ The event will now only move horizontally or vertically  ║
# ║                                                          ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║ 1.00 - 31 Dec 2023 - Script finished                     ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker except nudity             ║
# ╚══════════════════════════════════════════════════════════╝
class Game_Event
  alias r2_move_random_hvnote   move_random
  def move_type_random
      dir = check_for_random_direction
      if dir == 0
        move_random_horizontal
      elsif dir == 1
        move_random_vertical
      else
        r2_move_random_hvnote
      end
  end
  #--------------------------------------------------------------------------
  # * Move Random Horizontal
  #--------------------------------------------------------------------------
  def move_random_horizontal
    move_straight(4 + rand(2) * 2, false)
  end
  #--------------------------------------------------------------------------
  # * Move Random Vertical
  #--------------------------------------------------------------------------
  def move_random_vertical
    move_straight(2 + rand(2) * 6, false)
  end
  #--------------------------------------------------------------------------
  # * Move at Random
  #--------------------------------------------------------------------------
  def check_for_random_direction
    self.list.each do |line|
      if line.code == 108 && line.parameters == ["<move horizontal>"]
        return 0
      elsif line.code == 108 && line.parameters == ["<move vertical>"]
        return 1
      else
        return 2
      end
    end
  end
end
I don't like the other approaches for personal reasons so I came up with my own solution to this issue.

Go now to the Random Move Type ACE thread!
--- Edited out ---
(Turns out this was a misunderstanding on my part.)
?
Rome wasn't built in a day, man.
I think it was pretty nice of him to make a script from scratch just cause.

He wasn't involved in prior conversation, so IDK what to say.
Sorry, I did read read it as "I didn't like any of your solutions, so I did it myself."

It is not the fact that he solved it himself, but the comment he made that stroke me the wrong way.


Edit: Oh poop.... Sorry, I thought it was the OP saying that. But it wasn't. That changes everything. Sorry, I was way out here.
Okay, iunno, don't see any issue with it. Definitely closer to the OG request than yours, and mine just straight up wouldn't work, lol.
Okay, iunno, don't see any issue with it. Definitely closer to the OG request than yours, and mine just straight up wouldn't work, lol.
I just realized the poster of that comment is not the OP. That changes everything. I edited the previous comment before you replied.

Sorry, I was wrong there. I thought the OP told us he only started solving this after our solutions didn't work. That is what the post looked like to me, and that would have been so rude.

But that wasn't the case, so I removed the comment all together.
I don't think it's unusual to have multiple solutions and even multiple scripts proposed. For any various number of reasons, there could be a purpose why someone needs one over the other. Let's not derail this thread. Moltres has not even indicated they've tried any of the proposed solutions.
I don't think it's unusual to have multiple solutions and even multiple scripts proposed. For any various number of reasons, there could be a purpose why someone needs one over the other. Let's not derail this thread. Moltres has not even indicated they've tried any of the proposed solutions.

I thought it was OP telling us our solutions were not good enough, so he did it himself. That would have been very rude, but that wasn't the case. So, sorry. I already removed my comment, I tried to explain and I apologized.

Original thread: https://forums.rpgmakerweb.com/threads/random-npc-movements-but-only-left-and-right-or-up-and-down.164315/