RMMV Restrict a character from moving or facing up/down unless through scriptcall with Qmovement

rhapsodymipo

Villager
Member
Joined
Jan 30, 2015
Messages
20
Reaction score
6
First Language
portuguese
Primarily Uses
Additionally, is it possible to set the Qpathfind to move the character only on x coordinate? For example, in the image, when i click outside of the moving area, character is static, cause pathfind can't calculate the route. i'd like it to move sideways until the x position of the mouse click.

path.png
 

Mike-Turtle

Veteran
Veteran
Joined
Apr 17, 2021
Messages
77
Reaction score
184
First Language
English
Primarily Uses
RMMV
Yes. I'm only using 2dir sprites on my current project. Do you:
  • use Qabs?
  • need it for the player?
  • need it for other characters?
  • want them to only move on the X axis, or want them to only face left and right but still be able to move on the y axis?
As for your second post: no, not without huge rewrites.
 
Last edited:

rhapsodymipo

Villager
Member
Joined
Jan 30, 2015
Messages
20
Reaction score
6
First Language
portuguese
Primarily Uses
Yes. I'm only using 2dir sprites on my current project. Do you:
  • use Qabs?
  • need it for the player?
  • need it for other characters?
  • want them to only move on the X axis, or want them to only face left and right but still be able to move on the y axis?
As for your second post: no, not without huge rewrites.
Thanks for your reply.
  • For now i was thinking of making a simple adventure style game, no abs involved.
  • Only the player for now, other characters only if it's not too much work.
  • Only moving the x axis would be preferable
 
Last edited:

Mike-Turtle

Veteran
Veteran
Joined
Apr 17, 2021
Messages
77
Reaction score
184
First Language
English
Primarily Uses
RMMV
Code:
Game_Player.prototype.moveByInput = function() {
    if (!this.startedMoving() && this.canMove()) {
      if (this.triggerAction()) return;
      var direction = QMovement.diagonal ? Input.dir8 : Input.dir4;
      if (direction > 0) {
        this.clearMouseMove();
      } else if ($gameTemp.isDestinationValid()) {
        if (!QMovement.moveOnClick) {
          $gameTemp.clearDestination();
          return;
        }
        this.requestMouseMove();
        if (this._requestMouseMove) {
          var x = $gameTemp.destinationPX();
          var y = $gameTemp.destinationPY();
          return this.moveByMouse(x, y);
        }
      }
      if (Imported.QInput && Input.preferGamepad() && $gameMap.offGrid()) {
        this.moveWithAnalog();
      } else {
        if ([4, 6].contains(direction)) {
          this.moveInputHorizontal(direction);
        } else if ([2, 8].contains(direction) && (!$gameSwitches.value(1))) {
          this.moveInputVertical(direction);
        } else if ([1, 3, 7, 9].contains(direction) && QMovement.diagonal) {
          this.moveInputDiagonal(direction);
        }
      }
    }
  };

Replace the moveByInput function in qMovement with this one. Change the value of $gameSwitches.value(1) to whatever number you like, and then when that switch is activated you won't be able to move on the Y axis.
 

rhapsodymipo

Villager
Member
Joined
Jan 30, 2015
Messages
20
Reaction score
6
First Language
portuguese
Primarily Uses
Code:
Game_Player.prototype.moveByInput = function() {
    if (!this.startedMoving() && this.canMove()) {
      if (this.triggerAction()) return;
      var direction = QMovement.diagonal ? Input.dir8 : Input.dir4;
      if (direction > 0) {
        this.clearMouseMove();
      } else if ($gameTemp.isDestinationValid()) {
        if (!QMovement.moveOnClick) {
          $gameTemp.clearDestination();
          return;
        }
        this.requestMouseMove();
        if (this._requestMouseMove) {
          var x = $gameTemp.destinationPX();
          var y = $gameTemp.destinationPY();
          return this.moveByMouse(x, y);
        }
      }
      if (Imported.QInput && Input.preferGamepad() && $gameMap.offGrid()) {
        this.moveWithAnalog();
      } else {
        if ([4, 6].contains(direction)) {
          this.moveInputHorizontal(direction);
        } else if ([2, 8].contains(direction) && (!$gameSwitches.value(1))) {
          this.moveInputVertical(direction);
        } else if ([1, 3, 7, 9].contains(direction) && QMovement.diagonal) {
          this.moveInputDiagonal(direction);
        }
      }
    }
  };

Replace the moveByInput function in qMovement with this one. Change the value of $gameSwitches.value(1) to whatever number you like, and then when that switch is activated you won't be able to move on the Y axis.
It worked wonderfully. Thank you so much for the help and for your time
 

Latest Threads

Latest Profile Posts

Watch Studio Blue play Numina by starlit in our latest RPG Maker Games Critique stream starting NOW!

Wish me luck. One of the leading experts on certain false shuffle is going to check if my skill is good enough to be called "not total trash".
Not an RPG Maker Update but I'm happy to say that I finally passed my drivers written test. Which makes me a happy guy.
FWRu-cYXkAAAUbl
Have you ever been in such a luck streak you felt fear something was wrong?

Forum statistics

Threads
123,126
Messages
1,154,181
Members
161,461
Latest member
TelorDadar69
Top