• 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] More Ability Help

163
Posts
5
Years
Hi! I'm stuck with another ability.

It's called Echo Shield and it bounces back damage from Sound-based moves (except for Growl because it doesn't do any damage). I was thinking of copying the code for Rough Skin but I decided that it may be too difficult.

Can someone help me please?
 
37
Posts
6
Years
You can start by checking the "i.pbRecoverHP ((i.totalhp / 16) .floor, true)" example commands in PokeBattle_Battle and create specific conditions for this ability.
 

WolfPP

Spriter/ Pixel Artist
1,309
Posts
5
Years
Using CTRL SHIFT F to open searching tool and read how that code works.
 
37
Posts
6
Years
Ok, I'll show you one of my methods to created a special situation in my project, but don't use exactly, it is only for you to have a basis of how to create.
Spoiler:

I hope I have helped, because my knowledge is also limited.
 
Last edited:
163
Posts
5
Years
Ok, I'll show you one of my methods to created a special situation in my project, but don't use exactly, it is only for you to have a basis of how to create.
Spoiler:

I hope I have helped, because my knowledge is also limited.

Okay but I want it so that the damage from the Sound-based move is bounced back at the attacker. It's like Counter, and so the Sound-based move's damage will be the same damage (or double) that is bounced back (if the attacker hits a Pokemon with Echo Shield with a Sound-based move eg Hyper Voice, the attacker will get hurt as well by the damage reflected back).
 
1,680
Posts
8
Years
  • Age 24
  • Seen yesterday
Alright, let's do this!
So starting from the top, you want an ability that's like Rough Skin, but for sound moves instead of contact moves.

So, to start, let's take a look at the Rough Skin code

Code:
        if (target.hasWorkingAbility(:ROUGHSKIN,true) ||
           target.hasWorkingAbility(:IRONBARBS,true)) && !user.fainted?
          if !user.hasWorkingAbility(:MAGICGUARD)
            PBDebug.log("[Ability triggered] #{target.pbThis}'s #{PBAbilities.getName(target.ability)}")
            @battle.scene.pbDamageAnimation(user,0)
            user.pbReduceHP((user.totalhp/8).floor)
            @battle.pbDisplay(_INTL("{1}'s {2} hurt {3}!",target.pbThis,
               PBAbilities.getName(target.ability),user.pbThis(true)))
          end
        end

Now we want to reflect the damage already taken. (You didn't say anything about it but I also made Soundproof pokemon immune to this effect because it's an echo.)
Code:
        if target.hasWorkingAbility(:ECHOSHIELD,true) && !user.fainted? && move.isSoundBased?
          if !user.hasWorkingAbility(:MAGICGUARD) && !user.hasWorkingAbility(:SOUNDPROOF)
            PBDebug.log("[Ability triggered] #{target.pbThis}'s #{PBAbilities.getName(target.ability)}")
            @battle.scene.pbDamageAnimation(user,0)
            user.pbReduceHP(damage)
            @battle.pbDisplay(_INTL("{1}'s {2} hurt {3}!",target.pbThis,
               PBAbilities.getName(target.ability),user.pbThis(true)))
          end
        end
But, we can't just put this code under Rough Skin, because the if block it's sitting in is for contact moves only. We can instead place it under ANGERPOINT because Anger Point is in the block that's just for moves that dealt damage, no contact necessary. (So below line 1477 should be good in a clean project.)
 
Last edited:
37
Posts
6
Years
Honestly to create custom skills I advise you to look at everything that is already done in essentials to learn how the codes work, so if you can not build a good structure you have total freedom to ask for help in the forums. Do not just rely on help, because not always someone will be able to solve a problem or situation that you want, I hope this does not happen. And as Vendily commented here, the code she created must work the way you asked.
 
163
Posts
5
Years
Honestly to create custom skills I advise you to look at everything that is already done in essentials to learn how the codes work, so if you can not build a good structure you have total freedom to ask for help in the forums. Do not just rely on help, because not always someone will be able to solve a problem or situation that you want, I hope this does not happen. And as Vendily commented here, the code she created must work the way you asked.

