MV Help with writing an attack animation plugin

Hi everyone, I'm new to RPG Maker and by extension scripting, so I was hoping I could get some help with my first script. I'll write what my goal is first, and then what i've tried so far over the past couple days.

I'm trying to create a plugin that creates short attack animations using illustrated pictures, with each attack containing 2 pictures. I want to use it for the basic Attack skill, as well as every other skill that characters may use. Characters will have multiple animations, such as "magic" or "skill". I plan to use notetags to specify this in the skills section.

More specifically, if character XYZ uses Attack, it will fade in the character in a standing position sliding in for about 60 frames, then fading out. Damage calculation will run here, and then it will show a picture of them attacking (So Damage calculation and the attack effect animation e.g. Hit Physical will happen between the two pictures). I want to include a sliding effect as well so it looks a bit less static. It would essentially show two sliding pictures over the course of about 3 seconds, and I've tried my best to illustrate an example of what it might look like.

example.png


It might be worth noting that despite the side-view, it is not in side view mode.

I've been looking through MV's codebase and other plugins to get an understanding of how scripting in this game works. A common Event doesn't work because of two reasons:
1. There's no variable passed to determine which actor is attacking
2. The entire event must end before damage calculation occurs

I tried using simple scripts calls such as $showPicture and $movePicture, but if you call these in a Manager it seems to run them all at once, and it doesn't seem like calling wait() will change anything.

This has led me trying to trace back the battle system function calls and figuring out what exactly the SceneManager and WindowManagers do. I've managed to get the pictures on the screen and in the position by loading a bitmap and creating a Sprite object with it, but once again, any attempt to move it results in the calls happening all at once, and I think I'm going to have issues getting it to time correctly with the damage calculation phase.

This is the code that loads the correct picture and pose for each character:
ImageManager.loadBitmap('img/pictures/', `${subjectName}_${notesArr[actionId].note}
the filename would evaluate to something like, "John_Attack" or "James_Magic"

And this is the code that basically achieves putting a picture on the screen. (Ignore the sloppy data fetching please, I was just trying to get it to work)

(function() { var Sen = Sen || {}; Sen.Anim = Sen.Anim || {}; Sen.Anim.battleCreate = Scene_Battle.prototype.create; Sen.Anim.battleUpdate = Scene_Battle.prototype.update; Scene_Battle.prototype.create = function() { Sen.Anim.battleCreate.call(this); this.drawActor(); }; Scene_Battle.prototype.drawActor = function(){ this._actorSprite = new Sprite(); this.addChildAt(this._actorSprite, 1); }; Scene_Battle.prototype.showActor = function(subjectName){ this._actorSprite.x = 750; this._actorSprite.y = 250; this._actorSprite.opacity = 255; this._actorSprite.bitmap = ImageManager.loadActor(subjectName) //this.moveActor() }; Scene_Battle.prototype.moveActor = function(){ //this._actorSprite.move(740, 250) //this._actorSprite.move(730, 250) //this._actorSprite.move(320, 250) } ImageManager.loadActor = function(subjectName) { return ImageManager.loadBitmap('img/pictures/', `${subjectName}_Stance`) }; DataManager.fetchNotes = function(data){ var arr = [] arr.push({id: 0, note: null}) for (let i = 1; i < data.length; i++){ arr.push({id: data[i].id, note: data[i].note}) } return arr; } BattleManager.processTurn = function() { var subject = this._subject; var action = subject.currentAction(); var notesArr = DataManager.fetchNotes($dataSkills) if (action) { var actionId = action._item._itemId; var subjectName = subject.name() action.prepare(); if (action.isValid()) { if(subject instanceof Game_Actor){ SceneManager._scene.showActor(subjectName) //SceneManager._scene.eraseActor() //this.img2 = ImageManager.loadBitmap('img/pictures/', `${subjectName}_${notesArr[actionId].note}`) } this.startAction(); } subject.removeCurrentAction(); } else { subject.onAllActionsEnd(); this.refreshStatus(); this._logWindow.displayAutoAffectedStatus(subject); this._logWindow.displayCurrentState(subject); this._logWindow.displayRegeneration(subject); this._subject = this.getNextSubject(); } }; })();

I'm not comfortable with the SceneManager/Scene_Battle classes yet, and I've never really worked with prototypes in Javascript before, so I decided to reach out for help understanding. This project I'm working on is intended to be illustration heavy, so the more I can learn about manipulating images through plugins, the more flexible I'll be.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-writing-an-attack-animation-plugin.144496/