First-Person Maze Navigation

I've been working on a prototype demo for an RPG and I have just started on one of five scenarios: guiding a drone through a maze by means of selecting choices to go forward or to turn left or right as needed. I thought I had that squared away by creating switches for the program to know which direction the drone is facing. But, the program acts like it's still facing forward even after I choose the "Turn Left" choice.

1770757478489.png


1770757498781.png


1770757517154.png


1770757534060.png


In each of these four screenshots, you can see that every time Turn Left or Turn Right is selected, the program is supposed to have the drone turn from the previous direction (the direction whose switch is turned OFF) to the next direction (whose switch is turned ON). Four of the pages are even set to work only if one of the four switches (North, South, East and West) is turned on. But still, the game acts like the drone faces north even if I turn left or right; rather than giving a message that the drone can't go that way, it still moves north as if facing north instead of east or west.

Is there something I'm missing?


Here's a brief clip to further illustrate what's happening right now. Can anyone please explain why this happens, or give me a better way to create a maze navigation sequence please?
you can make it shorter, but if you want the facing of the drone,
does it have a move route "turn left, turn right, turn up, turn down"?

if you use the same switches, is the switches East, South, West, North activated
or turned off on the top of the page?

you can make it easier if the room has its own switch, so it won't rely on
the switches and what does 5 and 6?

there is really low info what we can see on the event pages.
you can make it shorter, but if you want the facing of the drone,
does it have a move route "turn left, turn right, turn up, turn down"?

if you use the same switches, is the switches East, South, West, North activated
or turned off on the top of the page?

you can make it easier if the room has its own switch, so it won't rely on
the switches and what does 5 and 6?

there is really low info what we can see on the event pages.

I figured the screenshots alone didn't quite explain enough, which is why I added the brief clip. But I'll see if I can explain this better.

