I was wondering if anyone could help me make a skill that when used on an enemy with a specific state, it inflicts the state to another random enemy(s), being able to choose how many would be great but if it just has to be one that's perfectly okay too.
This is the closest thing I've found however it spreads the state to all enemies.
https://forums.rpgmakerweb.com/index.php?threads/spreading-states.92925/#post-843631
This is the code from the link if you don't feel like going to it.
Code:
<Post-Damage Eval>
var spread = [4,5,6];
spread = target.states().filter(function(state) {
return spread.indexOf(state.id) > -1;
});
if (spread.length > 0) {
var group = target.friendsUnit().members();
group.splice(target.index(), 1);
while (spread.length > 0) {
var state = spread.shift();
group.forEach(function(targ) {
targ.addState(state.id);
});
}
}
</Post-Damage Eval>
Any help is greatly appreciated, thanks for your time.
This is the closest thing I've found however it spreads the state to all enemies.
https://forums.rpgmakerweb.com/index.php?threads/spreading-states.92925/#post-843631
This is the code from the link if you don't feel like going to it.
Code:
<Post-Damage Eval>
var spread = [4,5,6];
spread = target.states().filter(function(state) {
return spread.indexOf(state.id) > -1;
});
if (spread.length > 0) {
var group = target.friendsUnit().members();
group.splice(target.index(), 1);
while (spread.length > 0) {
var state = spread.shift();
group.forEach(function(targ) {
targ.addState(state.id);
});
}
}
</Post-Damage Eval>
Any help is greatly appreciated, thanks for your time.