MZ How to create a battler iddle movement like battler doing Y offset

The best I could think with the help of the AI is this but doesn't work:

Code:
    const _Sprite_Battler_update = Sprite_Battler.prototype.update;
    Sprite_Battler.prototype.update = function() {
        _Sprite_Battler_update.call(this);
        if (this._battler && this._battler._iddleType) {
            this.updateIddle();
        }
    };

    Sprite_Battler.prototype.updateIddle = function() {
        const speed = this._battler._iddleSpeed;
        if (this._battler._iddleType === 'hover') {
            this.y = this._battler._originalY + Math.sin(Graphics.frameCount * speed) * 10;
        } else if (this._battler._iddleType === 'walk') {
            this.x = this._battler._originalX + Math.sin(Graphics.frameCount * speed) * 10;
        }
The best I could think with the help of the AI is this but doesn't work:
That's because AI isn't designed for creating logical things. It can look up information that's already been done, and it can make up (generate) nonsense, but it isn't useful for creating new things intelligently.

That code refers to properties on the battler that don't exist, so it's impossible for it to do anything.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-create-a-battler-iddle-movement-like-battler-doing-y-offset.169526/