MV Theo's Shake screen fix needed

@TheoAllen released in May '19 plugin, that upgrades shake screen and it's a great work, but unfourtunately his shake screen function don't work in battles, can someone help me or know how to make this plugin work inside battles?
This is link to official release - https://forums.rpgmakerweb.com/index.php?threads/theo-screenshake.109390/
JavaScript:
    Scene_Base.prototype.update = function() {
        this.updateFade();
        this.updateChildren();

        //Dopan INFO=> edited part starts here, stuff above is the Default Function Content
        // If Scene battle is active:
        if (SceneManager._scene instanceof Scene_Battle === true) {
            // hoppefully this triggers the Shake..
            command = command.toLowerCase();
            if(command === 'shakescreen' || command === 'shake' || command === 'screenshake'){
            $gameTemp.shake_screen(args[0], args[1]);
            }
        }
    };

I am not sure if the code that should trigger the shake works this way..
but try to add this to the plugin..
Its an overwrite of the default "scene base update function" and it asks "if scene battle is active"..than i tried to add the shake trigger..
(not tested)

Edit
I just recognized that this cant work aslong the "args[0], args[1]"-data is missing.. perhaps you could store that data in a plugin variable to add it into the code..
@Dopan - Thanks, but it does not work.
Edit - I use fixed values in script call. On map it's okay, but I need it for battles.
Unless... Maybe duplicating default Shake Screen function, but applying @TheoAllen Math formula will work... 🤔

Edit2 - No... Shake Screen is method of Game_Screen object... I'll take care of it later.
@Dopan - Thanks, but it does not work.
Edit - I use fixed values in script call. On map it's okay, but I need it for battles.
Unless... Maybe duplicating default Shake Screen function, but applying @TheoAllen Math formula will work... 🤔
i edited the plugin directly, and added variables to add the args data..
(not tested)

JavaScript:
/*:
@plugindesc Simply shakes the screen
@author TheoAllen (edited Version)
@help
Version 1.0 (b)

This plugin simply shakes the screen. I'm not sure what else to add.

To use this plugin, use Plugin Command from the event command, then
type this:

Shake <power> <duration>
- <duration> = duration in frames. Putting 45 means it will last for
               45 frames.
- <power> = How many pixel of shake/displacement. Putting 10 means
            it will shake up to 10 pixel displacement. Power is
            gradually wears off as the time passes.

p.s: you can substitute "Shake" with "ShakeScreen" or "ScreenShake"
for your own convenience.

Example:
Shake 10 45
ShakeScreen 10 45
ScreenShake 10 45

Terms of Use:
- Free for commercial
- Credit is optional, but do not claim!
*/
var Theo = Theo || {}
Theo.Shake = {}

//edited: prepare args variables
    var _arg0 = 0;
    var _arg1 = 0;
//edit end

Theo.Shake.gameTemp_init = Game_Temp.prototype.initialize;
Game_Temp.prototype.initialize = function(){
    Theo.Shake.gameTemp_init.call(this);
    this.shake_maxdur = 0;
    this.shake_dur = 0;
    this.shake_pow = 0;
}

Game_Temp.prototype.shake_screen = function(power, duration){
    this.shake_maxdur = duration;
    this.shake_dur = duration;
    this.shake_pow = power;
}

Theo.Shake.spritesetBase_updatePos = Spriteset_Base.prototype.updatePosition;
Spriteset_Base.prototype.updatePosition = function(){
    Theo.Shake.spritesetBase_updatePos.call(this);
    if($gameTemp.shake_dur > 0){
        $gameTemp.shake_dur -= 1;
        let rate = $gameTemp.shake_dur/$gameTemp.shake_maxdur;
        this.x += Math.random() * $gameTemp.shake_pow * rate * (Math.random() >= 0.5 ? 1 : -1);
        this.y += Math.random() * $gameTemp.shake_pow * rate * (Math.random() >= 0.5 ? 1 : -1);
    }
}

Theo.Shake.plugin_command = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args){
    Theo.Shake.plugin_command.call(this, command, args);
    command = command.toLowerCase();
//Edited: get data for _args variables
    _arg0 = args[0]
    _arg1 = args[1]
//edit end
    if(command === 'shakescreen' || command === 'shake' || command === 'screenshake'){
        $gameTemp.shake_screen(args[0], args[1]);

    }
}

Scene_Base.prototype.update = function() {

        this.updateFade();

        this.updateChildren();


        //Dopan INFO=> edited part starts here, stuff above is the Default Function Content

        // If Scene battle is active:

        if (SceneManager._scene instanceof Scene_Battle === true) {

            // hoppefully this triggers the Shake..

            command = command.toLowerCase();

            if(command === 'shakescreen' || command === 'shake' || command === 'screenshake'){

            $gameTemp.shake_screen(_arg0, _arg1);

            }

        }

    };

edit

If that doesnt work, then i dont know.. i used this way of "scene base update" in order to know what scene is active in another plugin,. and hoped it would work here aswell..

