• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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,)

Improved Pursuit's code (improved 12/30):
Spoiler:



Wimp Out and Emergency Exit:
Spoiler:


Hyperspace Hole:
Spoiler:
 
Last edited:
I just realized that the Battle Bond script doesn't change Water Shuriken's base power. Anyway to implement this?
 
I just realized that the Battle Bond script doesn't change Water Shuriken's base power. Anyway to implement this?

Since you're using the function '0C0' for Water Shuriken, just replace the code inside 'MoveEffect' script:
Code:
################################################################################
# Hits 2-5 times.
################################################################################
class PokeBattle_Move_0C0 < PokeBattle_Move
  def pbIsMultiHit
    return true
  end

  def pbBaseDamage(basedmg,attacker,opponent)
        basedmg=20 if isConst?(@id,PBMoves,:WATERSHURIKEN) && 
                      attacker.hasWorkingAbility(:BATTLEBOND) && 
                      isConst?(attacker.species,PBSpecies,:GRENINJA) &&
                      attacker.form==1
      return basedmg
  end
  
  def pbNumHits(attacker)
    hitchances=[2,2,3,3,4,5]
    ret=hitchances[@battle.pbRandom(hitchances.length)]
    ret=5 if attacker.hasWorkingAbility(:SKILLLINK)
    ret=3 if isConst?(@id,PBMoves,:WATERSHURIKEN) && 
             attacker.hasWorkingAbility(:BATTLEBOND) && 
             isConst?(attacker.species,PBSpecies,:GRENINJA) &&
             attacker.form==1
    return ret
  end
end
 
Last edited:
Fluffy:
Inside 'PokeBattle_Move' script, above Metronome's code (inside 'if !attacker.hasMoldBreaker'), paste:
Code:
      if opponent.hasWorkingAbility(:FLUFFY) && !attacker.hasWorkingAbility(:LONGREACH)
        if isContactMove? && !isConst?(type,PBTypes,:FIRE)
          finaldamagemult=(finaldamagemult*0.5).round
        elsif isConst?(type,PBTypes,:FIRE) && !isContactMove?
          finaldamagemult=(finaldamagemult*2.0).round
        end
      end
    end
    if attacker.hasWorkingItem(:METRONOME)
 
Last edited:
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!



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.

For some reason, anytime I try to put in the 3rd through 5th parts of the script, it will give me these following errors:

---------------------------
Pokemon Mythos
---------------------------
[Pokémon Essentials version 17.2]

Exception: NoMethodError

Message: undefined method `>' for nil:NilClass

PokeBattle_Battle:875:in `pbCanChooseMove?'

PokeBattle_Battle:800:in `pbCanShowFightMenu?'

PokeBattle_Battle:2601:in `pbCommandPhase'

PokeBattle_Battle:2598:in `loop'

PokeBattle_Battle:2688:in `pbCommandPhase'

PokeBattle_Battle:2587:in `each'

PokeBattle_Battle:2587:in `pbCommandPhase'

PokeBattle_Battle:2534:in `pbStartBattleCore'

PokeBattle_Battle:2533:in `logonerr'

PokeBattle_Battle:2533:in `pbStartBattleCore'



This exception was logged in

C:\Users\GAMER\Saved Games\Pokemon Mythos\errorlog.txt.

Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------

---------------------------
Pokemon Mythos
---------------------------
[Pokémon Essentials version 17.2]

Exception: NoMethodError

Message: undefined method `>' for nil:NilClass

PokeBattle_Battle:3485:in `__clauses__pbEndOfRoundPhase'

PokeBattle_Battle:3483:in `each'

PokeBattle_Battle:3483:in `__clauses__pbEndOfRoundPhase'

PokeBattle_Clauses:42:in `pbEndOfRoundPhase'

PokeBattle_Battle:2542:in `pbStartBattleCore'

PokeBattle_Battle:2541:in `logonerr'

PokeBattle_Battle:2541:in `pbStartBattleCore'

PokeBattle_Battle:2523:in `loop'

PokeBattle_Battle:2546:in `pbStartBattleCore'

PokeBattle_Battle:2346:in `pbStartBattle'



This exception was logged in

C:\Users\GAMER\Saved Games\Pokemon Mythos\errorlog.txt.

Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------

