- Joined
- May 5, 2020
- Messages
- 168
- Reaction score
- 65
- First Language
- French
- Primarily Uses
- RMMV
Hello! Need some help conceptualizing this one out.
In essence, I have a skill that applies a debuff state. What I want to add is: for 5 turns, this state will remove itself from current enemy and jump to another enemy.
Here's what I'm thinking of:
1- Skill applies state (duration 1 turn)
2- State to have Custom Apply
3- Every turn, the state removes itself, so in my state, I would also have:
Wondering if anyone would approach this one differently?
In essence, I have a skill that applies a debuff state. What I want to add is: for 5 turns, this state will remove itself from current enemy and jump to another enemy.
Here's what I'm thinking of:
1- Skill applies state (duration 1 turn)
2- State to have Custom Apply
Code:
<Custom Apply Effect>
// Duration of plague
target._plagueTurns = 5;
</Custom Apply Effect>
Code:
<Custom Remove Effect>
// Check if the party is in battle.
if ($gameParty.inBattle()) {
// Remove 1 turn from plague duration
target._plagueTurns -= 1;
// Plague only jumps if >0 turns left
if target._plagueTurns > 0 {
// Get list of all foes
var members = user.opponentsUnit().aliveMembers();
// Remove current bearer of plague
members.splice(members.indexOf(user), 1);
// Select one member to transfer the plague to
var member = members[Math.floor(Math.random() * members.length)];
// Transfer plague state and remaining turns
member.addState(10);
member._plagueTurns = user._plagueTurns;
}
} else {
// Not in battle, kill the plague
user._plagueTurns = 0;
}
}
</Custom Remove Effect>
