Need help with Yanfly's Auto-Potion notetag

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
413
Reaction score
194
First Language
English
Primarily Uses
RMMV
So I have Yanfly's Auto-Potion notetag that I'm using but after reading through it, it seems to go off every time the character takes damage, which would waste off your potion supply pretty quickly. So I was wondering if someone knew how to add a condition so that it only goes off if HP falls below a certain percentage (like 50% or 25%).

JavaScript:
//(Requires Battle Engine Core, Buff & States Core, Skill Core, Auto Passive States & Counter Control)

//Skill Notetag:
// Make this skill react as a counter to anything.
<Counter Condition>
</Counter Condition>

<Custom Requirement>
// Set the original condition to false.
value = false;
// If the user is an actor...
if (user.isActor()) {
  // Create an array of valid potions the counter can use.
  var potions = [];
  // Add the ID's of the potions that can be used for Auto-Potion.
  potions.push(1, 2, 3, 4);
  potions.push(5, 6, 7, 8);
  // Loop through each of the potion ID's.
  for (var i = 0; i < potions.length; ++i) {
    // Get the current ID.
    var id = potions[i];
    // If the party has this potion in its item bag...
    if ($gameParty.numItems($dataItems[id]) > 0) {
      // ...then set the value to true.
      value = true;
      // ...and break the loop.
      break;
    }
  }
// If the user isn't an actor...
} else {
  // ...then the condition is automatically fulfilled.
value = true;
}
</Custom Requirement>

<After Eval>
var potions = [];
potions.push(1, 2, 3, 4);
potions.push(5, 6, 7, 8);
for (var i = 0; i < potions.length; ++i) {
  var id = potions[i];
  if ($gameParty.numItems($dataItems[id]) > 0) {
    var item = $dataItems[id];
    if (user.isActor()) {
      $gameParty.loseItem(item, 1);
    }
    this.setItem(id);
    var text = '<CENTER>' + user.name() + ' uses \\i[' + item.iconIndex + ']' + item.name + '!';
    BattleManager.addText(text);
    break;
  }
}
</After Eval>

<setup action>
display action
action effect
</setup action>

State Notetag:
// This is the ID of the Auto-Potion counter skill.
<Counter Skills: 24>
// This is the number of times the user can use Auto-Potion per turn.
<Counter Total: +20>
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts



It's my birthday! :kaoluv: Also, Cupcake is done and out(ill post about it in a couple of days, busy today)
Not to be greedy, but if anyone happens to have VX Ace or MV Resource steam keys that I don't have, lying around, I'd be happy to take them off your hands.
Got accepted into the architecture degree. Now I have all the doubting questions. Have to give them an answer in the next few days.
Just realized I have a few Steam gifts floating around. Anyone need RPG Maker MV or XP (Steam only)? Send me a message and I will send them on over!

EDIT: Just an RPG Maker MV gift remaining! XP has been taken.
*when you can do the Unity tutorials, but when you actually try and convert it to your own knowledge, it fails horribly*

Forum statistics

Threads
100,577
Messages
977,414
Members
132,163
Latest member
Guhh
Top