This will occur if I ever press the fight button, wont even let me choose moves, just essentially skips them. I put in the script exactly how you described, yet no matter what ive tried so far I cant get it to work. Any idea what I can do to fix this? I hella appreciate the help
 
@weezyfish I think you also need to make sure to initialize effects[PBEffects::ThroatChop] to 0. The function to make that change in is called something to do with switching, IIRC it takes "batonpass" as a parameter, and most of the code is setting effects to 0 or false etc.
 
@mgriffin I dont mean to come off as frustrating to work with, but im so new to scripting stuff like this I really don't know how to do that. Could you give me an example of how to do that? Sorry for the trouble
 
@mgriffin this worked like a frick frackin charm! Thank you so much homie, I really appreciate it!
 
Plasma Fist

Replace Ion Deluge's code inside _MoveEffects script:
Code:
################################################################################
# All Normal-type moves become Electric-type for the rest of the round.
# (Ion Deluge/ Plasma Fist)
################################################################################
class PokeBattle_Move_146 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if pbIsDamaging?
      ret=super(attacker,opponent,hitnum,alltargets,showanimation)
      for poke in @battle.battlers
        next if poke.index==attacker.index
        if @battle.choices[poke.index][0]==1 && # Chose a move
           !poke.hasMovedThisRound? && [email protected][PBEffects::IonDeluge]
          @battle.field.effects[PBEffects::IonDeluge]=true
          @battle.pbDisplay(_INTL("A deluge of ions showers the battlefield!"))
          return ret
        end
      end
    end
    unmoved=false
    for poke in @battle.battlers
      next if poke.index==attacker.index
      if @battle.choices[poke.index][0]==1 && # Chose a move
          !poke.hasMovedThisRound?
        unmoved=true; break
      end
    end
    if !unmoved || @battle.field.effects[PBEffects::IonDeluge]
      @battle.pbDisplay(_INTL("But it failed!"))
      return -1
    end
    pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
    @battle.field.effects[PBEffects::IonDeluge]=true
    @battle.pbDisplay(_INTL("A deluge of ions showers the battlefield!"))
    return 0
  end
end
 
When I made burn up (using soak as a base), it seems to work perfectly for arcanine and typhlosion. However, for moltres, there is a problemas. Judging by the description of the move on serebii.net, it was supposed to remove only the fire type, which means moltres would become pure flying. But using my code it becomes "qmark" just like arcanine and typhlosion. Does your code solves that problem? Thanks for your hardwork.

I'm not an expert, but I think it is because the script itself changes type 2 too. Correct me if I'm wrong.
 
I have been looking to properly implement Gear Up into my game, but have been unable to find working scripts. The one provided here targets an ally only, while the move should target all allies, including the user. Bulbapedia's description of the move is: "Gear Up raises the Attack and Special Attack stats of allied Pokémon (including the user) with the Ability Plus or Minus by one stage each." Also, when tested in the actual game, the move works in single battles and targets both the user and partner in double battles. The code here has the same mistake that the other ones for the move I have found have. It only allows use of the move in double battles and doesn't apply to the user.
Pollen Puff
Code:
################################################################################
# If the target is an ally, heals the target for the amount of damage that would
#     have been dealt.  If target is an opponent, damages them normally.
################################################################################
class PokeBattle_Move_1B3 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if attacker.pbPartner != nil
      if attacker.pbPartner == opponent
        damage=pbCalcDamage(attacker,opponent,0,hitnum)
        opponent.pbRecoverHP(damage,true)
        return 0
      end
    end
    return super(attacker,opponent,hitnum,alltargets,showanimation)
  end
end

Floral Healing
Code:
################################################################################
# Heals target by 1/2 of its max HP.
# In Grassy Terrain, heals target by 3/4 of its max HP.
################################################################################
class PokeBattle_Move_1B4 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if opponent.effects[PBEffects::HealBlock]>0
      @battle.pbDisplay(_INTL("{1} can't use {2} because of Heal Block!",attacker.pbThis,name))
      return -1
    end
    if opponent.hp==opponent.totalhp
      @battle.pbDisplay(_INTL("{1}'s HP is full!",opponent.pbThis))
      return -1
    end
    pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    inc=0.5
    inc=0.75 if @battle.field.effects[PBEffects::GrassyTerrain]>0
    opponent.pbRecoverHP(((opponent.totalhp+1)*inc).floor,true)
    @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))
    return 0
  end
