• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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.

[Question] Im having trouble with a new ability

  • 2
    Posts
    5
    Years
    • Seen Jan 16, 2024
    I am very new to scripting for pokemon essentials so i need help
    Basically Im trying to make an ability, called carnivore so that it allows biting moves to act like giga drain but im getting weird results like in this clip
    Is there anyway to get it to work so that biting moves act exactly like giga drain under this ability?

    This is the script im using:
    Battle::AbilityEffects::DamageCalcFromUser.add(:CARNIVORE,
    proc { |ability, user, target, move, mults, baseDmg, type|
    if move.bitingMove?

    original_target_hp = target.hp


    damage_dealt = target.pbReduceHP(baseDmg, false)


    target.pbFaint if target.hp <= 0


    hp_restored = original_target_hp - target.hp


    user.pbRecoverHP(hp_restored) if hp_restored > 0
    end
    }
    )
     
    I believe your issue stems from the fact that your essentially dealing damage and healing in the code where you're supposed to be affecting how much damage your attack is doing. So right off the bat, I would change DamageCalcFromUser to OnDealingHit. Next, you need to calculate how much damage is dealt, not deal damage within the code itself. Shell Bell code helps here. Finally, you need to restore half the damage dealt. Try out this code.

    Battle::AbilityEffects::OnDealingHit.add(:CARNIVORE,
    proc { |ability, user, target, move, battle|
    next if !move.bitingMove?
    next if !user.canHeal?
    totalDamage = target.damageState.totalHPLost
    battle.pbShowAbilitySplash(user)
    amt = (totalDamage / 2).floor
    user.pbRecoverHPFromDrain(amt,target)
    battle.pbHideAbilitySplash(user)
    }
    )
     
    Last edited:
    Back
    Top