• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] How to make an item like potion,, energy powder, moomoo milk and etc consumable in battle via an ability?

  • 12
    Posts
    4
    Years
    • Seen Apr 19, 2025
    Anyone knows how to make an item like potion,, energy powder, moomoo milk and etc consumable in battle via an ability so it can be triggered in battle when the HP goes below half only if a Pokemon knows this specific ability? I'm like 3 hours trying to make this work, I asked for a friends help and nothing :frowning:

    This is what I have right now, but it's not working

    BattleHandlers::AbilityOnHPDroppedBelowHalf.add(:HERBALIST,
    proc { |ability,battler,battle|
    next if ![:ENERGYPOWDER, :ENERGYROOT,:SUPERHERB, :HEALPOWDER].include?(battler.item)
    amt = 0
    case battler.item
    when :ENERGYPOWDER; amt = 50
    when :ENERGYROOT; amt = 200
    when :SUPERHERB; amt = 999
    end
    if amt > 0
    next if battler.hp == battler.totalhp
    battle.pbShowAbilitySplash(battler)
    battler.pbRecoverHP(amt)
    if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
    battle.pbDisplay(_INTL("{1}'s HP was restored.",battler.pbThis))
    else
    battle.pbDisplay(_INTL("{1}'s {2} restored its HP.",battler.pbThis,battler.abilityName))
    end
    battler.changeHappiness("superherb") if battler.item == :SUPERHERB
    else
    next if battler.status == :NONE
    battle.pbShowAbilitySplash(battler)
    battler.heal_status
    battler.changeHappiness("powder")
    battle.pbDisplay(_INTL("{1} became healthy.",battler.pbThis))
    end
    battle.pbHideAbilitySplash(battler)
    }
    )
     
    Back
    Top