Have character grow in size for duration of a state?

I'm using Visustella battle core and i know you can grow and shrink characters with an action sequence, but is there a way
to have it grow a character in size on <JS state apply> and shrink on <JS State Erase>? I want the character to grow when the state is active and shrink back to normal size when it is over.
Put the plugin commands in script form. I've posted it earlier here, but like I said, for some reason it only seems to run if you've used BattleCore plugin commands previously. I mean like it works if I make a troop event do a random Battle Core plugin command (unnoticeable) at turn 0.

<JS On Add State>
let targets = 0;
if (target.isEnemy()) {
$gameVariables.setValue(20, target.index());
targets = JSON.stringify( [`enemy index ${$gameVariables.value(20)}`] );
}
if (target.isActor()) {
$gameVariables.setValue(20, target.index());
targets = JSON.stringify( [`actor index ${$gameVariables.value(20)}`] );
}

PluginManager.callCommand(this, 'VisuMZ_1_BattleCore', 'ActSeq_Movement_Scale', {
'Targets:arraystr' : targets,
'ScaleX:eval' : 0.5,
'ScaleY:eval' : 0.5,
'Duration:eval' : 60,
'EasingType:str' : 'Linear',
'WaitForScale:eval' : true
});
</JS On Add State>
Put the plugin commands in script form. I've posted it earlier here, but like I said, for some reason it only seems to run if you've used BattleCore plugin commands previously. I mean like it works if I make a troop event do a random Battle Core plugin command (unnoticeable) at turn 0.

<JS On Add State>
let targets = 0;
if (target.isEnemy()) {
$gameVariables.setValue(20, target.index());
targets = JSON.stringify( [`enemy index ${$gameVariables.value(20)}`] );
}
if (target.isActor()) {
$gameVariables.setValue(20, target.index());
targets = JSON.stringify( [`actor index ${$gameVariables.value(20)}`] );
}

PluginManager.callCommand(this, 'VisuMZ_1_BattleCore', 'ActSeq_Movement_Scale', {
'Targets:arraystr' : targets,
'ScaleX:eval' : 0.5,
'ScaleY:eval' : 0.5,
'Duration:eval' : 60,
'EasingType:str' : 'Linear',
'WaitForScale:eval' : true
});
</JS On Add State>
I’m using visustealla chain battles on every battle anyways so that’s should do. I’ll give this a try thank you very much.

Edit: Worked like a charm thank you. Just for my own knowledge later are you storing the sprite data in variable 20?
I’m using visustealla chain battles on every battle anyways so that’s should do. I’ll give this a try thank you very much.

Edit: Worked like a charm thank you. Just for my own knowledge later are you storing the sprite data in variable 20?

Cool.

And the variable stores the index. Target comes from VS and is the battler affected by the state.

Original thread: https://forums.rpgmakerweb.com/threads/have-character-grow-in-size-for-duration-of-a-state.177029/