• 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] Help with a custom ability

  • 2
    Posts
    3
    Years
    • Seen Jun 5, 2021
    Hi there! Thanks for taking the time to read this post in advance! I saw this really neat ability from the fangame Pokemon Azurite and would greatly appreciate if someone could suggest how to code them in Essentials.

    Voodoo: Any damage that the user receives will also be received by Pokemon on the field that share the same egg group as it.

    I'm very new to Essentials so if someone could help me out, I'd really apperciate it!
     
    well, I also love interesting coding problems, so here we go, v19 code. It was similar to Innards Out so I used that as reference.
    Ditto does not count as every type, and would only match with Ditto.

    This will hit any pokemon on the field, friend or foe.
    Code:
    BattleHandlers::TargetAbilityOnHit.add(:VOODOO,
      proc { |ability,user,target,move,battle|
        next if !target.fainted?
        battle.pbShowAbilitySplash(target)
        target_egg_group = target.pokemon.species_data.egg_groups
        battle.battlers.each do |b|
          next if !b
          next if b.fainted?
          next if b.index!=target.index
          b_egg_group = b.pokemon.species_data.egg_groups
          next if (target_egg_group & b_egg_group).length == 0
          b.pbReduceHP(target.damageState.hpLost,false)
          if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
            battle.pbDisplay(_INTL("{1} is hurt!",b.pbThis))
          else
            battle.pbDisplay(_INTL("{1} is hurt by {2}'s {3}!",b.pbThis,
               target.pbThis(true),target.abilityName))
          end
        end
        battle.pbHideAbilitySplash(target)
      }
    )

    This will only hit foes
    Code:
    BattleHandlers::TargetAbilityOnHit.add(:VOODOO,
      proc { |ability,user,target,move,battle|
        next if !target.fainted?
        battle.pbShowAbilitySplash(target)
        target_egg_group = target.pokemon.species_data.egg_groups
        target.eachOpposing do |b|
          b_egg_group = b.pokemon.species_data.egg_groups
          next if (target_egg_group & b_egg_group).length == 0
          b.pbReduceHP(target.damageState.hpLost,false)
          if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
            battle.pbDisplay(_INTL("{1} is hurt!",b.pbThis))
          else
            battle.pbDisplay(_INTL("{1} is hurt by {2}'s {3}!",b.pbThis,
               target.pbThis(true),target.abilityName))
          end
        end
        battle.pbHideAbilitySplash(target)
      }
    )
     
    Back
    Top