Resetting "Command Remember" for a character when changing class.

Hi gang! 🙂

I'm currently using BattleCore Custom Action Sequences for the various weapon types which involves placing a different "skill" ID for different default attack types, e.g. Skill 0007: Attack for thrusting, and 0008: Attack for slashing, each with a different custom animation.

For each class, I replace the default Attack (Skill 0001) with the custom ones with the <Battle Commands> tag in the class notetags.

Now my protagonist can use spears and side swords, so when he switches from a Spear to a Sword in his equipment, I have a common event that switches his SV battler and changes his class to an identical copy (e.g. 0001 Dragoon to 0002 Dragoon) except the attack command is switched from Skill 0007 to 0008 (thrust to slash).


Here's the issue: if the last command selected while using a spear was "Attack" (Skill 0007) then when you change equipment the Command Remember wants to use Skill 0007, but Skill 0008 is there in its place, so you get an error noise when selecting attack. It's easy enough to fix by just scrolling down one and then back up to hit attack. But this is poor presentation. A brute force solution is to disable command remember altogether and not give the player access to it, but I don't want that either. I want the player to have the option.


TL;DR is there some script call or some way to "refresh" the command remember for a character (which I would trigger when switching weapons on that character). The only script call I've found which is related is

Code:
ConfigManager.commandRemember = false;
ConfigManager.save();

But that just turns off command remember globally and the player would have to manually turn it back on... every time they switch weapon types. That's no fun!
I'm not sure how you are implementing your changes, but you can try:

Code:
$gameActors.actor(x)._lastBattleSkill["_itemId"] = y
// x = actor ID
// y = skill ID
Ahh, so close! It works on weapon switches so long as Attack actually was the last command I'd used. I tested using Magic and the next battle he had no options selected, I had to start hitting direction buttons to highlight commands (error noise if you try to hit confirm beforehand).

Otherwise, I'm wondering if this code doesn't simply overwrite the behaviour of "Remember Command", making it effectively useless for that character.

However, this script has given me something to play with and maybe I could figure something out. Thank you so much. By the way, is there another reference sheet for script calls? That one you just gave me is absent from the one that I have.

I'm not sure how you are implementing your changes

I have a parallel Common Event just running in the background at all times detecting which weapon I have equipped for that character, and to change their SV Battler and Class accordingly. I added the script you gave me to each of the weapons I have:

Screenshot 2025-10-11 163819.png
If you look at how it works, if the symbol is "skill" then it uses the selectEx to find the correct skill type. For visustella the symbol for those battle command skills seems to be "single skill" (or whatever, I checked it but forgot already). For skilltypes the base engine uses findExt to find the command that has ext that is the skilltype. I assume the modified visustella function searches for a single skill command with an ext that is the skill id. But if you changed the skill, it can't find that and then the findExt (or whatever it uses) would return -1. In the base methods I checked it should revert to 0, if the value it gets is < 0, but I guess it doesn't happen in the modified function. I don't know. I tried aliasing the VS modified selectLast method to set the index to 0 if it's less than 0 and it seemed to work:

const _MyVisuEdit1_SelectLast = Window_ActorCommand.prototype.selectLast;

Window_ActorCommand.prototype.selectLast = function() {
_MyVisuEdit1_SelectLast.call(this);
if (this.index() < 0)
this.forceSelect(0);
};

But anyway, in Rpg Maker MZ there's a trait called 'attack skill' that you can set on a class. Why are you using the battle commands notetag to use a skill as the basic attack?
But anyway, in Rpg Maker MZ there's a trait called 'attack skill' that you can set on a class. Why are you using the battle commands notetag to use a skill as the basic attack?

Ah, that'll be because I'm a novice and completely overlooked that! I didn't know that was an option!

Naturally, I've been overcomplicating it! Thank you so much, that's a much more elegant solution - works a treat.
Cool, yeah you could set the trait on your weapons too, so you don't need to change classes.
Cool, yeah you could set the trait on your weapons too, so you don't need to change classes.

Holy crap I CAN!

It may be a small thing, but I've been brainstorming how to go about implementing this for ages, and here you come with the simple fix. The relief I feel is immense. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/resetting-command-remember-for-a-character-when-changing-class.180514/