• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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.

Gen VII Scripts (Z-Moves, Abilities and Moves,)

971
Posts
7
Years
  • Age 21
  • Seen Nov 28, 2022
How would I make a move like Revelation Dance that checks for the user's first type and change the move's type to match it? This is what I made out of it, but it doesn't work.

Code:
class PokeBattle_Move_CF25 < PokeBattle_Move
  def pbModifyType(type,attacker,opponent)
    type=getConst(attacker.type1)
    return type
  end
end
 

rigbycwts

Hmm, hmm.
98
Posts
11
Years
  • Seen Feb 22, 2019
Tried coding the ability Dancer. First, this goes in PokeBattle_Move, below the isBombMove function block:
Code:
  def isDanceMove?
    return isConst?(@id,PBMoves,:QUIVERDANCE) ||
           isConst?(@id,PBMoves,:DRAGONDANCE) ||
           isConst?(@id,PBMoves,:FIERYDANCE) ||
           isConst?(@id,PBMoves,:FEATHERDANCE) ||
           isConst?(@id,PBMoves,:PETALDANCE) ||
           isConst?(@id,PBMoves,:SWORDSDANCE) ||
           isConst?(@id,PBMoves,:TEETERDANCE) ||
           isConst?(@id,PBMoves,:LUNARDANCE) ||
           isConst?(@id,PBMoves,:RAINDANCE) ||
           isConst?(@id,PBMoves,:REVELATIONDANCE)
  end
Then this goes in PokeBattle_Battler above Intimidate:
Code:
    # Dancer. Kinda buggy.
    if self.hasWorkingAbility(:DANCER)
      user=self
      targetIndex=0
      hasMoved=false
      for i in 0...4       
        targetLastMoveUsed = PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(@battle.battlers[i].lastMoveUsed))
        if targetLastMoveUsed.isDanceMove?
          target = @battle.battlers[i]
          targetIndex=i
          moveToCopy = targetLastMoveUsed
          moveIDToCopy = @battle.battlers[i].lastMoveUsed
        end
      end
      if moveToCopy && moveToCopy.isDanceMove?
        PBDebug.log("[Ability triggered] #{pbThis}'s Dancer")
        @battle.pbDisplay(_INTL("Dancer copied {1}!",moveToCopy))
        user.pbUseMoveSimple(moveIDToCopy,-1,pbOppositeOpposing)
      end
    end
I don't know what causes the user, Oricorio in this case, to repeat this ability over and over. If any other Pokemon use a move like Swords Dance for example, then this Ability activates, it goes to an infinite loop. The infinite loop also happens when Oricorio is under the effects of Taunt and any other Pokemon uses a status move that is a dance move, such as Dragon Dance.
 
824
Posts
8
Years
Mutant Yoshi and I got Dancer to work. Lemme look at the code we used:

Code:
    if thismove.isDanceMove? && !specialusage
      for battler in @battle.battlers
        if battler.hasWorkingAbility(:DANCER) && battler.index != user.index
          @battle.pbDisplayEffect(battler)
          movedalready=battler.lastRoundMoved*1
          battler.pbUseMoveSimple(thismove.id,-1,user.index)
          battler.lastRoundMoved=movedalready*1
        end
      end
    end

This goes in PokeBattle_Battler, above line 3770 which is in the middle of the game recording which move was just moved.
 
971
Posts
7
Years
  • Age 21
  • Seen Nov 28, 2022
Mutant Yoshi and I got Dancer to work. Lemme look at the code we used:

Code:
    if thismove.isDanceMove? && !specialusage
      for battler in @battle.battlers
        if battler.hasWorkingAbility(:DANCER) && battler.index != user.index
          @battle.pbDisplayEffect(battler)
          movedalready=battler.lastRoundMoved*1
          battler.pbUseMoveSimple(thismove.id,-1,user.index)
          battler.lastRoundMoved=movedalready*1
        end
      end
    end

This goes in PokeBattle_Battler, above line 3770 which is in the middle of the game recording which move was just moved.

PokeBattle_Battler naturally only has 3355 lines, could you specify a line it's below or above? I tried a few things but they didn't work.
 

rigbycwts

Hmm, hmm.
98
Posts
11
Years
  • Seen Feb 22, 2019
PokeBattle_Battler naturally only has 3355 lines, could you specify a line it's below or above? I tried a few things but they didn't work.
If you are using Essentials 16.2, try checking the function def pbProcessTurn(choice). Possibly it's this function.
 
