Problem
I'm working on a battle system that to make it easy for you to comprehend, looks a lot like Pokémon. There's monster battlers that use skills and a human trainer that can use items on his monsters. The problem is that MV is designed more for individual battlers, that use items themselves. This means that if an actor is sleeping or otherwise can't move, it'll skip the turn and thus can't use items.
My attempts
The standard state functionality regarding incapacitated states can't really be used. Pokémon allows you to use items even when the Pokémon is sleeping. To replicate that I've looked at Yanfly's implementation of Paralyze:
http://yanfly.moe/2016/07/22/tips-tricks-paralyze-pokemon-rpg-maker-mv/
This uses the following code and his Battle Core/Buffs and States Core plugins:
This would work perfectly if not for the fact that if you use user.clearActions(); it also clears the item action you selected. I haven't find a JS script on how to do this while still not clearing the item actions.
Question
How to use items while actor is asleep/incapacitated? I don't mind if it uses JavaScript commands or a plugin.
I'm working on a battle system that to make it easy for you to comprehend, looks a lot like Pokémon. There's monster battlers that use skills and a human trainer that can use items on his monsters. The problem is that MV is designed more for individual battlers, that use items themselves. This means that if an actor is sleeping or otherwise can't move, it'll skip the turn and thus can't use items.
My attempts
The standard state functionality regarding incapacitated states can't really be used. Pokémon allows you to use items even when the Pokémon is sleeping. To replicate that I've looked at Yanfly's implementation of Paralyze:
http://yanfly.moe/2016/07/22/tips-tricks-paralyze-pokemon-rpg-maker-mv/
This uses the following code and his Battle Core/Buffs and States Core plugins:
Code:
// Disables instant skills from paralyze as to not abuse the mechanic.
<Cancel Instant Skill: 1 to 2000>
<Cancel Instant Item: 1 to 2000>
<Custom Action Start Effect>
// Set the paralyze success rate.
var paralyzeRate = 0.25;
// Make a random number check to see if paralyze passes...
if (Math.random() < paralyzeRate) {
// If it does, play the paralyze animation on the target.
user.startAnimation(64);
// Check for the user's current action...
if (user.currentAction()) {
// And make the user consume its resources.
user.useItem(user.currentAction().item());
}
// Clear the user's actions making the user lose the actions.
user.clearActions();
// Get the log window from battle.
var logWindow = SceneManager._scene._logWindow;
// Check if the paralyze state has text in message 3
if (state.message3) {
// If it does, create a message based on it.
var msg = '<CENTER>' + user.name() + state.message3;
// Add the text to the log window to display in battle.
logWindow.addText(msg);
}
// Make the battle wait for the paralysis animation to finish playing.
BattleManager.actionWaitForAnimation();
// Clear the log window.
logWindow.push('clear');
}
</Custom Action Start Effect>
This would work perfectly if not for the fact that if you use user.clearActions(); it also clears the item action you selected. I haven't find a JS script on how to do this while still not clearing the item actions.
Question
How to use items while actor is asleep/incapacitated? I don't mind if it uses JavaScript commands or a plugin.