end

Strength Sap
Code:
################################################################################
# Heals the user for an amount equal to the target's effective Attack stat
# Lowers the target's Attack by 1 stage
################################################################################
class PokeBattle_Move_1B5 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if attacker.effects[PBEffects::HealBlock]>0
      bob="heal"
      bob=_INTL("use {1}",name) if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
      @battle.pbDisplay(_INTL("{1} can't {2} because of Heal Block!",attacker.pbThis,bob))
      return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
    elsif attacker.hp==attacker.totalhp
      @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
      return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
    else
      oatk=opponent.attack
      attacker.pbRecoverHP(oatk,true)
      @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
    end
    if opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
      opponent.pbReduceStat(PBStats::ATTACK,1,true,true,false,attacker)
    end
    return 0
  end
end

Gear Up
Code:
################################################################################
# Gear Up
################################################################################
class PokeBattle_Move_1B6 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if attacker.pbPartner
      if attacker.pbPartner.hasWorkingAbility(:PLUS) ||
         attacker.pbPartner.hasWorkingAbility(:MINUS)
        anim=true
        if attacker.pbPartner.pbCanIncreaseStatStage?(PBStats::ATTACK,true)
          attacker.pbPartner.pbIncreaseStat(PBStats::ATTACK,1,true,anim)
          anim=false
        end
        if attacker.pbPartner.pbCanIncreaseStatStage?(PBStats::SPATK,true)
          attacker.pbPartner.pbIncreaseStat(PBStats::SPATK,1,true,anim)
        end
      end
    end
    return 0
  end
end

Speed Swap
Code:
################################################################################
# User and target swap their Speed stats
################################################################################
class PokeBattle_Move_1B7 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    attacker.speed,opponent.speed=opponent.speed,attacker.speed
    @battle.pbDisplay(_INTL("{1} switched their Speed stats!",attacker.pbThis))
    return 0
  end
end

Shore Up
Code:
################################################################################
# Heals user by 1/2 of its max HP.
# In a sandstorm, heals user by 3/4 of its max HP.
################################################################################
class PokeBattle_Move_1A3 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if attacker.effects[PBEffects::HealBlock]>0
      @battle.pbDisplay(_INTL("{1} can't use {2} because of Heal Block!",attacker.pbThis,name))
      return -1
    end
    if attacker.hp==attacker.totalhp
      @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
      return -1
    end
    pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
    inc=0.5
    inc=0.75 if @battle.pbWeather==PBWeather::SANDSTORM
    attacker.pbRecoverHP(((attacker.totalhp+1)*inc).floor,true)
    @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
    return 0
  end
end

Spotlight
Code:
################################################################################
# This round, target becomes the target of attacks that have single targets.
################################################################################
class PokeBattle_Move_1A6 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if [email protected]
      @battle.pbDisplay(_INTL("But it failed!"))
      return -1
    end
    pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
    opponent.effects[PBEffects::FollowMe]=true
    if !opponent.pbPartner.isFainted?
      opponent.pbPartner.effects[PBEffects::FollowMe]=false
    end
    @battle.pbDisplay(_INTL("{1} shone a spotlight on {2}!",attacker.pbThis,opponent.pbThis))
    return 0
  end
end

Revelation Dance
Code:
################################################################################
# Move type changes based on user's primary type
################################################################################
class PokeBattle_Move_192 < PokeBattle_Move
  def pbType(type,attacker,opponent)
    return attacker.type1
  end
