[SV] Attack Motion for each Weapon and Skill/item Attack Motion

The new SV battler are nice, but the options to customize it are rather limiting.
I don't know how viable it is. Looking at the script side it shouldn't be so hard to implement, but it would depend on how much changes to the framework it would be needed, although I belive it woudn't be so much hard, as most of the framework already exist.


- Assign the Attack Motion to weapons:


To remove the very high limitation on how you can assign graphics for weapons, The idea is to allow the user to assign the graphic and motion for each weapon.


First would be needed to add the option on the weapon window:

Spoiler
Weapon1.png



The [SV] Attack Motion would be divided into two part: a dropdown and a image selection


The dropdown would be very similar to the one that alread exist, showing the options "None" "Thrust" "Swing" and "Missile"


Weapon2.png



The image selection would be very similar to the charset selection. It should also include the option to add the "$" sign the same way as it is possible to charchets, to allow the use of "single" weapon sprites.


This would basically use the same framework as the Charset selection, so it wouldn't be hard to re-create. Also, the weapons graphics should have their own folder, since we don't want non- weapon files to be shown on the list.

Spoiler
Weapons3.png



This would add 3 new values to the Weapon data:
- 'attackMotion' (A numeric value ranging from -1 to 2, that would be set by the "Motion" dropdown).
- 'weaponImageName' (the name of the Weapon Graphic, would be get from the Image selection window the same way as the charset data).
- 'weaponImageId' (the index of the Weapon Graphic, would be get from the Image selection window the same way as the charset data, with the difference that it will range from 1 to 12, with the first index being 1, since the system uses 0 for no-weapon).
 


- Assign the Attack Motion to skills and items:


Now this is to solve one of the major flaws from the SV system from MV. While you can set weapon motion for basic attacks, you can't do the same for skills. So, even if you have a physical skill, it will not show the weapon.


To assign the attack motion to skills and items, A single dropdown is enough.

Spoiler
Weapons4.png



It would be similar to the 'Animation' dropdown, but instead of listing the Animations, it would list the weapons along the 'Normal Attack' and 'None' options. The 'Normal Attack' would make the skill call the current weapon motion, and None would call the default motion for the action ('guard', 'skill', 'magic' or 'item' motions, depending on the action)


Weapons5.png


This would add one new value to the Skill and Item data: 
- 'attackMotion' (A numeric value ranging from -1 to the number of weapons, that would be set by the "Attack Motion" dropdown).


Since each weapon now have it's own Attack motion, the '[SV] Attack Motion' option on the 'System' tab would be obsolete. To not leave a huge gap there, i would reorganize the windows like this:

Spoiler
Weapons6.png

This way the gap is smaller and the 'Sounds' would have more space, since it have a lot of options.


Here is a example of the changes needed to implement on the game .js files:

Spoiler
rpg_objects.js changes:



Game_Battler.prototype.startWeaponAnimation = function(weaponImageId, weaponImageName) {
this._weaponImageId = weaponImageId;
// added the 'weaponImageName'
this._weaponImageName = weaponImageName;
};

Game_Actor.prototype.performAction = function(action) {
Game_Battler.prototype.performAction.call(this, action);
// changed to call the new 'actionMotion' function, wich checks for the 'attackMotion'
// set on the action to decide if will call default motion or weapon motion
if (action.isAttack()) {
this.performAttack();
} else if (action.isGuard()) {
this.actionMotion(action.attackMotion(), 'guard');
} else if (action.isMagicSkill()) {
this.actionMotion(action.attackMotion(), 'spell');
} else if (action.isSkill()) {
this.actionMotion(action.attackMotion(), 'skill');
} else if (action.isItem()) {
this.actionMotion(action.attackMotion(), 'item');
}
};

Game_Actor.prototype.performAttack = function() {
// Sice the attack motion will be also performed by skills, get the weapon ID
// and call a new function to perform the attack
var weapons = this.weapons();
if (weapons[0]) {
this.performAttackMotion(weapons[0].id);
}
};




rpg_sprites.js changes:



Sprite_Actor.prototype.setupWeaponAnimation = function() {
if (this._actor.isWeaponAnimationRequested()) {
// adding the weaponImageName to the setup call
this._weaponSprite.setup(this._actor.weaponImageId(), this._actor.weaponImageName());
this._actor.clearWeaponAnimation();
}
};

Sprite_Weapon.prototype.setup = function(weaponImageId, weaponImageName) {
this._weaponImageId = weaponImageId;
// now each weapon have it's own image name.
this._weaponImageName = weaponImageName;
this._animationCount = 0;
this._pattern = 0;
this.loadBitmap();
this.updateFrame();
};

Sprite_Weapon.prototype.loadBitmap = function() {
// it's no longer needed to check for the 'pageId'
if (this._weaponImageId > 0) {
this.bitmap = ImageManager.loadWeapon(this._weaponImageName);
this._isSingleWeapon = ImageManager.isSingleWeapon(this._weaponImageName);
} else {
this.bitmap = ImageManager.loadSystem('');
}
};

