Hey everyone, looking for support and/or advice.
I want to incorporate a mechanic where flying enemies are hard to hit unless you use a ranged weapon/skill. I've been experimenting and racking my brain trying to develop the best ways to implement this.
My latest attempt was to use Yanfly's Buffs and States Core and Auto Passive States. I made a "Flying" passive state and gave it the following note tags to check if the incoming attack is ranged, and if not, to enforce a 50/50 chance of a forced miss:
Unfortunately, that doesn't seem to do it. Whether the coin toss comes up one way or the other, the hit/HP damage executes as normal.
I tried using the <Custom React Effect> tag from the Buffs and States Core as well, but all that did was make the "Miss" popup occur twice; the damage and hit sound were still applied as normal. I went with <Custom Select Effect> because the instructions said it would execute after the target is selected, but before damage calculation.
While I'm comfortable with JavaScript, I'm still not totally well-versed in how RPG Maker MV works under the hood. Delving into rpg_objects.js a bit, I suspect the problem may lie in how hit/damage calculation is handled, but I thought I'd ask if someone more experienced has any advice.
Is there a way to fix my notetags to get the desired result? If this isn't a viable strategy, is there a reasonable alternative to implement this mechanic? I'm not attached to the coin toss solution. If there's a way to say fluxuate accuracy or evasion based on the state applied and element used against the enemy, I'm open-minded to a solution like that.
Any solution that wouldn't be horrendously tedious to implement across every flying enemy in the game would be taken into consideration and much appreciated.
Thank you for your time. 🙂
I want to incorporate a mechanic where flying enemies are hard to hit unless you use a ranged weapon/skill. I've been experimenting and racking my brain trying to develop the best ways to implement this.
My latest attempt was to use Yanfly's Buffs and States Core and Auto Passive States. I made a "Flying" passive state and gave it the following note tags to check if the incoming attack is ranged, and if not, to enforce a 50/50 chance of a forced miss:
JavaScript:
<Custom Select Effect>
// Check if the action deals HP damage
if (this.isHpEffect()) {
//ID of Ranged element
var rangedElement = 6;
// Get the current elements of the action
var elements = this.getItemElements();
//If the incoming attack is not ranged
if (!elements.contains(rangedElement)) {
//50% chance of a forced miss, roll for it
var coinFlip = Math.random();
if (coinFlip < 0.5) {
//Lost the coin toss, it's a miss
b.result().missed = true;
}
}
}
</Custom Select Effect>
I tried using the <Custom React Effect> tag from the Buffs and States Core as well, but all that did was make the "Miss" popup occur twice; the damage and hit sound were still applied as normal. I went with <Custom Select Effect> because the instructions said it would execute after the target is selected, but before damage calculation.
While I'm comfortable with JavaScript, I'm still not totally well-versed in how RPG Maker MV works under the hood. Delving into rpg_objects.js a bit, I suspect the problem may lie in how hit/damage calculation is handled, but I thought I'd ask if someone more experienced has any advice.
Is there a way to fix my notetags to get the desired result? If this isn't a viable strategy, is there a reasonable alternative to implement this mechanic? I'm not attached to the coin toss solution. If there's a way to say fluxuate accuracy or evasion based on the state applied and element used against the enemy, I'm open-minded to a solution like that.
Any solution that wouldn't be horrendously tedious to implement across every flying enemy in the game would be taken into consideration and much appreciated.
Thank you for your time. 🙂