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

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

TheShinyMew

Wild Challenger appeared!
125
Posts
13
Years
Hi! I am wondering if you could do abilities and moves from the Pokémon Sun and Moon games (like the ability Liquid Voice and Laser Focus) and a possible thing to make Z-Moves in Pokémon Essentials v16.2 as well? Just wondering.

I'm trying to do Liquid Voice, which turns Sound-based moves into Water-type moves. Here's the code:
Code:
      elsif thismove.isSoundBased?
         if attacker.hasWorkingAbility(:LIQUIDVOICE) && hasConst?(PBTypes,:WATER)
          type=getConst(PBTypes,:WATER)
          @powerboost=true
        end
      end
When Ii compiled it, it gave me an error. Is there anything wrong with it? Thank you in advance!
 
188
Posts
9
Years
  • Age 39
  • Seen Jan 21, 2024
In PokeBattle_Move, def pbTypeModifier after the otype lines, use this code for Liquid Voice:
Code:
    [COLOR=Red]if attacker.hasWorkingAbility(:LIQUIDVOICE) && isSoundBased?
      atype=getConst(PBTypes,:WATER) || 0
    end
[/COLOR]
For Laser Focus, we don't know yet if the use of a status move in the next turn would cancel the effect or not. As for Z-Moves, fully implementing them would require a lot of coding.
 
824
Posts
8
Years
As for Z-Moves, fully implementing them would require a lot of coding.

:D

I've actually implemented them into my game, but am still working on the Z-Status moves. It required editing the Compiler scripts, so if we add them, resources for base Essentials might become incompatible.

Spoiler:
 
Last edited:
188
Posts
9
Years
  • Age 39
  • Seen Jan 21, 2024
You're right on Extreme Evoboost being exclusive to the Eevee species. I get the feeling we'll be seeing Z-Moves in the next version of Essentials.
 
824
Posts
8
Years
You're right on Extreme Evoboost being exclusive to the Eevee species.
Yes, but is it exclusive in name only (like most exclusive moves, so Smeargle can still use them if he Sketches them), or is it forced to not work if someone that isn't Eevee uses it (Like Chatot's Chatter, Hoopa-U's Hyperspace Fury, and now Darkrai's Dark Void)? I'm personally thinking the latter, because the animation.

Technically, the distinction isn't important on the player's end, because it's a Z-Move and therefore can't be Sketched, but as a developer, I like to know these things.

I get the feeling we'll be seeing Z-Moves in the next version of Essentials.
Depends on if the next version is v16.3 or v17.0. If the former, I'm not sure if we'll see Z-Moves in it. If the latter, we probably will.
 

TheShinyMew

Wild Challenger appeared!
125
Posts
13
Years
What about Pollen Puff's effect (The user attacks the enemy with a pollen puff that explodes. If the target is an ally, it gives the ally a pollen puff that restores its HP instead.) or the Spectral Thief (The user hides in the target's shadow, steals the target's stat boosts, and then attacks.)?
 
824
Posts
8
Years
What about Pollen Puff's effect (The user attacks the enemy with a pollen puff that explodes. If the target is an ally, it gives the ally a pollen puff that restores its HP instead.) or the Spectral Thief (The user hides in the target's shadow, steals the target's stat boosts, and then attacks.)?

I haven't done Pollen Puff yet, but here's Spectral Thief:

Code:
################################################################################
# Steals target's stat boosts, then attacks
################################################################################
class PokeBattle_Move_1A1 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if opponent.stages[1]>0 || opponent.stages[2]>0 || opponent.stages[3]>0 ||
       opponent.stages[4]>0 || opponent.stages[5]>0 || opponent.stages[6]>0 ||
       opponent.stages[7]>0
      stolenstats=[0,0,0,0,0,0,0,0]
      for i in 0...8
        stolenstats[i]=opponent.stages[i]*1 if opponent.stages[i]>0
        opponent.stages[i]=0 if opponent.stages[i]>0
      end
      @battle.pbDisplay(_INTL("{1} stole {2}'s stat boosts!",attacker.pbThis,opponent.pbThis(true)))
      showanim=true
      for i in 0...6
        if attacker.pbCanIncreaseStatStage?(i,true,attacker) && stolenstats[i]>0
          attacker.pbIncreaseStat(i,stolenstats[i],true,showanim,attacker)
          showanim=false
        end
      end
    end
    # actually attack now
    ret=super(attacker,opponent,hitnum,alltargets,showanimation)
    return ret
  end
