Minify Skill and Mini State

I've created a Minify Skill. It visually shrinks the enemy and reduces their Max HP to 50% for a few turns.

1741330828999.png


The shrinking is done via a VisuStella Battle Core Action Sequence in a Minify Common Event:

◆Common Event:Hunt Start
◆Comment:----Pow!
◆Plugin Command:VisuMZ_1_BattleCore, ANIM: Attack Animation
:Plugin Command:Targets = ["current target"]
:Plugin Command:Mirror Animation = false
:Plugin Command:Wait For Animation? = true
◆Comment:----Shrink
◆Plugin Command:VisuMZ_1_BattleCore, MOVE: Scale/Grow/Shrink
:Plugin Command:Targets = ["current target"]
:Plugin Command:Scale X = 0.5
:Plugin Command:Scale Y = 0.5
:Plugin Command:Duration = 30
:Plugin Command:Scale Easing = Linear
:Plugin Command:Wait For Scale? = true
◆Plugin Command:VisuMZ_1_BattleCore, MECH: Action Effect
:Plugin Command:Targets = ["current target"]
◆Common Event:Hunt End

I created a Mini State so that the state will expire in a few rounds

Traits
Parameter: Max HP * 50%

The problem is I want the enemy to return to normal size after the state wears off. The Action Sequence commands have a Target parameter, but by the time the state wears off I could be targeting a different enemy, so "current target" doesn't work. I get around this by putting the enemy ID in a variable, and use the Art_BCTargetExtension plugin which adds "enemy index var x" as an option in the Target parameters.

Notetag
<JS On Expire State>
const enemyIndex = $gameTroop.members().indexOf(this);
$gameVariables.setValue(1, enemyIndex);
$gameTemp.reserveCommonEvent(38); //Magnify
</JS On Expire State>

I have the Magnify Common Event action sequence to change the enemy back to normal.

◆Plugin Command:VisuMZ_1_BattleCore, MOVE: Scale/Grow/Shrink
:Plugin Command:Targets = ["enemy index var 1"]
:Plugin Command:Scale X = 1
:Plugin Command:Scale Y = 1
:Plugin Command:Duration = 30
:Plugin Command:Scale Easing = Linear
:Plugin Command:Wait For Scale? = true

This does all work, but I can't help thinking I've made things way more complicated than they need to be. Can anyone suggest a better way for an expiring state to triggering an action sequence and have the actions apply to the afflicted enemy? And what if I want the Mini state to also be able to affect actors?
Doesn't it work with just:

<JS On Add State>
target.battler().scale.x = 0.5;
target.battler().scale.y = 0.5;
</JS On Add State>

<JS On Erase State>
target.battler().scale.x = 1;
target.battler().scale.y = 1;
</JS On Erase State>
Doesn't it work with just:

<JS On Add State>
target.battler().scale.x = 0.5;
target.battler().scale.y = 0.5;
</JS On Add State>

<JS On Erase State>
target.battler().scale.x = 1;
target.battler().scale.y = 1;
</JS On Erase State>
Yes, but two problems:
(1) Even though scaling the x and y by the same amount should make it half the size, the sprite is distorted, stretched taller than expected, and
(2) the bigger problem, the sprite just changes size instantly. With the Battle Core plugin the sprite eases into and out of the new sizes in a smooth animation.

Still, thank you for the suggestion. It's good to know different methods.
Yeah, if you want it to take time, you could make a loop to change the scale gradually. Don't know what's causing the distortion though.

Anyway, by using the method given for another VS problem by 'Another Fen' and the plugin command script, here's kind of a solution (I say kind of, because for some reason I needed to give any kind of Battle Core plugin command before this script form started working, one of the coders here might know the reason 😀 )

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

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>

edit: to clarify what I meant, if I made a troop event turn 1 give mini-state to enemy, turn 2 give mini-state to actor, nothing happened. but if before giving the state in the turn 1 event used a battlecore plugin command to like move a battler 5 pixels forward (or whatever), then everything worked when adding the state and both the enemy and actor shrunk on their turns.

edit2: also realized that it'd probably be better coding to declare the variable outside the if branches and just assign it a value there 😀
Yeah, if you want it to take time, you could make a loop to change the scale gradually. Don't know what's causing the distortion though.

Anyway, by using the method given for another VS problem by 'Another Fen' and the plugin command script, here's kind of a solution (I say kind of, because for some reason I needed to give any kind of Battle Core plugin command before this script form started working, one of the coders here might know the reason 😀 )

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

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>

edit: to clarify what I meant, if I made a troop event turn 1 give mini-state to enemy, turn 2 give mini-state to actor, nothing happened. but if before giving the state in the turn 1 event used a battlecore plugin command to like move a battler 5 pixels forward (or whatever), then everything worked when adding the state and both the enemy and actor shrunk on their turns.

edit2: also realized that it'd probably be better coding to declare the variable outside the if branches and just assign it a value there 😀
Thanks for that. I gave it try, couldn't get it working, but I do have my own workaround. It was useful to see how if (target.isEnemy()) could be used. I'll give that a crack 🙂

Original thread: https://forums.rpgmakerweb.com/threads/minify-skill-and-mini-state.176055/