Okay!
 
163
Posts
5
Years
Alright, let's do this!
So starting from the top, you want an ability that's like Rough Skin, but for sound moves instead of contact moves.

So, to start, let's take a look at the Rough Skin code

Code:
        if (target.hasWorkingAbility(:ROUGHSKIN,true) ||
           target.hasWorkingAbility(:IRONBARBS,true)) && !user.fainted?
          if !user.hasWorkingAbility(:MAGICGUARD)
            PBDebug.log("[Ability triggered] #{target.pbThis}'s #{PBAbilities.getName(target.ability)}")
            @battle.scene.pbDamageAnimation(user,0)
            user.pbReduceHP((user.totalhp/8).floor)
            @battle.pbDisplay(_INTL("{1}'s {2} hurt {3}!",target.pbThis,
               PBAbilities.getName(target.ability),user.pbThis(true)))
          end
        end

Now we want to reflect the damage already taken. (You didn't say anything about it but I also made Soundproof pokemon immune to this effect because it's an echo.)
Code:
        if target.hasWorkingAbility(:ECHOSHIELD,true) && !user.fainted? && move.isSoundBased?
          if !user.hasWorkingAbility(:MAGICGUARD) && !user.hasWorkingAbility(:SOUNDPROOF)
            PBDebug.log("[Ability triggered] #{target.pbThis}'s #{PBAbilities.getName(target.ability)}")
            @battle.scene.pbDamageAnimation(user,0)
            user.pbReduceHP(damage)
            @battle.pbDisplay(_INTL("{1}'s {2} hurt {3}!",target.pbThis,
               PBAbilities.getName(target.ability),user.pbThis(true)))
          end
        end
But, we can't just put this code under Rough Skin, because the if block it's sitting in is for contact moves only. We can instead place it under ANGERPOINT because Anger Point is in the block that's just for moves that dealt damage, no contact necessary. (So below line 1477 should be good in a clean project.)

Thanks! I'll try that!
 
163
Posts
5
Years
Alright, let's do this!
So starting from the top, you want an ability that's like Rough Skin, but for sound moves instead of contact moves.

So, to start, let's take a look at the Rough Skin code

Code:
        if (target.hasWorkingAbility(:ROUGHSKIN,true) ||
           target.hasWorkingAbility(:IRONBARBS,true)) && !user.fainted?
          if !user.hasWorkingAbility(:MAGICGUARD)
            PBDebug.log("[Ability triggered] #{target.pbThis}'s #{PBAbilities.getName(target.ability)}")
            @battle.scene.pbDamageAnimation(user,0)
            user.pbReduceHP((user.totalhp/8).floor)
            @battle.pbDisplay(_INTL("{1}'s {2} hurt {3}!",target.pbThis,
               PBAbilities.getName(target.ability),user.pbThis(true)))
          end
        end

Now we want to reflect the damage already taken. (You didn't say anything about it but I also made Soundproof pokemon immune to this effect because it's an echo.)
Code:
        if target.hasWorkingAbility(:ECHOSHIELD,true) && !user.fainted? && move.isSoundBased?
          if !user.hasWorkingAbility(:MAGICGUARD) && !user.hasWorkingAbility(:SOUNDPROOF)
            PBDebug.log("[Ability triggered] #{target.pbThis}'s #{PBAbilities.getName(target.ability)}")
            @battle.scene.pbDamageAnimation(user,0)
            user.pbReduceHP(damage)
            @battle.pbDisplay(_INTL("{1}'s {2} hurt {3}!",target.pbThis,
               PBAbilities.getName(target.ability),user.pbThis(true)))
          end
        end
But, we can't just put this code under Rough Skin, because the if block it's sitting in is for contact moves only. We can instead place it under ANGERPOINT because Anger Point is in the block that's just for moves that dealt damage, no contact necessary. (So below line 1477 should be good in a clean project.)

It works! Thank you! :D
 
Back
Top