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

5
Posts
6
Years
  • Age 28
  • Seen Oct 25, 2017
Hello everyone,
so I made this ability called "King of Rats" which belongs to a single Pokémon. This ability is meant to give this Pokémon a x2 power boost on Electric-type attacks when another electric regional rodent is in the field (Pichu, Pikachu, Raichu, Plusle, Minun, Pachirisu, Emolga, Dedenne and Togedemaru) <meaning the Pokémon can either be on its side of the battle or in the opposite team> and also receives x0.5 damage when this condition is applied.
I think something like Plus and Minus should work, but instead of getting its effect from another ability it should get it from those specific mons.
Where should I start? Any hint you can give me? I'm very new to this and coding is not one of my strengths.
Thank you in advance.
 

Ego13

hollow_ego
311
Posts
6
Years
In the script section
PokeBattle_Move
search for
##### Calculate attacker's attack stat #####
there you can add a rule for your ability for the attack boost.
It could look like

if attacker.hasWorkingAbility(:KINGOFRATS) && isConst?(type,PBTypes,:ELECTRIC)
if for i in 0...4
!attacker && (isConst?(i.species,PBSpecies,:PICHU) || isConst?(i.species,PBSpecies,:PIKACHU)|| isConst?(i.species,PBSpecies,:RAICHU)|| isConst?(i.species,PBSpecies,:PLUSLE)|| isConst?(i.species,PBSpecies,:MINUN)|| isConst?(i.species,PBSpecies,:PACHIRISU) || isConst?(i.species,PBSpecies,:EMOLGA)|| isConst?(i.species,PBSpecies,:DEDENNE)|| isConst?(i.species,PBSpecies,:TOGEDEMARU))
#make sure to either have all the conditions in one line or have the previous line end with ||
atkmult=(atkmult*2).round
end
end

For the damage reduction you search for
##### Calculate opponent's defense stat #####
and pretty much enter the same conditions with 2 differences.
1.
if opponent.hasWorkingAbility(:KINGOFRATS)
instead of
attacker.hasWorkingAbility(:KINGOFRATS)

2.
defmult=(defmult*1.5).round
instead of
atkmult=(atkmult*2).round

I haven't tested it myself so I'm not sure if it will work out exactly like that, but it should give you an idea of how it could work. Let me know if you could make it work. If you want the AI to make use of the ability as well, don't forget to add it in the AI section.
 
5
Posts
6
Years
  • Age 28
  • Seen Oct 25, 2017
Sorry for the late answer.
Thank you, I think it's working. I'll give you credits in the game as soon as it's finished.
 
Back
Top