end
 

TheShinyMew

Wild Challenger appeared!
125
Posts
13
Years
What about giving different Evolution stones, Pokemon egg groups and egg moves depending on a forme? Alolan Pokemon can do that.
 
15
Posts
7
Years
  • Age 36
  • Seen Apr 21, 2023
I don't know if it's impolite to ask such thing, but have one of you created a script for the move "Stomping Tantrum?" I'm trying to implement some of the new moves (only a few, the ones learnable by the Pokémon of previous generations), but I have no knowledge at all about scripting and such. The other moves I could "combine" previous existing ones (although I'm pretty sure I made a lot of mistakes, they seem to be working so far - so far), but Stomping Tantrum is quite different. I don't know if the game records whether the user's previous move failed or not, and neither how to "call" that information, since no other move does that kind of thing.
Thanks in advance!
 
188
Posts
9
Years
  • Age 39
  • Seen Jan 21, 2024
I don't know if it's impolite to ask such thing, but have one of you created a script for the move "Stomping Tantrum?" I'm trying to implement some of the new moves (only a few, the ones learnable by the Pokémon of previous generations), but I have no knowledge at all about scripting and such. The other moves I could "combine" previous existing ones (although I'm pretty sure I made a lot of mistakes, they seem to be working so far - so far), but Stomping Tantrum is quite different. I don't know if the game records whether the user's previous move failed or not, and neither how to "call" that information, since no other move does that kind of thing.
Thanks in advance!
How I would approach this one is to create a new PBEffect called LastMoveFailed, initialise it in PokeBattle_Battler as false and in PokeBattle_Battler, def pbProcessMoveAgainstTarget add this line:
Code:
      # Check success (accuracy/evasion calculation)
      if !nocheck &&
         !pbSuccessCheck(thismove,user,target,i==0 || thismove.function==0xBF) # Triple Kick
        if thismove.function==0xBF && realnumhits>0   # Triple Kick
          break   # Considered a success if Triple Kick hits at least once
        elsif thismove.function==0x10B   # Hi Jump Kick, Jump Kick
          #TODO: Not shown if message is "It doesn't affect XXX..."
          PBDebug.log("[#{user.pbThis} took crash damage]")
          @battle.pbDisplay(_INTL("{1} kept going and crashed!",user.pbThis))
          damage=[1,(user.totalhp/2).floor].max
          if damage>0
            @battle.scene.pbDamageAnimation(user,0)
            user.pbReduceHP(damage)
          end
          user.pbFaint if user.isFainted?
        #elsif parentalbond && realnumhits==0
        #  break
        end
        user.effects[PBEffects::Outrage]=0 if thismove.function==0xD2 # Outrage
        user.effects[PBEffects::Rollout]=0 if thismove.function==0xD3 # Rollout
        user.effects[PBEffects::FuryCutter]=0 if thismove.function==0x91 # Fury Cutter
        user.effects[PBEffects::EchoedVoice]=0 if thismove.function==0x92 # Echoed Voice
        user.effects[PBEffects::Stockpile]=0 if thismove.function==0x113 # Spit Up
        [COLOR=Red]user.effects[PBEffects::LastMoveFailed]=true[/COLOR]
        return
      end
Replace this line:
Code:
      return if numhits>1 && target.damagestate.calcdamage<=0
With:
Code:
      [COLOR=Red]if numhits>1 && target.damagestate.calcdamage<=0[/COLOR]
        [COLOR=Red]user.effects[PBEffects::LastMoveFailed]=true
        return
      end[/COLOR]

Add this line as the very last line in PokeBattle_Battler, def pbProcessMoveAgainstTarget:
Code:
user.effects[PBEffects::LastMoveFailed]=false
In PokeBattle_MoveEffects, create a new function code and add this code:
Code:
  def pbBaseDamage(basedmg,attacker,opponent)
    return basedmg*2 if attacker.effects[PBEffects::LastMoveFailed]
    return basedmg
  end
