Way to make a picture not move with screen shake?

Hi! I've searched a long time and can't find a way to make a picture not shake when I use the screen shake option.

Before using MZ, I was working with RPG maker 2003, and there it was as simple as clicking the "affected by shake" option.

Is there a way to do this in MZ? It seems something so simple.. , but I can't do it... =(

I found a plugin, but it's for MV. I used it with Fossil and it didn't work...

Thanks in advance!‍↕️
so.... do you want to make it shake or do you want to make it scroll?
if you want to make it scroll, you need to use the the map scroll option (or might have another name)
so.... do you want to make it shake or do you want to make it scroll?
if you want to make it scroll, you need to use the the map scroll option (or might have another name)
I need to be able to display an image using the "show picture" command, and when using the "screen shake" command, I want certain aspects of the game to not shake. For example, everything on the screen would shake, except for that specific image (think of it like a status image of the protagonist, an element that is "outside" of the game, like a HUD).

Does that make sense?
I need to be able to display an image using the "show picture" command, and when using the "screen shake" command, I want certain aspects of the game to not shake. For example, everything on the screen would shake, except for that specific image (think of it like a status image of the protagonist, an element that is "outside" of the game, like a HUD).

Does that make sense?
ahhhhhh it does
I didnt even actually knew that the shake affected images, in this case Im kinda useless sorry I dont know how 🙁
I do suggest you to play with settings and what not, sometimes I often troubleshoot stuff by messing with settings. or maybe doing your best searching your problem on google
good luck! ^^
ahhhhhh it does
I didnt even actually knew that the shake affected images, in this case Im kinda useless sorry I dont know how 🙁
I do suggest you to play with settings and what not, sometimes I often troubleshoot stuff by messing with settings. or maybe doing your best searching your problem on google
good luck
Don't worry! Thanks anyway =)

Google didn't help me, so let's hope someone knows a way to do it 🙂
In MV/Z, the picture sprites are ultimately children of the spriteset (which shakes), so I think you'd want something to offset the position of the "non-shake" pictures back to where they would be without shake.

Something like this might work (untested):
Spoiler: plugin code
JavaScript:
/*:
 * @target MZ MV
 * @plugindesc Make certain pictures not shake with the screen.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/171740/
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (function() {
'use strict';
  /**
   * Used in {@linkcode isNonShakePic}.
   * Pictures with a matching filename will shake in antiphase.
   */
  const NAME_RX = /!$/;  // "ends with !"

  /**
   * @param {Game_Picture} pic reference picture.
   * @returns {boolean} `true` iff `pic` is a "non-shake" picture.
   */
  const isNonShakePic = function(pic) {
    return pic && NAME_RX.test(pic.name());
  };

  /**
   * @param {Game_Picture} pic reference picture
   * @returns {number} additive X-offset for picture position.
   */
  const xOffset = function(pic) {
    return isNonShakePic(pic) ? -Math.round($gameScreen.shake()) : 0;
  };

  // Patch - cancel out X-offset due to spriteset shake.
  const alias = Sprite_Picture.prototype.updatePosition;
  Sprite_Picture.prototype.updatePosition = function() {
    alias.apply(this, arguments);
    this.x += xOffset(this.picture());
  };

})();
In theory, this decides which pictures are "non-shake" based on the picture's filename, e.g. hud!.png (ends with !) will be a "non-shake" picture.
In MV/Z, the picture sprites are ultimately children of the spriteset (which shakes), so I think you'd want something to offset the position of the "non-shake" pictures back to where they would be without shake.

Something like this might work (untested):
Spoiler: plugin code
JavaScript:
/*:
 * @target MZ MV
 * @plugindesc Make certain pictures not shake with the screen.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/171740/
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (function() {
'use strict';
  /**
   * Used in {@linkcode isNonShakePic}.
   * Pictures with a matching filename will shake in antiphase.
   */
  const NAME_RX = /!$/;  // "ends with !"

  /**
   * @param {Game_Picture} pic reference picture.
   * @returns {boolean} `true` iff `pic` is a "non-shake" picture.
   */
  const isNonShakePic = function(pic) {
    return pic && NAME_RX.test(pic.name());
  };

  /**
   * @param {Game_Picture} pic reference picture
   * @returns {number} additive X-offset for picture position.
   */
  const xOffset = function(pic) {
    return isNonShakePic(pic) ? -Math.round($gameScreen.shake()) : 0;
  };

  // Patch - cancel out X-offset due to spriteset shake.
  const alias = Sprite_Picture.prototype.updatePosition;
  Sprite_Picture.prototype.updatePosition = function() {
    alias.apply(this, arguments);
    this.x += xOffset(this.picture());
  };

})();
In theory, this decides which pictures are "non-shake" based on the picture's filename, e.g. hud!.png (ends with !) will be a "non-shake" picture.