Have you ever played the older text adventure games like "Zork" or "Hitchhiker's Guide to the Galaxy?" In such games, you don't have the luxury of moving just by pushing and holding down any key. You have to type in "Go north" or the like. Since RPG Maker MZ apparently doesn't have the luxury to let the player move freely in a first-person dungeon view (I don't yet have pictures showing that view), all I can do use the Show Choices command.

With that said, here's how this part of the demo is supposed to work.

The map included in this post represents where the drone is and where it can go. There is also a dot used to indicate where the player is (though I plan for the map and marker to be toggled on and off in a later build of the prototype). The idea is that the drone must go from Square #1 to Square #17 but can take a detour to #11 to find a treasure (which I will implement later). When the drone is facing south, choosing "Go Forward" will make it go on to the next maze (which I have not yet drawn).

Every time the drone moves north when facing some direction, an integer variable representing the maze's squares (Maze1) increases, usually by 1. The integer indicates where the drone currently is; this is also why each square is labeled with a number.

By default, the drone is facing north. But, if the player chooses "Turn Left," the drone will no longer face north but west.

(Hence -- North = OFF and West = ON)

Then, if the drone can go forward while facing west, it will move west (like from Square #6 to Square #12). Otherwise, the drone can't go that way. If the player should choose "Turn Left" again, the drone no longer faces west but does face south.

(West = OFF, South = ON)

So the "Turn Left" and "Turn Right" commands turn the drone counterclockwise or clockwise, respectively. Each turns off the switch representing the old direction and turns on the switch for the new direction.

Does that make sense?
Since RPG Maker MZ apparently doesn't have the luxury to let the player move freely in a first-person dungeon view (I don't yet have pictures showing that view), all I can do use the Show Choices command.
it require a plugin like MZ3D plugin to make it look like a first person game.
its not clean to fight or walk, but possible, with some pixel movement and rotation,
little better, but for a perfect 3D or first person, its better in a different engine.

the switches North, West, East, South doesn't tell the facing Direction, if you truly
want facing, using control variable as well, if variable N == "N" (facing north)
check left / right if not going back?

variable can use the direction see when its left or right,
as on square 13, left = north, right is south.

I dont have the time to make it cleaner, as I use MV, eventing is equal in MZ.
You mean I should use both a switch and an integer variable to indicate the direction? If so, I can see that working since I can put in two conditions per event page. Or should I use JavaScript logic operators?

Or did you mean that I can set a variable to any letter as well as any number?

it require a plugin like MZ3D plugin to make it look like a first person game.
its not clean to fight or walk, but possible, with some pixel movement and rotation,
little better, but for a perfect 3D or first person, its better in a different engine.

the switches North, West, East, South doesn't tell the facing Direction, if you truly
want facing, using control variable as well, if variable N == "N" (facing north)
check left / right if not going back?

variable can use the direction see when its left or right,
as on square 13, left = north, right is south.

I dont have the time to make it cleaner, as I use MV, eventing is equal in MZ.
variable can set value or string => script: "N"

or $gameVariables.setValue(4, "N") and turn on a switch if going north.
than check the condition of the variable, to see if its possible or not.

its easier to control the logic if you want face direction.
I can't type in any letters for a Variable; only numbers. So should I just type in 1, 2, 3 or 4 to represent each direction?
variable can set value or string => script: "N"

or $gameVariables.setValue(4, "N") and turn on a switch if going north.
than check the condition of the variable, to see if its possible or not.

its easier to control the logic if you want face direction.
It feels like you're overcomplicating this. Is the drone not an event? Why can't you just do away with the switches and make the drone's direction be its direction and "Go forward" is just "Go forward"?

So should I just type in 1, 2, 3 or 4 to represent each direction?
Directions in RPGMaker are represented by the numeric keypad – so 8 is up, 4 is left, 6 is right, and 2 is down. Though you mostly don't need to know about this.
It feels like you're overcomplicating this. Is the drone not an event? Why can't you just do away with the switches and make the drone's direction be its direction and "Go forward" is just "Go forward"?


Directions in RPGMaker are represented by the numeric keypad – so 8 is up, 4 is left, 6 is right, and 2 is down. Though you mostly don't need to know about this.
That did cross my mind. But my intention was to make this a first-person maze. Is there some way to do this with the press of numeric keys?
I'm not quite sure what you mean by "first-person maze". Are you saying the player is the drone?
I'm not quite sure what you mean by "first-person maze". Are you saying the player is the drone?
Yes, he is controlling the drone by telling it to go forward or back, or to turn left or right through the choices. I know this is confusing without the right visual aide, but images showing a first-person view will come along in a later build.
You say "yes" and then elaborate in a way that implies "no". Which is it? Is the player (the image of the party on the map) the drone? Is the drone an event? Is it neither?

I think the easiest way to handle this would be to make the drone be an event. It could be an event that's way off the edge of the map where you can't see it, if that's how it needs to be, but making it be an event makes handling movement fairly trivial.

For example, set up your map something like this:

Map005.png


The drone is the purple thing on the right, and the orb is a control panel.

The orb's logic would look something like this:

temp.png


That should handle all the movement logic. All that remains is to deal with the case when it reaches a tile with something special on it. The comment in the above event is one way to do it, but there are probably other ways as well. For example, you could replace that comment with script code that activates any other events on the tile the drone currently occupies.

You'll notice that the drone itself has no logic at all. It just looks like this:

temp.png
You say "yes" and then elaborate in a way that implies "no". Which is it? Is the player (the image of the party on the map) the drone? Is the drone an event? Is it neither?

I think the easiest way to handle this would be to make the drone be an event. It could be an event that's way off the edge of the map where you can't see it, if that's how it needs to be, but making it be an event makes handling movement fairly trivial.

For example, set up your map something like this:

View attachment 360719

The drone is the purple thing on the right, and the orb is a control panel.

The orb's logic would look something like this:

View attachment 360721

That should handle all the movement logic. All that remains is to deal with the case when it reaches a tile with something special on it. The comment in the above event is one way to do it, but there are probably other ways as well. For example, you could replace that comment with script code that activates any other events on the tile the drone currently occupies.

You'll notice that the drone itself has no logic at all. It just looks like this:

View attachment 360723

Okay, I'll try that. At a later point, I will include pictures representing what the drone is seeing and make the tiles and events invisible until the player toggles the "map" on and off to show the drone and maze thus far. I might have an idea on how I can also make parts of the map invisible until the drone reaches those parts thus "revealing" them, if you catch my drift. Kinda like in an RTS game like StarCraft II when you reveal part of the map as any of your units go there for the first time.

Anyway, thanks for your help so far!
Okay, I got the maze navigation to work. I just need to add more stuff, as well as two more maps and specific events. What would be the best way to get the program to detect when the drone can't move forward so I can put in some message saying the drone can't go that way? Or an "error" sound effect?

Also, by my last response, I mean I want to see if I can make the map dark and the player can only see the small space surrounding the drone. Much like Dragon Quest when you use a Torch in a dark dungeon maze.
With the example I showed, the drone skips moving if it can't go that way, but without any feedback:

Code:
  ◆Set Movement Route:Drone (Skip, Wait)
  :                  :◇1 Step Forward

To add feedback, you could perhaps change it to something like this:

Code:
  ◆Control Variables:#0002 FromX = Map X of Drone
  ◆Control Variables:#0003 FromY = Map Y of Drone
  ◆Set Movement Route:Drone (Skip, Wait)
  :                  :◇1 Step Forward
  ◆Control Variables:#0004 ToX = Map X of Drone
  ◆Control Variables:#0005 ToY = Map X of Drone
  ◆If:FromX = ToX
    ◆If:FromY = ToY
      ◆Comment:Add whatever feedback you want here.
      ◆
    :End
    ◆
  :End

This would need to be added to the Step Backward case too. It's not possible to fail turning, but you could avoid needing to copy-paste that code twice by adding the first to Control Variables above the Show Choices and preceding Show Text, and the second two Control Variables plus the If below the Show Choices.

Also, by my last response, I mean I want to see if I can make the map dark and the player can only see the small space surrounding the drone. Much like Dragon Quest when you use a Torch in a dark dungeon maze.
You're looking for something like shroud or fog of war. For example, perhaps the CS_FogOfWar plugin might do what you want, though I don't know if it works in MZ (I was using it in MV). I'm also not sure if it can support fog that's cleared by an event, rather than the player.
How did you set those variables to the X and Y coordinates of the Drone's location? I couldn't find any setting that allowed me to do so.
Control Variables –> Game Data –> Character
Control Variables –> Game Data –> Character
I didn't notice that before, but I found it. Thanks again!

Now, let's say I want to give the player an item for moving forward when a chest is in front of it. When the FromX and FromY variables equal the exact coordinates - and the coordinates are X, Y - the chest event should "Turn Down" to indicate it's been opened. Should I put in a conditional branch similar to the movement ones above, except the branch conditions would be like this?

1770960913370.png


I've also tried removing the FromX = 12 and FromY = 11 conditions then setting the event to turn down when the drone touches it - an Event Touch trigger. But nothing happened.

1770961971922.png
If the chest is on (12,11), that conditional would never be true, because it can't move onto the chest's space.

Event Touch means it triggers when the event walks into the player. It doesn't do anything when one event walks into another event. But you could use a plugin to create event-on-event triggers – that would be one way of handling this. I don't know what plugins might do such a thing.

Another way would be that, if you find it didn't move (ie, at the place you have the "You can't go this way" line), and the current location is next to the chest (like your check for (12,11), but it might actually be (11,11) instead), then handle the chest instead of showing "You can't go this way".

Original thread: https://forums.rpgmakerweb.com/threads/first-person-maze-navigation.182396/