No pbEffect function is necessary for that one.
 
Last edited:
15
Posts
7
Years
  • Age 36
  • Seen Apr 21, 2023
How I would approach this one is to create a new PBEffect called LastMoveFailed, initialise it in PokeBattle_Battler as false and in PokeBattle_Battler, def pbProcessMoveAgainstTarget add this line:
Code:
      # Check success (accuracy/evasion calculation)
      if !nocheck &&
         !pbSuccessCheck(thismove,user,target,i==0 || thismove.function==0xBF) # Triple Kick
        if thismove.function==0xBF && realnumhits>0   # Triple Kick
          break   # Considered a success if Triple Kick hits at least once
        elsif thismove.function==0x10B   # Hi Jump Kick, Jump Kick
          #TODO: Not shown if message is "It doesn't affect XXX..."
          PBDebug.log("[#{user.pbThis} took crash damage]")
          @battle.pbDisplay(_INTL("{1} kept going and crashed!",user.pbThis))
          damage=[1,(user.totalhp/2).floor].max
          if damage>0
            @battle.scene.pbDamageAnimation(user,0)
            user.pbReduceHP(damage)
          end
          user.pbFaint if user.isFainted?
        #elsif parentalbond && realnumhits==0
        #  break
        end
        user.effects[PBEffects::Outrage]=0 if thismove.function==0xD2 # Outrage
        user.effects[PBEffects::Rollout]=0 if thismove.function==0xD3 # Rollout
        user.effects[PBEffects::FuryCutter]=0 if thismove.function==0x91 # Fury Cutter
        user.effects[PBEffects::EchoedVoice]=0 if thismove.function==0x92 # Echoed Voice
        user.effects[PBEffects::Stockpile]=0 if thismove.function==0x113 # Spit Up
        [COLOR=Red]user.effects[PBEffects::LastMoveFailed]=true[/COLOR]
        return
      end
Replace this line:
Code:
      return if numhits>1 && target.damagestate.calcdamage<=0
With:
Code:
      [COLOR=Red]if numhits>1 && target.damagestate.calcdamage<=0[/COLOR]
        [COLOR=Red]user.effects[PBEffects::LastMoveFailed]=true
        return
      end[/COLOR]

Add this line as the very last line in PokeBattle_Battler, def pbProcessMoveAgainstTarget:
Code:
user.effects[PBEffects::LastMoveFailed]=false
In PokeBattle_MoveEffects, create a new function code and add this code:
Code:
  def pbBaseDamage(basedmg,attacker,opponent)
    return basedmg*2 if attacker.effects[PBEffects::LastMoveFailed]
    return basedmg
  end
No pbEffect function is necessary for that one.

Thank you so much! It seems to be working, so far! Now all that's left for me is that tricky Laser Focus.
 
824
Posts
8
Years
Thank you so much! It seems to be working, so far! Now all that's left for me is that tricky Laser Focus.

Code:
################################################################################
# The user's next move will be a critical hit
################################################################################
class PokeBattle_Move_19A < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    attacker.effects[PBEffects::LaserFocus]=2
    @battle.pbDisplay(_INTL("{1} began focusing hard!",attacker.pbThis))
    return 0
  end
end

Code:
  def pbIsCritical?(attacker,opponent)
    if opponent.hasWorkingAbility(:SHELLARMOR) && !attacker.hasBypassingAbility 
      return false
    end
    return false if opponent.pbOwnSide.effects[PBEffects::LuckyChant]>0
    return true if @function==0xA0 # Frost Breath
    return true if attacker.hasWorkingAbility(:MERCILESS) && opponent.status==PBStatus::POISON
[COLOR="Red"]    return true if attacker.effects[PBEffects::LaserFocus]>0[/COLOR]





The one that's going to give me trouble is Core Enforcer. I need to figure out how to tell if the opponent has used this turn, then give them the GastroAcid effect if they have.
 
15
Posts
7
Years
  • Age 36
  • Seen Apr 21, 2023
Code:
################################################################################
# The user's next move will be a critical hit
################################################################################
class PokeBattle_Move_19A < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    attacker.effects[PBEffects::LaserFocus]=2
    @battle.pbDisplay(_INTL("{1} began focusing hard!",attacker.pbThis))
    return 0
  end