It works! Thank you =)

As an additional note: as almost always, this is not compatible with Visustella_core, since the latter modifies the "screen shake" function, leaving it as "random" by default. However, in the same plugin, you can select "original" (the one from RPG Maker MZ) for the default screen shake, which will allow the plugin's "no screen shake" effect to work.

Now, just out of curiosity, do you think there’s a “simple” way to make it compatible with Visustella_core’s screen shake? I like that it’s random rather than just moving from left to right.

If not, I’ll have to decide whether to give up on Visustella's shake effect to get the effect I want, or leave out the plugin you made. Either way, you’ve helped me with what I was looking for, since now I have an option! Thanks a million! =)
Now, just out of curiosity, do you think there’s a “simple” way to make it compatible with Visustella_core’s screen shake? I like that it’s random rather than just moving from left to right.
Ah. You could try something like this instead, but it's just a blind guess:
Spoiler: plugin code XY
JavaScript:
/*:
 * @target MZ
 * @plugindesc Make certain pictures not shake with the screen.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/171740/
 * @orderAfter VisuMZ_0_CoreEngine
 * @help Another plugin must add shakeX and shakeY methods to Game_Screen.
 *
 * Free to use and/or modify for any project, no credit required.
 */
;void (function() {
'use strict';
  /**
   * Used in {@linkcode isNonShakePic}.
   * Pictures with a matching filename will shake in antiphase.
   */
  const NAME_RX = /!$/;  // "ends with !"

  /**
   * @param {Game_Picture} pic reference picture.
   * @returns {boolean} `true` iff `pic` is a "non-shake" picture.
   */
  const isNonShakePic = function(pic) {
    return pic && NAME_RX.test(pic.name());
  };

  /**
   * @param {Game_Picture} pic reference picture
   * @returns {number} additive X-offset for picture position.
   */
  const xOffset = function(pic) {
    return isNonShakePic(pic) ? -Math.round($gameScreen.shakeX()) : 0;
  };

  /**
   * @param {Game_Picture} pic reference picture
   * @returns {boolean} additive Y-offset for picture position.
   */
  const yOffset = function(pic) {
    return isNonShakePic(pic) ? -Math.round($gameScreen.shakeY()) : 0;
  };

  // Patch - cancel out X-offset due to spriteset shake.
  const alias = Sprite_Picture.prototype.updatePosition;
  Sprite_Picture.prototype.updatePosition = function() {
    alias.apply(this, arguments);
    this.x += xOffset(this.picture());
    this.y += yOffset(this.picture());
  };

})();
(Random shake would be 2 values, X and Y, but by default there is only 1 shake value. I've guessed that VisuStella might define the X/Y values as shakeX and shakeY respectively, using the same structure as the core scripts.)

Otherwise, you'd need to know what to write to replace those parts of the xOffset and yOffset functions.

Or you could find a different, non-obfuscated plugin that implements "random" style screen shake. That should make it easy to write compatible code.
Thanks for the answer.

I tried the updated code, but got this error when trying to show a picture in game:
TypeError
$gameScreen.shakeX is not a function



Don't know if this helps, but Visustella offers 4 ways of screen shaking, all configurable by javascript.

1) Original Style:

// Calculation

this.x += Math.round($gameScreen.shake());

-----------
2) Random Style:
// Calculation

// Original Formula by Aries of Sheratan

const power = $gameScreen._shakePower * 0.75;

const speed = $gameScreen._shakeSpeed * 0.60;

const duration = $gameScreen._shakeDuration;

this.x += Math.round(Math.randomInt(power) - Math.randomInt(speed)) * (Math.min(duration, 30) * 0.5);

