I am trying to replicate some very old school methods of assigning enemy targeting. The character in the first position takes 50% of the damage, the character in the next stop takes 25%, the last 2 take 12% each.
I have a rough formula laid out for it, but it's clearly not working, and my programming skill is insufficient to find where I've made an obvious mistake. The skill fires without an error, but does absolutely nothing.
The second part of this, is that I would like it to only apply when an enemy is using the skill, and then player characters behave normally. This is less important, because I can just make an "Enemy Attack" skill and duplicate everything, I just like to have my skills cross compatible.
I have a rough formula laid out for it, but it's clearly not working, and my programming skill is insufficient to find where I've made an obvious mistake. The skill fires without an error, but does absolutely nothing.
<Custom Target Eval>
var rng = Math.random();
if (rng <= 0.49 && !$gameParty.members()[0].isDead) {
targets.push($gameParty.members()[0]);
}
else if (rng <= 0.74 && !$gameParty.members()[1].isDead) {
targets.push($gameParty.members()[1]);
}
else if (rng <= 0.87 && !$gameParty.members()[2].isDead) {
targets.push($gameParty.members()[2]);
}
else if (!$gameParty.members()[3].isDead) {
targets.push($gameParty.members()[3]);
}
else if (!$gameParty.members()[0].isDead) {
targets.push($gameParty.members()[0]);
}
else if (!$gameParty.members()[1].isDead) {
targets.push($gameParty.members()[1]);
}
else (!$gameParty.members()[2].isDead) {
targets.push($gameParty.members()[2]);
}
</Custom Target Eval>
var rng = Math.random();
if (rng <= 0.49 && !$gameParty.members()[0].isDead) {
targets.push($gameParty.members()[0]);
}
else if (rng <= 0.74 && !$gameParty.members()[1].isDead) {
targets.push($gameParty.members()[1]);
}
else if (rng <= 0.87 && !$gameParty.members()[2].isDead) {
targets.push($gameParty.members()[2]);
}
else if (!$gameParty.members()[3].isDead) {
targets.push($gameParty.members()[3]);
}
else if (!$gameParty.members()[0].isDead) {
targets.push($gameParty.members()[0]);
}
else if (!$gameParty.members()[1].isDead) {
targets.push($gameParty.members()[1]);
}
else (!$gameParty.members()[2].isDead) {
targets.push($gameParty.members()[2]);
}
</Custom Target Eval>
The second part of this, is that I would like it to only apply when an enemy is using the skill, and then player characters behave normally. This is less important, because I can just make an "Enemy Attack" skill and duplicate everything, I just like to have my skills cross compatible.