end

Code:
  def pbIsCritical?(attacker,opponent)
    if opponent.hasWorkingAbility(:SHELLARMOR) && !attacker.hasBypassingAbility 
      return false
    end
    return false if opponent.pbOwnSide.effects[PBEffects::LuckyChant]>0
    return true if @function==0xA0 # Frost Breath
    return true if attacker.hasWorkingAbility(:MERCILESS) && opponent.status==PBStatus::POISON
[COLOR="Red"]    return true if attacker.effects[PBEffects::LaserFocus]>0[/COLOR]





The one that's going to give me trouble is Core Enforcer. I need to figure out how to tell if the opponent has used this turn, then give them the GastroAcid effect if they have.

Thank you! You obviously know a lot about Scripting and I know nothing lol, but I created a "sort of" Core Enforcer. I took the functional code of Payback (since its Power doubles if the Target has already moved) and added the effect of Simple Beam to change the ability of the target tô something useless (Illuminate, for instance). Obviously is not elegant and it is far from accurate, but I suppose it works
 

sonicfan7895

Just a dude, I guess
122
Posts
13
Years
I do have one thing I wanted to try... I've been trying to see if I can get Battle Bond to work in my game.

For me personally, I don't quite know how to implement it; I considered treating it like a Mega Evolution and checking to see if it has the ability Battle Bond, but it doesn't seem to be working at all.

Any tips? I can provide the codes I used relating to Battle Bond, unless someone has already implemented this in their game...
 
15
Posts
7
Years
  • Age 36
  • Seen Apr 21, 2023
I do have one thing I wanted to try... I've been trying to see if I can get Battle Bond to work in my game.

For me personally, I don't quite know how to implement it; I considered treating it like a Mega Evolution and checking to see if it has the ability Battle Bond, but it doesn't seem to be working at all.

Any tips? I can provide the codes I used relating to Battle Bond, unless someone has already implemented this in their game...

Well, I can't stress this enough - I don't know anything about scripting. But I've managed to improvise a lot of things from the 7 gen to my game just by adjusting things that already existed. For Battle Bond, I guess (hope) you can create a new effect ("greninja" or something) and then copy the code from Moxie and make it activate this new effect whenever you make an enemy faint (instead of raising your attack, like Moxie does). Then you go to Pokebattle_Battler and copy the code from some Pokémon in the "def pbCheckForm", like Cherrim, and change the way that it activates (make the greninja effect being on, instead of the weather being sunny). I have no idea if that works, but it's an idea, I guess.
 
188
Posts
9
Years
  • Age 39
  • Seen Jan 21, 2024
Well, I can't stress this enough - I don't know anything about scripting. But I've managed to improvise a lot of things from the 7 gen to my game just by adjusting things that already existed. For Battle Bond, I guess (hope) you can create a new effect ("greninja" or something) and then copy the code from Moxie and make it activate this new effect whenever you make an enemy faint (instead of raising your attack, like Moxie does). Then you go to Pokebattle_Battler and copy the code from some Pokémon in the "def pbCheckForm", like Cherrim, and change the way that it activates (make the greninja effect being on, instead of the weather being sunny). I have no idea if that works, but it's an idea, I guess.
It actually would work. Also, Soul Heart is a copy of Moxie only a different stat is boosted.
 

sonicfan7895

Just a dude, I guess
122
Posts
13
Years
Soul Heart is not a copy of Moxie. Moxie triggers only when you make an enemy faint. Soul Heart is triggered any time any Pokemon on the field faints.

So now that's cleared up, everything else PIMOC said in his reply is the way to do it? Can you confirm this? I don't mean to be doubtful, I'm sure a lot of people are curious about how it's done too...
 
824
Posts
8
Years
So now that's cleared up, everything else PIMOC said in his reply is the way to do it? Can you confirm this? I don't mean to be doubtful, I'm sure a lot of people are curious about how it's done too...

It's not how I made Battle Bond work, but theoretically it should work. (I made Battle Bond by altering some code I had written for a fake ability Galeforce like in Fire Emblem, so it's not quite useful to you guys.)
 
Back
Top