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
80
Reaction score
187
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
80
Reaction score
187
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 Posts

Latest Profile Posts

I'm still undecided weather or not I should add minor swearing to my game. Like I'm going for an all ages demographic... but the idea of a cartoon character saying dammit, hell, or crap in normal conversation is really funny to me.
If we assume an Elf's strong suit is Dexterity (AGI) & Intellect (MAT), I imagine Strength (ATK) & Constitution (DEF) would be among their lowest stats. But I'm having a hard deciding which should be lower, Strength or Constitution?
I'm really sorry to have to do this, but I'm going to have to start blocking those who repeatedly put up sexual content and offer absolutely nothing (that I've seen) related to what this community is supposedly created for.
Don't take it personal. I'm a rape victim with permanent injuries who can never enjoy 'it' ever again, so it's the last thing I want to have put in my face. :(
Check out my side project! It's a survival dungeon crawler! https://voidmoon-studio.itch.io/depths-of-delmora
RushLog wrote on HarlekinLehl's profile.
how do you attach those images to your posts?

Forum statistics

Threads
123,215
Messages
1,154,967
Members
161,596
Latest member
LilCronch
Top