Hi I try to modified the death nova script from yanfly plugin tips and trick. But I whant this state as a debuff and not a buff. So lets say I kill a enemy with this state , he explode on all his ally. I thought I can probably get this effect by switching most of the foe word by ally. But something is off cause he doesnt work.
Here the script I have right now.:
Can someone try it ? This script goes in the knockout state.
---------------------------------
State #1 will be automatically added when
HP reaches 0.
// Death Nova
<Custom Apply Effect>
// Get the Death Nova state's ID
var deathNovaId = 74;
// Check if the target is dead and is affected by the Death Nova state
if (target.isDead() && target.isStateAffected(deathNovaId)) {
// Get the poison state
var poisonId = 4;
// Get the original caster for the Death Nova state
var caster = target.stateOrigin(deathNovaId);
// Calculate the damage dealt
var dmg = caster.mat * 3;
// Get the dying unit's opponents
var foes = target.opponentsUnit().aliveMembers();
// Loop through the foes
for (var i = 0; i < foes.length; ++i) {
// Get the currently looped foe
var foe = foes;
// Check if the ally exists
if (ally) {
// Make the ally take damage.
ally.gainHp(-dmg);
// Add the poison state to the ally.
ally.addState(4);
// Show the damage popup.
ally.startDamagePopup();
// Check if the ally is dead
if (ally.isDead()) {
// If it is, collapse the ally
ally.performCollapse();
}
// Clear the ally's results
ally.clearResult();
}
}
// Play an animation on the dying unit
target.startAnimation(109);
// Remove the Death Nova state
target.removeState(74);
}
</Custom Apply Effect>
Here the script I have right now.:
Can someone try it ? This script goes in the knockout state.
---------------------------------
State #1 will be automatically added when
HP reaches 0.
// Death Nova
<Custom Apply Effect>
// Get the Death Nova state's ID
var deathNovaId = 74;
// Check if the target is dead and is affected by the Death Nova state
if (target.isDead() && target.isStateAffected(deathNovaId)) {
// Get the poison state
var poisonId = 4;
// Get the original caster for the Death Nova state
var caster = target.stateOrigin(deathNovaId);
// Calculate the damage dealt
var dmg = caster.mat * 3;
// Get the dying unit's opponents
var foes = target.opponentsUnit().aliveMembers();
// Loop through the foes
for (var i = 0; i < foes.length; ++i) {
// Get the currently looped foe
var foe = foes;
// Check if the ally exists
if (ally) {
// Make the ally take damage.
ally.gainHp(-dmg);
// Add the poison state to the ally.
ally.addState(4);
// Show the damage popup.
ally.startDamagePopup();
// Check if the ally is dead
if (ally.isDead()) {
// If it is, collapse the ally
ally.performCollapse();
}
// Clear the ally's results
ally.clearResult();
}
}
// Play an animation on the dying unit
target.startAnimation(109);
// Remove the Death Nova state
target.removeState(74);
}
</Custom Apply Effect>