Yanfly's Plague Touch skill allows the user to transfer all status ailments he is affected by to the enemy.
I would like the skill to only transfer one random status ailment or two random status ailments but not all of them at once.
Is that possible? How do I have to modify the code?
Ideally I'd like the loop to find all States of the according category (in this case 'Ailment') then select a random one of those, remove it from the user and add it to the target.
Also see here: http://yanfly.moe/2016/06/08/tips-tricks-plague-touch-guild-wars-rpg-maker-mv/#more-3062
I would like the skill to only transfer one random status ailment or two random status ailments but not all of them at once.
Is that possible? How do I have to modify the code?
<Custom Requirement>
// Check state count for state category the user is affected by.
var count = user.getStateCategoryAffectedCount('Ailment');
// Set the requirement condition to be dependent on the count.
value = count > 0;
</Custom Requirement>
// Skill Core
<After Eval>
// Get the states the user is currently affected by.
var states = user.states();
// This is the category we want to transfer.
var category = 'Ailment';
// Create a loop that goes through each state.
while (states.length > 0) {
// Get the currently looped state.
var state = states.shift();
// Check if the state's categories has the one we want.
if (state.category.contains(category.toUpperCase())) {
// Get the number of turns left on the user for the state.
var turns = user.stateTurns(state.id);
// Remove the state from the user.
user.removeState(state.id);
// Add the state to the target.
target.addState(state.id);
// Check if the addition of the state went through.
if (target.isStateAffected(state.id)) {
// Set the number of turns for that state for the target.
target.setStateTurns(state.id, turns);
}
}
}
</After Eval>
// Check state count for state category the user is affected by.
var count = user.getStateCategoryAffectedCount('Ailment');
// Set the requirement condition to be dependent on the count.
value = count > 0;
</Custom Requirement>
// Skill Core
<After Eval>
// Get the states the user is currently affected by.
var states = user.states();
// This is the category we want to transfer.
var category = 'Ailment';
// Create a loop that goes through each state.
while (states.length > 0) {
// Get the currently looped state.
var state = states.shift();
// Check if the state's categories has the one we want.
if (state.category.contains(category.toUpperCase())) {
// Get the number of turns left on the user for the state.
var turns = user.stateTurns(state.id);
// Remove the state from the user.
user.removeState(state.id);
// Add the state to the target.
target.addState(state.id);
// Check if the addition of the state went through.
if (target.isStateAffected(state.id)) {
// Set the number of turns for that state for the target.
target.setStateTurns(state.id, turns);
}
}
}
</After Eval>
Ideally I'd like the loop to find all States of the according category (in this case 'Ailment') then select a random one of those, remove it from the user and add it to the target.
Also see here: http://yanfly.moe/2016/06/08/tips-tricks-plague-touch-guild-wars-rpg-maker-mv/#more-3062