293
Posts
8
Years
  • Age 25
  • Seen Oct 1, 2020
I'm trying to code Core Enforcer but it does nothing when it goes lost even if I gave it 85 base power.

Code:
################################################################################
# If used after the target Attacks, the target's ability is removed. (Core Enforcer)
################################################################################

class PokeBattle_Move_15A < PokeBattle_Move
  def pbBaseDamage(basedmg,attacker,opponent)
    if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
       opponent.hasMovedThisRound? # Used a move already
      return pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    opponent.effects[PBEffects::GastroAcid]=true
    end
    return basedmg
  end
end
 
971
Posts
7
Years
  • Age 21
  • Seen Nov 28, 2022
I'm trying to code Core Enforcer but it does nothing when it goes lost even if I gave it 85 base power.

Code:
################################################################################
# If used after the target Attacks, the target's ability is removed. (Core Enforcer)
################################################################################

class PokeBattle_Move_15A < PokeBattle_Move
  def pbBaseDamage(basedmg,attacker,opponent)
    if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
       opponent.hasMovedThisRound? # Used a move already
      return pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    opponent.effects[PBEffects::GastroAcid]=true
    end
    return basedmg
  end
end

I'm not sure if I had this fully functional yet, but this is what I once made:
Code:
################################################################################
# Deals damage. If target has already moved, its ability will be supressed.
# (Core Enforcer)
################################################################################
class PokeBattle_Move_CF21 < PokeBattle_Move
  def pbEffectAfterHit(attacker,opponent,turneffects)
    if opponent.hasMovedThisRound?
      if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
        @battle.pbDisplay(_INTL("But it failed!"))  
        return -1
      end
      if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
         isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
         isConst?(opponent.ability,PBAbilities,:SCHOOLING) ||
         isConst?(opponent.ability,PBAbilities,:COMATOSE) ||
         isConst?(opponent.ability,PBAbilities,:SHIELDSDOWN) ||
         isConst?(opponent.ability,PBAbilities,:DISGUISE) ||
         isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
         isConst?(opponent.ability,PBAbilities,:BATTLEBOND) ||
         isConst?(opponent.ability,PBAbilities,:POWERCONSTRUCT)
        return -1
      end
      pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
      oldabil=opponent.ability
      opponent.effects[PBEffects::GastroAcid]=true
      opponent.effects[PBEffects::Truant]=false
      @battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",opponent.pbThis)) 
      if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
        PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")    
        opponent.effects[PBEffects::Illusion]=nil
        @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
        @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
      end
      return 0
    end
  end
end
 
824
Posts
8
Years
I'm not sure if I had this fully functional yet, but this is what I once made:
Code:
################################################################################
# Deals damage. If target has already moved, its ability will be supressed.
# (Core Enforcer)
################################################################################
class PokeBattle_Move_CF21 < PokeBattle_Move
  def pbEffectAfterHit(attacker,opponent,turneffects)
    if opponent.hasMovedThisRound?
      if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
        return -1
      end
      if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
         isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
         isConst?(opponent.ability,PBAbilities,:SCHOOLING) ||
         isConst?(opponent.ability,PBAbilities,:COMATOSE) ||
         isConst?(opponent.ability,PBAbilities,:SHIELDSDOWN) ||
         isConst?(opponent.ability,PBAbilities,:DISGUISE) ||
         isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
         isConst?(opponent.ability,PBAbilities,:BATTLEBOND) ||
         isConst?(opponent.ability,PBAbilities,:POWERCONSTRUCT)
        return -1
      end
      pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
      oldabil=opponent.ability
      opponent.effects[PBEffects::GastroAcid]=true
      opponent.effects[PBEffects::Truant]=false
      @battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",opponent.pbThis)) 
      if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
        PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")    
        opponent.effects[PBEffects::Illusion]=nil
        @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
        @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
      end
      return 0
    end
  end
end

Fixed your code. It doesn't say "but it failed!" since the move does do damage.

Also, here's a version of the move written for v15 where the "effects after hit" function doesn't exist.

