MZ How to replace the default attack with VisuStella's Weapon Unleashed plugin?

I got into VisuStella's sample game recently and have been sorta just playing around with all the different plugins included in it so far. I noticed that with their sample game the monk/brawler character seems to do the whole, "monk attacks twice," thing that FF2 had, so I decided to poke around a bit to see how they pulled it off. Turns out they pull it off by just equipping the brawler class in the sample game with an, "unarmed weapon," (specifically a cestus,) that grants the character the ability of attacking twice in one turn (or, "attacking once, + one more time.")

This is cool and all, but for my own personal project I'm trying to get the, "base combat systems," as close to FF2 as possible, where you had a, "right hand," slot and a, "left hand," slot and if you unequipped all weapons and shields from both of those slots then you would attack twice. I read that, with VisuStella's I can use the javascript line <JS Replace Attack> to, well replace attacks, so my idea is to use this functionality to make a skill that replaces the default attack with a basic dual-attack, but only if the engine detects that you don't have anything equiped in your weapon and shield slots, (which I'm currently considering replacing with just two weapon slots renamed as, "left hand," and, "right hand.") But as I'm reading the wiki entry for the unleashed skills plugin I'm starting to get a bit confused. My thinking is that I would write, in the notetags of the basic dual attack skill something like:

<JS Replace Attack>
enabled = !user.weapons().length;
enabled = !user.shield().length;
dual attack = attack
</JS Replace Attack>

But I feel like I could condense this into only 4 lines, instead of 5. What do you guys think, would this be possible? Would my 5-line script even work?
Try this:

Code:
<JS Replace Attack>
id = user.weapons().length == 0 && !user.equips()[1] ? x : 1;
</JS Replace Attack>

Replace 'x' with the id of your dual attack.
Try this:

Code:
<JS Replace Attack>
id = user.weapons().length == 0 && !user.equips()[1] ? x : 1;
</JS Replace Attack>

Replace 'x' with the id of your dual attack.
This seems to work, insofar as replacing the default attack, but it doesn't limit it to only working when the player has unequipped all weapons and shields/armor. I tested it by replacing "X" with 12 (the default value for Dual Attack) and the characters with Dual Attack learned have their default attack replaced by it even with weapons equipped.
the characters with Dual Attack learned have their default attack replaced by it even with weapons equipped.
1. What do you mean by learned? Like, Dual Attack isn't just a normal type of attack, it's also a skill that actors can learn as well?
2. Make sure the weapons you're equipping on the character doesn't have a Attack Skill trait on it.
Basically if the Traits on your weapon looks like this, there's your problem:
Screenshot 2026-01-29 084653.png

3. Also make sure that the weapon you are using doesn't have the <JS Replace Attack> as well.
1. What do you mean by learned? Like, Dual Attack isn't just a normal type of attack, it's also a skill that actors can learn as well?
2. Make sure the weapons you're equipping on the character doesn't have a Attack Skill trait on it.
Basically if the Traits on your weapon looks like this, there's your problem:
View attachment 359242
3. Also make sure that the weapon you are using doesn't have the <JS Replace Attack> as well.
Oh ok, yea that was it, The long sword itself had an attack skill trait.

Also, my bad, I didn't mean, "learned," like they were skills that actors could learn, but rather like, "learn," in the context that it was one of the skills that I'd set the swordsman class (who starts at level 33 by default in Visustella's sample game,) starts the game knowing as soon as they, "reach," level one.
1. What do you mean by learned? Like, Dual Attack isn't just a normal type of attack, it's also a skill that actors can learn as well?
2. Make sure the weapons you're equipping on the character doesn't have a Attack Skill trait on it.
Basically if the Traits on your weapon looks like this, there's your problem:
View attachment 359242
3. Also make sure that the weapon you are using doesn't have the <JS Replace Attack> as well.
By the way, I was wondering if you might have any idea on how to achieve a similar thing, but where the condition is that I'm only checking for whether the player doesn't have any weapons equipped, and *not* if they have neither weapons, nor shields equipped?

I tried writing something in the noteags like
id = user.weapons().length == 0 ? x : 1;
after the <js replace attack> script, replacing, "x" with a different skill id that I want to test, but it doesn't seem to be working.
id = user.weapons().length == 0 ? x : 1;
Tested it out. The code works.
But out of curiosity, where are you putting this code and is it already on an actor/class with the previous one? Because if so then you might want to rewrite the code I've gave you to:
Code:
<JS Replace Attack>
id = (user.weapons().length == 0 && !user.equips()[1]) ? 12 : (user.weapons().length == 0 ? y : 1);
</JS Replace Attack>
'Y' being the skill id you want to use.
Tested it out. The code works.
But out of curiosity, where are you putting this code and is it already on an actor/class with the previous one? Because if so then you might want to rewrite the code I've gave you to:
Code:
<JS Replace Attack>
id = (user.weapons().length == 0 && !user.equips()[1]) ? 12 : (user.weapons().length == 0 ? y : 1);
</JS Replace Attack>
'Y' being the skill id you want to use.
Oh yeah, that was it. For some reason I was thinking I'd have to put the code physically into the notetags of the different skills I wanted to utilize. Thanks! With this I've even managed to modifiy things so that the default attack can be replaced even if you only have either/or a shield equipped or a weapon equipped, although I think I'll restrict it to the scope of the code you gave me where having a weapon eqquipped, while not having a shield equipped, doesn't replace the default attack. Thanks, bruv!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-replace-the-default-attack-with-visustellas-weapon-unleashed-plugin.182186/