• 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] Add an Ability that makes the user keep 1HP when using Selfdestruct or Explosion + ability that doubles the power of Selfdestruct and Explosion

76
Posts
8
Years
  • Age 30
  • Seen Dec 9, 2022
Hi guys,

I am struggling to add 2 abilities:

-one ability that allows the user to keep 1HP after using Selfdestruct or Explosion
-another ability that doubles the power of Selfdestruct or Explosion

Every help is very much appreciated :)
 
38
Posts
9
Years
  • Age 31
  • Seen today
I don't know about the first ability, but the second one should be something like this:
Search for this
Code:
PokeBattle_Move_0E0
go to the one in PokeBattle_MoveEffects then after this block:
Code:
    if !attacker.hasMoldBreaker
      [email protected](:DAMP)
      if bearer!=nil
        @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
           bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
        return false
      end
    end
    return true
  end
Add this:
Code:
  def pbBaseDamage(basedmg,attacker,opponent)
    if attacker.hasWorkingAbility(:YOURABILITYNAME)
      return basedmg*2
    end
      return basedmg
  end
I haven't tested it but it should be something like that.
 
61
Posts
4
Years
  • Age 27
  • Ohio
  • Seen Apr 15, 2024
Hi there! Here are some ideas that hopefully help some. The first ability I have something conceptual, the second one I think I have the fix if you haven't fixed it yet.

An ability that keeps you alive from Explosion sounds neat. I think you would add it into "def pbReduceHPDamage(damage,attacker,opponent)" under PokeBattle_Move. There's already things like False Swipe and Sturdy there, which you'll probably end up copying bits from. You'll definitely be able to take the messages that display after using the moves from there, like for Substitute it says in-battle that your Substitute faded. To make your Pokemon survive the Explsion, I think you could just tell it to set HP to 1! You'll have to play around with it to see if that works.

As for doubling the power of Selfdestruct/Explosion through an ability, you'll want to go to the PokeBattle_MoveEffects script section. There are lots of moves there, each with different things being done to them. I'll use the script for Acrobatics to start you out, since it's fairly similar.

Code:
################################################################################
# Power is doubled if the user has no held item. (Acrobatics)
################################################################################
class PokeBattle_Move_086 < PokeBattle_Move
  def pbBaseDamageMultiplier(damagemult,attacker,opponent)
    if attacker.item==0
      return (damagemult*2.0).round
    end
    return damagemult
  end
end

It starts out with a Move Class, which is also known as a function code. You'll need to find the appropriate codes for Selfdestruct/Explosion here and replace the current one. Then it has the condition of the attacker holding an item, which returns a 2x damage multiplier if false.

You can do the same thing! Instead of asking if the attacker has an item, ask if it has that certain ability. I think you can use this in place of "if attacker.item==0":
Code:
if attacker.hasWorkingAbility(:KABOOM)
where you replace your ability name instead of KABOOM (unless that's what you named your ability!)

Haven't tested it, but I think it should work.
 
Last edited:
Back
Top