• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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 Jun 11, 2024
    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