- Joined
- Jun 7, 2014
- Messages
- 158
- Reaction score
- 90
- First Language
- Fake English
- Primarily Uses
- RMMV
So as per the usual I'm using Yanfly's Battle engine including buffs and states, skill core, etc. If there a way I can check if something is making an attack before it determines hit/miss on a buff? I decided to recreate Jhin's passive from League of legends for fun, got everything working but I'd really like to make it so a missed hit still costs a bullet. Here's the code I've thrown together
Code:
<custom apply effect>
// set ammo
target._ammo = 4;
// display counter
target.setStateCounter(19, target._ammo);
</custom apply effect>
<custom remove effect>
// reset ammo value
target._ammo = undefined;
// reset state counter
target.setStateCounter(19, 0);
</custom remove effect>
<Custom Confirm Effect>
// Check if affected battler is attacking
if (this.isHpEffect() && value > 0) {
// if so, deduct the ammo count
user._ammo -= 1;
// also update the counter
user.setStateCounter(19, user._ammo);
}
// check if that was the last bullet
if (user._ammo === 0) {
// set up the new value
var change = (value * 2);
//apply the new value
value = change;
}
</Custom Confirm Effect>
<Custom Conclude Effect>
//check if out of ammo
if (user._ammo === 0){
// if so remove the buff
user.removeState(19);
}
</Custom Conclude Effect>