Code:
################################################################################
# If the target has already moved this round, supresses target's ability
################################################################################
class PokeBattle_Move_1B8 < PokeBattle_Move
  def pbAdditionalEffect(attacker,opponent)
    if !(opponent.hasMovedThisRound? && opponent.lastMoveUsed<=0)
      return false
    end
    if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
       isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
       isConst?(opponent.ability,PBAbilities,:DELTASTREAM) ||
       isConst?(opponent.ability,PBAbilities,:PRIMORDIALSEA) ||
       isConst?(opponent.ability,PBAbilities,:DESOLATELAND) ||
       isConst?(opponent.ability,PBAbilities,:SCHOOLING) ||
       isConst?(opponent.ability,PBAbilities,:COMATOSE) ||
       isConst?(opponent.ability,PBAbilities,:SHIELDSDOWN) ||
       isConst?(opponent.ability,PBAbilities,:DISGUISE) ||
       isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
       isConst?(opponent.ability,PBAbilities,:BATTLEBOND) ||
       isConst?(opponent.ability,PBAbilities,:POWERCONSTRUCT)
      return false
    end
    opponent.effects[PBEffects::GastroAcid]=true
    opponent.effects[PBEffects::Truant]=false
    @battle.pbDisplay(_INTL("{1}'s ability was suppressed!",opponent.pbThis)) 
    if opponent.effects[PBEffects::Illusion]!=nil #ILLUSION
      # Animation should go here
      # Break the illusion
      opponent.effects[PBEffects::Illusion]=nil
      @battle.pbDisplayEffect(opponent)
      @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
      @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,
          PBAbilities.getName(opponent.ability)))
    end #ILLUSION
    return true
  end
end
 
971
Posts
7
Years
  • Age 21
  • Seen Nov 28, 2022
Fixed your code. It doesn't say "but it failed!" since the move does do damage.

Also, here's a version of the move written for v15 where the "effects after hit" function doesn't exist.

Code:
################################################################################
# If the target has already moved this round, supresses target's ability
################################################################################
class PokeBattle_Move_1B8 < PokeBattle_Move
  def pbAdditionalEffect(attacker,opponent)
    if !(opponent.hasMovedThisRound? && opponent.lastMoveUsed<=0)
      return false
    end
    if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
       isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
       isConst?(opponent.ability,PBAbilities,:DELTASTREAM) ||
       isConst?(opponent.ability,PBAbilities,:PRIMORDIALSEA) ||
       isConst?(opponent.ability,PBAbilities,:DESOLATELAND) ||
       isConst?(opponent.ability,PBAbilities,:SCHOOLING) ||
       isConst?(opponent.ability,PBAbilities,:COMATOSE) ||
       isConst?(opponent.ability,PBAbilities,:SHIELDSDOWN) ||
       isConst?(opponent.ability,PBAbilities,:DISGUISE) ||
       isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
       isConst?(opponent.ability,PBAbilities,:BATTLEBOND) ||
       isConst?(opponent.ability,PBAbilities,:POWERCONSTRUCT)
      return false
    end
    opponent.effects[PBEffects::GastroAcid]=true
    opponent.effects[PBEffects::Truant]=false
    @battle.pbDisplay(_INTL("{1}'s ability was suppressed!",opponent.pbThis)) 
    if opponent.effects[PBEffects::Illusion]!=nil #ILLUSION
      # Animation should go here
      # Break the illusion
      opponent.effects[PBEffects::Illusion]=nil
      @battle.pbDisplayEffect(opponent)
      @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
      @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,
          PBAbilities.getName(opponent.ability)))
    end #ILLUSION
    return true
  end
end

Glad you could work what wasn't working, I didn't know if it was already or not.

By the way, I see you added Desolate Land and stuff, but this is a quote from Bulbapedia:
The target's Ability will not be suppressed if it is Multitype, Stance Change, Schooling, Comatose, Shields Down, Disguise, RKS System, Battle Bond, or Power Construct.
I always use Bulbapedia for my information, but maybe it's not true. Who knows.
 
824
Posts
8
Years
Glad you could work what wasn't working, I didn't know if it was already or not.

By the way, I see you added Desolate Land and stuff, but this is a quote from Bulbapedia:

I always use Bulbapedia for my information, but maybe it's not true. Who knows.

I think I copied the abilities list from another move that has a lot of abilities that are immune to it - probably Gastro Acid.

So if Bulbapedia says that the Primal abilities aren't immune to Zygarde, go ahead.
 
2
Posts
13
Years
  • Seen Dec 27, 2018