edit2
idk but perhaps the "command" data is also missing..
@Dopan, thank you very much for your effort, but still no luck. I'll try replicate default shake screen method and see how it goes.
Thank you once again.
I'm gonna ask this since I don't have MV installed in this machine yet to test this out.
Does it also not work in the fresh project without any plugin installed?
I tested the MZ version (the code on how I handle the sake is similar, just a different way to handle the parameter since MZ uses a different plugin command). It works in the battle.
@TheoAllen I havent checked, but I'll do it right away.

Edit: On empty project works and only plugins I have are Yanfly's + HIME's
Then try to put mine at the bottom of the load order, if that makes any difference.
Not quite solved, but I think what to do. I just turn off all plugins and simply 1by1 check wich one causes to block shaking.

@TheoAllen - I found culprit - YEP_X_ActSeqPack3.js (Not absolutely needed plugin, but having camera control in skill would be good)
Not quite solved, but I think what to do. I just turn off all plugins and simply 1by1 check wich one causes to block shaking.

@TheoAllen - I found culprit - YEP_X_ActSeqPack3.js (Not absolutely needed plugin, but having camera control in skill would be good)
i guess thats because of "Spriteset_Battle.prototype.updatePosition = function() {"
(that function is part of both Plugins.. one does probably overwrite the other without compatiblety edit)

YEPS act Seq 3 Screenshot
Screenshot_1.png


but that could be solved with an compatiblety edit..
( in order to not overwrite one function with the other.. )

Edit
For example if you want to keep "yeps act seq3" and that plugin is probably first on the list in your pluginmanager.. 1. you could write the whole yep code into the code of TheoAllens plugin..
(talking about the code from "Spriteset_Battle.prototype.updatePosition = function() {")

2. Or you can make the function call each other,.. but i cant give a proper example at the moment..
( that second solution is probably better, sry i am still to nooby with JS to explain it better )

edit2
TheoAllens next posting shows solution nr 2 ( make one function call the other),..
i think this should solve it..
Right, the update position in the spriteset battle is completely overwritten.
Try this patch (save as a new plugin, put below Yanfly's plugin)
Code:
Theo.Shake.spritesetBattle_updatePos = Spriteset_Battle.prototype.updatePosition;
Spriteset_Battle.prototype.updatePosition = function(){
    Theo.Shake.spritesetBattle_updatePos.call(this);
    if($gameTemp.shake_dur > 0){
        $gameTemp.shake_dur -= 1;
        let rate = $gameTemp.shake_dur/$gameTemp.shake_maxdur;
        this.x += Math.random() * $gameTemp.shake_pow * rate * (Math.random() >= 0.5 ? 1 : -1);
        this.y += Math.random() * $gameTemp.shake_pow * rate * (Math.random() >= 0.5 ? 1 : -1);
    }
}
sry to bother again, but i am a bit confused..
i read again and the default function in TheoAllens plugin was:


Spriteset_Base.prototype.updatePosition = function(){

--
the function in yeps plugin (act seq3) is:
(thats also what TheoAllen used here #11 )

Spriteset_Battle.prototype.updatePosition = function(){

( this should not overwrite a "Base" function or am i wrong?)
--------

the whole make one function call the other with : (call the function twin)

Theo.Shake.spritesetBattle_updatePos.call(this); (new)
Theo.Shake.spritesetBase_updatePos.call(this); (old default)

is&was in both functions ( the old and the new edited )..
(so there should not have been an overwrite problem anyway??)

---

dont get me wrong if it works at the end , i dont worry ,, i am just curius if i made a mistake here with the advise i gave earlier..

( however i hope you could make it work at the end @Soulrender )
@Dopan here is a simple breakdown of why Yanfly's code wreaks havoc

Spriteset_Base --> I added the shake function
It automatically applies to both Spriteset_Map and Spriteset_Battle

However, Yanfly decided to just overwrite the whole update position function specifically for Spriteset_Battle. This is why it works on the map and not in battle

My patch just reintroduces the whole function again specifically in the Spriteset_Battle.
That said
( this should not overwrite a "Base" function or am i wrong?)
The one who "overwrite" was actually Yanfly's code.
thx for the claryfication! @TheoAllen

so all my edits with the "args variables" and the "Scene_Base.prototype.update = function() {"-edit ect are not required.. only the edit from #11 is needed..
Yes, you don't need to touch Scene_Base at all.
Theo.Shake.spritesetBattle_updatePos = Spriteset_Battle.prototype.updatePosition; Spriteset_Battle.prototype.updatePosition = function(){ Theo.Shake.spritesetBattle_updatePos.call(this); if($gameTemp.shake_dur > 0){ $gameTemp.shake_dur -= 1; let rate = $gameTemp.shake_dur/$gameTemp.shake_maxdur; this.x += Math.random() * $gameTemp.shake_pow * rate * (Math.random() >= 0.5 ? 1 : -1); this.y += Math.random() * $gameTemp.shake_pow * rate * (Math.random() >= 0.5 ? 1 : -1); } }
@TheoAllen Yup. This code solved everything. Thank you very much. And you to @Dopan, thank you both.

Original thread: https://forums.rpgmakerweb.com/threads/theos-shake-screen-fix-needed.131856/