this.y += Math.round(Math.randomInt(power) - Math.randomInt(speed)) * (Math.min(duration, 30) * 0.5);

----------
3) Horizontal Style


// Calculation

// Original Formula by Aries of Sheratan

const power = $gameScreen._shakePower * 0.75;

const speed = $gameScreen._shakeSpeed * 0.60;

const duration = $gameScreen._shakeDuration;

this.x += Math.round(Math.randomInt(power) - Math.randomInt(speed)) * (Math.min(duration, 30) * 0.5);

-----------

4) Vertical Style

// Calculation

// Original Formula by Aries of Sheratan

const power = $gameScreen._shakePower * 0.75;

const speed = $gameScreen._shakeSpeed * 0.60;

const duration = $gameScreen._shakeDuration;

this.y += Math.round(Math.randomInt(power) - Math.randomInt(speed)) * (Math.min(duration, 30) * 0.5);

----------------------

I'll look for other screen shaking plugins and report. Thanks.
Oh, that does look helpful!

Based on those snippets, it doesn't look like the shake values get stored anywhere. But if you can edit the code then it should be a simple fix. E.g. for the "Random" type:
JavaScript:
// Get values for calculation.
const power = $gameScreen._shakePower * 0.75;
const speed = $gameScreen._shakeSpeed * 0.60;
const duration = $gameScreen._shakeDuration;

// Calculate values AND store them for later reference.
$gameScreen.shakeX = Math.round(Math.randomInt(power) - Math.randomInt(speed))
                   * (Math.min(duration, 30) * 0.5);
$gameScreen.shakeY = Math.round(Math.randomInt(power) - Math.randomInt(speed))
                   * (Math.min(duration, 30) * 0.5);

// Offset spriteset by calculated values.
this.x += $gameScreen.shakeX;
this.y += $gameScreen.shakeY;
...then reference those values in my plugin's xOffset and yOffset functions:
JavaScript:
  const xOffset = function(pic) {
    return isNonShakePic(pic) ? -Math.round($gameScreen.shakeX) : 0;
  };

  const yOffset = function(pic) {
    return isNonShakePic(pic) ? -Math.round($gameScreen.shakeY) : 0;
  };
Hopefully that works! 👋
Oh, that does look helpful!

Based on those snippets, it doesn't look like the shake values get stored anywhere. But if you can edit the code then it should be a simple fix. E.g. for the "Random" type:
JavaScript:
// Get values for calculation.
const power = $gameScreen._shakePower * 0.75;
const speed = $gameScreen._shakeSpeed * 0.60;
const duration = $gameScreen._shakeDuration;

// Calculate values AND store them for later reference.
$gameScreen.shakeX = Math.round(Math.randomInt(power) - Math.randomInt(speed))
                   * (Math.min(duration, 30) * 0.5);
$gameScreen.shakeY = Math.round(Math.randomInt(power) - Math.randomInt(speed))
                   * (Math.min(duration, 30) * 0.5);

// Offset spriteset by calculated values.
this.x += $gameScreen.shakeX;
this.y += $gameScreen.shakeY;
...then reference those values in my plugin's xOffset and yOffset functions:
JavaScript:
  const xOffset = function(pic) {
    return isNonShakePic(pic) ? -Math.round($gameScreen.shakeX) : 0;
  };

  const yOffset = function(pic) {
    return isNonShakePic(pic) ? -Math.round($gameScreen.shakeY) : 0;
  };
Hopefully that works! 👋


I made the changes both in Visustella and your plugin, but unfortunately everything is still shaking... =(
Drat. OK, I give up. 😴
Drat. OK, I give up. 😴
Hahaha sorry the late response, I was out yesterday.

Don't worry, I really appreciate your help =) 😀

I'll try another way 😉
There's one temporary solution that move the pictures outside of the spriteset.

For example:
SceneManager._scene.addChild(SceneManager._scene._spriteset._pictureContainer);

Or just the first picture:
SceneManager._scene.addChild(SceneManager._scene._spriteset._pictureContainer.children[0]);

I think I saw some plugin that does similar things for MV, but I don't recall if there's one for MZ.

The problem is the effect will be reset if you open a menu. So you need to run it every time you make a quake effect.

Original thread: https://forums.rpgmakerweb.com/threads/way-to-make-a-picture-not-move-with-screen-shake.171740/