Advertiser Content

fauno

Non-binary
Brazil
Seen 22 Hours Ago
Posted 2 Days Ago
21 posts
1.7 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:

You can create something specific and unique by following this reasoning:
next if i.hp<=0
      # Poison Heal ability reaction
        if i.isAirborne?
          next
        end
        if i.hasWorkingAbility(:POISONHEAL) && i.hp<i.totalhp
          pbCommonAnimation("Poison",i,nil)
          i.pbRecoverHP((i.totalhp/8).floor,true)
          pbDisplay(_INTL("Monoxide particles regen {1}!",i.pbThis))
          next
        end
        if !i.pbHasType?(:POISON) &&
          !i.pbHasType?(:STEEL) &&
          !i.isAirborne? &&
          !i.pbHasType?(:BUG) &&
          !i.hasWorkingAbility(:LEVITATE) &&
          !i.hasWorkingAbility(:MAGICGUARD) &&
          !i.hasWorkingAbility(:OVERCOAT)
          pbCommonAnimation("Poison",i,nil)
          i.pbReduceHP((i.totalhp/8).floor)
          pbDisplay(_INTL("Monoxide particles hurt {1}!",i.pbThis))
          if i.isFainted?
           return if !i.pbFaint
         end
      end
In this situation, every Pokémon that is in contact with the ground and is not Flying, Steel or Poison, will suffer damage due to the poisonous particles of the ground. You can have a base from this, but using the "i.pbRecoverHP" command.

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

clawort

Male
Australia
Seen 3 Days Ago
Posted 3 Days Ago
82 posts
110 Days
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:

You can create something specific and unique by following this reasoning:
next if i.hp<=0
      # Poison Heal ability reaction
        if i.isAirborne?
          next
        end
        if i.hasWorkingAbility(:POISONHEAL) && i.hp<i.totalhp
          pbCommonAnimation("Poison",i,nil)
          i.pbRecoverHP((i.totalhp/8).floor,true)
          pbDisplay(_INTL("Monoxide particles regen {1}!",i.pbThis))
          next
        end
        if !i.pbHasType?(:POISON) &&
          !i.pbHasType?(:STEEL) &&
          !i.isAirborne? &&
          !i.pbHasType?(:BUG) &&
          !i.hasWorkingAbility(:LEVITATE) &&
          !i.hasWorkingAbility(:MAGICGUARD) &&
          !i.hasWorkingAbility(:OVERCOAT)
          pbCommonAnimation("Poison",i,nil)
          i.pbReduceHP((i.totalhp/8).floor)
          pbDisplay(_INTL("Monoxide particles hurt {1}!",i.pbThis))
          if i.isFainted?
           return if !i.pbFaint
         end
      end
In this situation, every Pokémon that is in contact with the ground and is not Flying, Steel or Poison, will suffer damage due to the poisonous particles of the ground. You can have a base from this, but using the "i.pbRecoverHP" command.

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).

Vendily

Female
Seen 10 Hours Ago
Posted 14 Hours Ago
888 posts
3.9 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

        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.)
        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.)

fauno

Non-binary
Brazil
Seen 22 Hours Ago
Posted 2 Days Ago
21 posts
1.7 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.

clawort

Male
Australia
Seen 3 Days Ago
Posted 3 Days Ago
82 posts
110 Days
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!

clawort

Male
Australia
Seen 3 Days Ago
Posted 3 Days Ago
82 posts
110 Days
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

        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.)
        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!

clawort

Male
Australia
Seen 3 Days Ago
Posted 3 Days Ago
82 posts
110 Days
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

        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.)
        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
Advertiser Content