Kind of hacking together several MV YEP tips and tricks here, but I've clearly missed something as it seems to be inoperative. Can someone diagnose it?
This is a passive state that, at combat start, picks a random buff and applies it to a random party member:
There's also probably a simpler way of doing this but this one made most sense to me.
This is a passive state that, at combat start, picks a random buff and applies it to a random party member:
JavaScript:
<Custom Battle Effect>
// This is the number of turns the buffs and debuffs will last
var turns = 4;
// Create a pool for the parameters that can be changed
var allowedParams = [];
// Insert Param ID's you want to randomly add here:
allowedParams.push(2, 4, 6, 7);
// Make a copy of the pool
var result = allowedParams.slice();
// Initialize the parameter ID
var paramId;
// Loop through each of the copied pool's parameters
while (result.length > 0) {
// Get a randomly looped parameter
paramId = result[Math.floor(Math.random() * result.length)];
// Remove it from the copied pool
result.splice(result.indexOf(paramId), 1);
var members = [];
// Loop through each of the target's alive allies.
for (var i = 0; i < target.friendsUnit().aliveMembers().length; ++i) {
// Set the potential variable to the current looped ally.
var potential = target.friendsUnit().aliveMembers()[i];
// If the ally doesn't exist, move onto the next.
if (!potential) continue;
// If the ally's HP is at zero (hence dead), move onto the next.
if (potential.hp <= 0) continue;
// Now that all checks have been cleared, put the potential ally into the members array.
members.push(potential);
}
// Get a random member of the members array.
var member = members[Math.floor(Math.random() * members.length)];
// Check if the random member exists.
if (member) {member.addBuff(paramId, turns); }
break;
}
}
</Custom Battle Effect>