end
(originally had this one coded a lot more complicated, where it checks to be sure the attacker is Oricorio, then goes by the form's primary type. Turns out it goes by primary type regardless of species.)

Instruct
Code:
################################################################################
# Instructs the target to use the move it last used again.
################################################################################
class PokeBattle_Move_194 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if opponent.lastMoveUsed<=0 ||
       (PBMoveData.new(opponent.lastMoveUsed).flags&0x10)==0 # flag e: Copyable by Mirror Move
      @battle.pbDisplay(_INTL("The instruction failed!"))
      return -1
    end
    opponent.pbUseMoveSimple(opponent.lastMoveUsed,-1,opponent.index)
    return 0
  end
end
I have been trying to edit the code so that it would fix this, but have been unsuccessful so far. Firstly, the target of the move in the PBS files must be changed from targeting only an ally, and the script needs to be edited. Does anyone know how to fix this or have a correct implementation of the move?
 
Can anyone give me some tips on what's going on with my game?
Every move that works like Protect (Spiky Shield, King's Sheild, Baneful Bunker) Isn't working correctly. The opposing Pokemon will use the move, but won't be protected, and any move can go right through it. I've tried to find the problem but it seems I'm out of luck.
Anyone want to take a crack at it and figure out why this is happening? Any help would be appreciated greatly.
 
I have been looking to properly implement Gear Up into my game, but have been unable to find working scripts. The one provided here targets an ally only, while the move should target all allies, including the user. Bulbapedia's description of the move is: "Gear Up raises the Attack and Special Attack stats of allied Pokémon (including the user) with the Ability Plus or Minus by one stage each." Also, when tested in the actual game, the move works in single battles and targets both the user and partner in double battles. The code here has the same mistake that the other ones for the move I have found have. It only allows use of the move in double battles and doesn't apply to the user.

I have been trying to edit the code so that it would fix this, but have been unsuccessful so far. Firstly, the target of the move in the PBS files must be changed from targeting only an ally, and the script needs to be edited. Does anyone know how to fix this or have a correct implementation of the move?

About until gen 6 moves, download Essentials v17.2. About gen 7 moves (Pollen Puff, Instruct, Revelation Dance, etc) look around this thread because I posted them (IIRC we have all gen 7 moves coded in this thread tho!) here but Instruct will be added correctly in v18.
 
About until gen 6 moves, download Essentials v17.2. About gen 7 moves (Pollen Puff, Instruct, Revelation Dance, etc) look around this thread because I posted them (IIRC we have all gen 7 moves coded in this thread tho!) here but Instruct will be added correctly in v18.

Gear Up is posted here, but it doesn't work the same as it does in the actual game. It should raise the stats of the partner and the user if both have plus or minus as an ability. Therefore, it would work on the user providing that the user has the ability and it is a single battle. The code provided here (and everywhere else I found Gear Up scripts) only works on the partner, not user and partner. I was trying to fix this on my own, but I didn't know what to make the target of the move because I don't think there's a target for user and partner, just user's side, but I thought that was for stuff like reflect that doesn't specifically target Pokemon.
 
Gear Up is posted here, but it doesn't work the same as it does in the actual game. It should raise the stats of the partner and the user if both have plus or minus as an ability. Therefore, it would work on the user providing that the user has the ability and it is a single battle. The code provided here (and everywhere else I found Gear Up scripts) only works on the partner, not user and partner. I was trying to fix this on my own, but I didn't know what to make the target of the move because I don't think there's a target for user and partner, just user's side, but I thought that was for stuff like reflect that doesn't specifically target Pokemon.

Here what I have:
Spoiler:


But maybe we need to change '&&' (and) to '||' (or) in this part of code:
Code:
 next if !i.hasWorkingAbility(:PLUS) && !i.hasWorkingAbility(:MINUS)

Should be:
Code:
 next if !i.hasWorkingAbility(:PLUS) || !i.hasWorkingAbility(:MINUS)
 
Here what I have:
Spoiler:


But maybe we need to change '&&' (and) to '||' (or) in this part of code:
Code:
 next if !i.hasWorkingAbility(:PLUS) && !i.hasWorkingAbility(:MINUS)

Should be:
Code:
 next if !i.hasWorkingAbility(:PLUS) || !i.hasWorkingAbility(:MINUS)

That looks like it should be better. I don't think you would change the "&&" to "||" because the latter will always be true unless i has both abilities (if i has the ability Plus, it will render the statement true because the second conditional would be true, but it should be false). On a side note, would we have to change the target in the PBS moves file? Normally it's set to just target the partner, but maybe it will work because you address both the attacker and the partner here?

EDIT: The move works as intended in battle. Having the user's side as the target works also. I forget if it was always like that or if I changed it before when I was playing around with the move, though.
 
Last edited:
Back
Top