Here are some move abilities that I have added to the Pokebattle_MoveEffects. If someone wants to test and verify these I would appreciate it! It seems they are working fine for me but I have been hacking away at some codes left and right so Idk if it will work for a standard version. :p

Spoiler:


Spoiler:


I saw that someone already posted this one, but here is a corrected one that you can just "copy and paste" without changing.

Spoiler:



All of the other effects have been a huge help, and I will post anymore that I figure out on here for everyone to see/use! Great forum!
 

Carboncino

SwampyK
16
Posts
6
Years
Tried coding the ability Dancer. First, this goes in PokeBattle_Move, below the isBombMove function block:
Code:
  def isDanceMove?
    return isConst?(@id,PBMoves,:QUIVERDANCE) ||
           isConst?(@id,PBMoves,:DRAGONDANCE) ||
           isConst?(@id,PBMoves,:FIERYDANCE) ||
           isConst?(@id,PBMoves,:FEATHERDANCE) ||
           isConst?(@id,PBMoves,:PETALDANCE) ||
           isConst?(@id,PBMoves,:SWORDSDANCE) ||
           isConst?(@id,PBMoves,:TEETERDANCE) ||
           isConst?(@id,PBMoves,:LUNARDANCE) ||
           isConst?(@id,PBMoves,:RAINDANCE) ||
           isConst?(@id,PBMoves,:REVELATIONDANCE)
  end
Then this goes in PokeBattle_Battler above Intimidate:
Code:
    # Dancer. Kinda buggy.
    if self.hasWorkingAbility(:DANCER)
      user=self
      targetIndex=0
      hasMoved=false
      for i in 0...4       
        targetLastMoveUsed = PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(@battle.battlers[i].lastMoveUsed))
        if targetLastMoveUsed.isDanceMove?
          target = @battle.battlers[i]
          targetIndex=i
          moveToCopy = targetLastMoveUsed
          moveIDToCopy = @battle.battlers[i].lastMoveUsed
        end
      end
      if moveToCopy && moveToCopy.isDanceMove?
        PBDebug.log("[Ability triggered] #{pbThis}'s Dancer")
        @battle.pbDisplay(_INTL("Dancer copied {1}!",moveToCopy))
        user.pbUseMoveSimple(moveIDToCopy,-1,pbOppositeOpposing)
      end
    end
I don't know what causes the user, Oricorio in this case, to repeat this ability over and over. If any other Pokemon use a move like Swords Dance for example, then this Ability activates, it goes to an infinite loop. The infinite loop also happens when Oricorio is under the effects of Taunt and any other Pokemon uses a status move that is a dance move, such as Dragon Dance.

Have you fixed? Because I really need this script...
 
13
Posts
6
Years
  • Age 25
  • Seen Dec 25, 2019
I only have one question , Are these moves and abilities working in v16.2 too?
 
7
Posts
6
Years
Is this project still alive?
I ask it because it's been a year and until now there are some scripts of moves and abilities that weren't made like: Stakeout, Disguise, Sunsteel Strike, Moongeist Beam, Prism Armor, Throat Chop and Comatose.
Just as there are some scripts that don't work or give many syntax errors like: Receiver, Instruct, Soul Heart, Stomping Tantrum, Spotlight, Toxic Thread, Dancer and Laser Focus.
 

Ego13

hollow_ego
311
Posts
6
Years
Is this project still alive?
I ask it because it's been a year and until now there are some scripts of moves and abilities that weren't made like: Stakeout, Disguise, Sunsteel Strike, Moongeist Beam, Prism Armor, Throat Chop and Comatose.
Just as there are some scripts that don't work or give many syntax errors like: Receiver, Instruct, Soul Heart, Stomping Tantrum, Spotlight, Toxic Thread, Dancer and Laser Focus.

Good question. I'm wondering the same.
Recently i coded Comatose and Dancer (not quite finished yet)
 

Adrenst

Adrenst
3
Posts
6
Years
  • Age 30
  • Seen Feb 8, 2018
Disclaimer:: this is on v17.2
But throat chop seems pretty straight forward, like a combination of imprison and healblock is how I did it (avoided looking into disable because it was referenced too many times lol)

First thing you need to do is add an effect to PBEffects
Code:
ThroatChop         = 109 # use whatever is the next lowest value for you