Sprite_Weapon.prototype.updateFrame = function() {
if (this._weaponImageId > 0) {
var w = 96;
var h = 64;
// changed for the check for single weapons
var sx = this.weaponPatternX() * w;
var sy = this.weaponPatternY() * h;
this.setFrame(sx, sy, w, h);
} else {
this.setFrame(0, 0, 0, 0);
}
};


rpg_managers.js new functions:



ImageManager.loadWeapon = function(filename, hue) {
return this.loadBitmap('img/weapons/', filename, hue, true);
};

ImageManager.isSingleWeapon = function(filename) {
return filename.charAt(0) === '$';
};


rpg_objects.js new functions:



Game_Action.prototype.attackMotion = function() {
return this.item().attackMotion;
};

Game_Battler.prototype.weaponImageName = function() {
return this._weaponImageName;
};

Game_Actor.prototype.actionMotion = function(attackMotion, motion) {
// check the 'attackMotion' for the skill.
if (attackMotion > 0) {
this.performAttackMotion(attackMotion);
} else if (attackMotion < 0) {
this.performAttack()
} else {
this.requestMotion(motion);
}
};

Game_Actor.prototype.performAttackMotion = function(weaponId) {
var weapon = $dataWeapons[weaponId]
// get the attack motion from weapon instead of the weaponTypeId
var attackMotion = weapon ? weapon.attackMotion : -1;
if (attackMotion > 0) {
if (attackMotion === 0) {
this.requestMotion('thrust');
} else if (attackMotion === 1) {
this.requestMotion('swing');
} else if (attackMotion === 2) {
this.requestMotion('missile');
}
// the 'weaponImageId' and 'weaponImageName' are now set on the weapon.
this.startWeaponAnimation(weapon.weaponImageId, weapon.weaponImageName);
}
};


rpg_sprites.js new functions:



Sprite_Weapon.prototype.weaponPatternX = function() {
if (this._isSingleWeapon) {
return this._pattern;
} else {
var index = this._weaponImageId - 1;
return (Math.floor(index / 6) * 3 + this._pattern);
}
};

Sprite_Weapon.prototype.weaponPatternY = function() {
if (this._isSingleWeapon) {
return 0;
} else {
var index = this._weaponImageId - 1;
return Math.floor(index % 6);
}
};

This code is fully working with the changes suggested (I tested them by adding the new values directly on the .json files on the data folder), so all it would be needed is to make the editor assign them to the weapons, skills and items.



I really hope that this change is not dismissed, as it would greatly improve the new sideview feature.
As it presented, there is no reason to not implement it other than "Kadokawa didn't allow us to make this change", wich would be sad, but nothing can be done about that.
I support this idea of a feature over 9000 (!!!!!) percent.
Very nice suggestion!!! I want it! 😀
This should be doable and I agree with it since it's something Rm2k3 did as well. But I hope we will be able to implement it later after all issues are sorted. I'm unsure if we have enough time to do it, hopefully we do though!
This should be doable and I agree with it since it's something Rm2k3 did as well. But I hope we will be able to implement it later after all issues are sorted. I'm unsure if we have enough time to do it, hopefully we do though!
I'm glad to know that. If there is anything I can help feel free to ask. As someone that really like to customize battles, this is something I'm really hoping to see done.
This one is highly needed and also an extra selection for (Sword - Move to enemy) and for (Bow - Stay still and shoot). I am always extremely stressed because MV does not have that feature. Even plugins etc. are not working like I would like to because Attack is the only skill which is used for normal attack. So a sword will do the same animation like a gun will do if you put a code into the notebox. So it will looks like that. Player moves close to the enemy and shoots their arrows at the enemy but I do not want that to happen for normal attack. We rlly need a much better way to choose in the editor without using codes for easier access to do our skills,weapons etc.

This combined with Victor Sant's idea would be gold
So any updates on this?
Hi. How to make this work? And can I add custom motions like "Slash" or "Stab" for example?
Too bad this never got implemented. Would have been very very useful.
This feature would be very neat
is great. I try for this but not work :aswt2:
every one can show me please. Im rookie for RMMV
Thank you.
@reegis This is in the sugegstion forum, meaning it's a feature that doesn't exist. If you need help with something in MV, please post in the MV Support forum.
@reegis This is in the sugegstion forum, meaning it's a feature that doesn't exist. If you need help with something in MV, please post in the MV Support forum.
Oh! im sorry about that. Thank guy.
Sounds like a really great QOL change MV needs.
Hope this gets implemented soon. MV is super rigid without plugins. Seeing this would be so much easier than having to consistently count Weapon templates in my system folder.

Original thread: https://forums.rpgmakerweb.com/threads/sv-attack-motion-for-each-weapon-and-skill-item-attack-motion.55970/