And obviously add a def to Move_effects:
Code:
class PokeBattle_Move_CF15 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    ret=super(attacker,opponent,hitnum,alltargets,showanimation)
    if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
        !opponent.isFainted?
      opponent.effects[PBEffects::ThroatChop]=2
      @battle.pbDisplay(_INTL("{1} can't use sound based moves!",opponent.pbThis))
    end
    return ret
  end
end

Then you just have a few things left to

first find pbTryUseMove in PokeBattle_battler and add this (I added mine below the imprison code)
Code:
if @effects[PBEffects::ThroatChop]>0 && !pbOpposing1.fainted?
      if thismove.isSoundBased?
        @battle.pbDisplay(_INTL("{1} can't use {2} because they were Throat Chopped!",pbThis,thismove.name))
        PBDebug.log("[Move failed] #{pbThis} can't use #{thismove.name} because they were Throat chopped!")
        return false
      end
    end

The previous block prevents an already selected move from being used. This next block will prevent them from choosing it: put in PokeBattle_Battle in pbCanChooseMove (again I put it below imprison)

Code:
if thispkmn.effects[PBEffects::ThroatChop]>0 && thismove.isSoundBased?
      if showMessages
        pbDisplayPaused(_INTL("{1} can't use {2} because they are throat chopped!",thispkmn.pbThis,thismove.name))
      end
      return false
    end

And lastly decrement the value if it's more than 0 in PokeBattle_Battle in pbEndofRoundPhase (this time I put it below Heal bell because it works similar)
Code:
# Throat Chop
    for i in priority
      next if i.fainted?
      if i.effects[PBEffects::ThroatChop]>0
        i.effects[PBEffects::ThroatChop]-=1
        if i.effects[PBEffects::ThroatChop]==0
          pbDisplay(_INTL("{1}'s can use sound based moves again!",i.pbThis))
          PBDebug.log("[End of effect] #{i.pbThis} is no longer Throat chopped")
        end
      end
    end

I just tested on an Exploud that knows only sound moves and it prevented an already selected move and also prevented move selection causing it to struggle. If anyone happens to know the real lines pokemon displays when throat chop effects happen please let me know!

Good question. I'm wondering the same.
Recently i coded Comatose and Dancer (not quite finished yet)

If you could post either/both of those I'd appreciate it. I only started looking into pokemon essentials a few days ago and dancer especially is eluding me.
 
Last edited:

Adrenst

Adrenst
3
Posts
6
Years
  • Age 30
  • Seen Feb 8, 2018
Is this project still alive?
I ask it because it's been a year and until now there are some scripts of moves and abilities that weren't made like: Stakeout, Disguise, Sunsteel Strike, Moongeist Beam, Prism Armor, Throat Chop and Comatose.
Just as there are some scripts that don't work or give many syntax errors like: Receiver, Instruct, Soul Heart, Stomping Tantrum, Spotlight, Toxic Thread, Dancer and Laser Focus.

For sunsteelstrike can't you just define a basic move function to handle the attack, then you find all references to MOLDBREAKER and turn them from 'attacker.hasMoldBreaker' to '(attacker.hasMoldBreaker || @function==0xfoobar)' where 'foobar' if your function code. Make sure if the moldbreaker check has a ! in front, you do '(!attacker.hasMoldBreaker && @function !=0xfoobar)' . Haven't tested but mold breaker is the same effect so I am confident.

For instruct when I used the code earlier in this thread it worked but made the attack target myself. To remedy this I added this to Battler

Code:
  attr_accessor :lastTarget

Then I updated it in the same places as lastAttacker:

in initialize in Battler
Code:
@lastTarget       = 0

in pbOnDamageLost in PokeBattle_Move:
Code:
attacker.lastTarget = opponent.index # instruct

and in PokeBattle_Battler find @battlers.lastAttacker.clear and underneath that add:
Code:
@battlers[i].lastTarget=0

then you can change this just alter the line like this in the instruct move def to use the last target instead of yourself.
Code:
opponent.pbUseMoveSimple(opponent.lastMoveUsed,-1,opponent.lastTarget)

I tested (in doubles obv) surf, it successfully hit all targets again, muddy water which successfully hit both enemies a second time, and when I 1-shot the enemy my instruct redirected to the other poke. I think that's every necessary test case?

And spotlight is simple. Find follow me and copy it, but places where it uses attacker replace with opponent basically. Make sure to change you copy to have a new function code :)
 
Last edited:
Back
Top