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

[Essentials v17.2] Gen 8 stuffs (Abilities, Items & Move)

XVR

  • 14
    Posts
    3
    Years
    • Seen Feb 27, 2024
    Hi, while testing the stuff posted here, I noticed that the move Dragon Darts doesn't make its effect in a precise way, at least not at 100%.

    The move hits the target twice in single battles, that's ok, but it failed at doubles, which doesn't make this (from Bulbapedia):

    If targeting an opponent when there are multiple opponents, Dragon Darts' first strike targets the original target and its second strike targets the other opponent. If either the original target or its ally would take no damage from Dragon Darts, both strikes are directed at the other Pokémon instead. If Dragon Darts targets an ally, both hits will hit that ally.
     

    XVR

  • 14
    Posts
    3
    Years
    • Seen Feb 27, 2024
    Another effect to be added. Heavy-Duty Boots works fine but it doesn't remove the Toxic Spikes when a Poison type Pokémon enters the field, as Bulbapedia says:
    If a grounded Poison-type Pokémon enters the field while holding this item, it will still cause Toxic Spikes to be removed.

    I have tested the move as it's coded right now, and a Poison type Pokémon which holds the boots doesn't be affected by the toxic hazards but it doesn't remove them.
     
  • 4
    Posts
    7
    Years
    • Seen Nov 1, 2023
    So, i added some gen 8 abilities, and now every battle, with any pokémon, this error appears at the end of every turn. Can someone help me?

    Exception: NameError
    Message: undefined local variable or method `target' for #<PokeBattle_Battle:0xddce078>
    PokeBattle_Battle:3448:in `__clauses__pbEndOfRoundPhase'
    PokeBattle_Clauses:42:in `pbEndOfRoundPhase'
    PokeBattle_Battle:2536:in `pbStartBattleCore'
    PokeBattle_Battle:2535:in `logonerr'
    PokeBattle_Battle:2535:in `pbStartBattleCore'
    PokeBattle_Battle:2517:in `loop'
    PokeBattle_Battle:2540:in `pbStartBattleCore'
    PokeBattle_Battle:2340:in `pbStartBattle'
    PField_Battles:98:in `pbWildBattle'
    PField_Battles:97:in `pbSceneStandby'
     
  • 286
    Posts
    5
    Years
    • Seen May 15, 2024
    So, i added some gen 8 abilities, and now every battle, with any pokémon, this error appears at the end of every turn. Can someone help me?

    Whatever is at line 3448 in Pokebattle_Battle is probably in the wrong place. There shouldn't be any target in the pbEndOfRoundPhase method because this happens after all Pokemon are done attacking for that round.
     

    WolfPP

    Spriter/ Pixel Artist
  • 1,309
    Posts
    5
    Years
    To not trigger the evo method (for Galarian Forms and Milcery) when the player uses Rare Candy, go to 'PItem_Items' and replace 'def pbChangeLevel(pokemon,newlevel,scene)' to:
    Spoiler:


    Edited the main posts about Galarian Farfetch'd, Yamask and Milcery evo methods.
     
  • 143
    Posts
    4
    Years
    • Seen Mar 26, 2024
    Hey there,
    just a tiny thing but if anyone is using WolfPP's Milcery evo script but wants the spinning to be automated you could use this.
    Just 3 things:
    1.Inside the "Game_Character" class add this part to the other accessors at the top
    Code:
    attr_accessor :spinning
    2. Just below that add this inside "def initialize(map=nil)"
    Code:
    @spinning = false
    3.Lastly inside "PField_Field" search for "# Poison party Pokémon"
    and add the following below that method
    Spoiler:
    Now you automatically spin clockwise when pressing left and
    counterclockwise when pressing right while holding page up
    No credit needed as the main script is WolfPP's work :)
     
  • 286
    Posts
    5
    Years
    • Seen May 15, 2024
    I think the code I previously put for Corrosive Gas is incorrect. I'm getting mixed messages between Bulbapedia and Pokemon Showdown, which are really my only ways of figuring out its mechanics because I don't have SwSh. I think Showdown incorrectly coded the move because it allows the Pokemon to gain new items from Bestow/Pickup after its item is corroded. As far as I could tell, Showdown just treats Corrosive Gas as knocking off an item and making it unrestorable. I'm going to trust Bulbapedia's explanation for the move, though it is leaving out some situations. One thing I think I misinterpreted before was when it said the Pokemon "cannot obtain another item". Before, I thought that meant it couldn't get new items from Trick, etc., but now, I think it means that while the Pokemon is holding its corroded item, it is unable to obtain another because this makes more sense and still works with the sentence.

    I'm going to have to make a lot of assumptions when scripting this move, and I'll list the ones that are different from my original assumptions about the move here (please correct me if you know that any of these are wrong):
    • Corrosive Gas applies to a Pokemon rather than a battler index, meaning that if a Pokemon affected by Corrosive Gas switches out, the switched in Pokemon will not be affected by Corrosive Gas and when the Pokemon with the corroded item switches back in, it will still have the Corrosive Gas effect
    • Corroded items can be given away (effect will transfer to Pokemon receiving item) or lost/knocked off (effect will disappear from the Pokemon)
    • The Pokemon with the corroded item can receive a different item from Trick, Switcheroo, etc., but not by Bestow, Pickup, etc. until it loses its corroded item
    • The Pokemon with the corroded item is treated as still holding an item for the purposes of Knock Off, Poltergeist, etc.
    • Pluck and Bug Bite cannot consume a corroded item from the opponent
    • No fail message is displayed if all opposing Pokemon are unaffected by Corrosive Gas

    Here's my new implementation:

    Corrosive Gas:
    Spoiler:
     
    Last edited:
  • 10
    Posts
    15
    Years
    • Seen Sep 7, 2023
    In some of HM100 the Techno's codes he mentions "replace XXX with your desired function code" (e.g. the one for Burning Jealousy).

    I'm not sure I understand, is the number arbitrary as long as it's unique, or does it correspond to the move ID number in the moves.txt file, or what? If it's to give specific effects to the attacks shouldn't it be a set number? Sorry if this should be obvious.

    EDIT: Never mind, I think I've got it from the function codes based on the moves.txt shared earlier (so here, Burning Jealousy should be 313 I think?).
     
  • 971
    Posts
    7
    Years
    • Age 21
    • Seen Nov 28, 2022
    In some of HM100 the Techno's codes he mentions "replace XXX with your desired function code" (e.g. the one for Burning Jealousy).

    I'm not sure I understand, is the number arbitrary as long as it's unique, or does it correspond to the move ID number in the moves.txt file, or what? If it's to give specific effects to the attacks shouldn't it be a set number? Sorry if this should be obvious.

    EDIT: Never mind, I think I've got it from the function codes based on the moves.txt shared earlier (so here, Burning Jealousy should be 313 I think?).

    Function codes and moves are separate. A move defines a function code, and that function code determines what the move actually does, such as paralyzing the opponent, starting a semi-invulnerable move like Fly, or having a chance to flinch the target. There are various moves that have the exact same effect though (or the same effect with a different chance percentage).

    So this allows each move to choose some arbitrary function code. This function code is arbitrary in the sense that it can be any hex value. The actual effect of a function code is implemented in the PokeBattle_MoveEffects script though, which means that, despite being able to choose any hex number for the function code, it must also have a defined effect in the aforementioned script (otherwise it uses a default, effect-less move).

    In short, the function code as defined in the PBS must match up with the function code of the move effect (which is usually a class named PokeBattle_Move_XXX, where XXX is the hex value. The function code "matching up", means your custom move has the same function code in moves.txt as the function code in the script itself.

    I hope that cleared it up a little.
     
  • 10
    Posts
    15
    Years
    • Seen Sep 7, 2023
    >I hope that cleared it up a little.

    Perfect, thanks Marin.

    I'm currently having an error with the fixed/edited code for Scale Shot, it's throwing an error where it says "numhits" doesn't exist. I noticed it wasn't mentioned in the original code before it was fixed?

    def pbEndTurn(choice)
    # True end(?)
    if @effects[PBEffects::ChoiceBand]<0 && @lastMoveUsed>=0 && !self.isFainted? &&
    (self.hasWorkingItem(:CHOICEBAND) ||
    self.hasWorkingItem(:CHOICESPECS) ||
    self.hasWorkingItem(:CHOICESCARF))
    @effects[PBEffects::ChoiceBand]=@lastMoveUsed
    end
    if @effects[PBEffects::GorillaTactics]<0 && @lastMoveUsed>=0 && !fainted? &&
    self.hasWorkingAbility(:GORILLATACTICS)
    @effects[PBEffects::GorillaTactics]=@lastMoveUsed
    end
    @battle.pbPrimordialWeather
    for i in 0...4
    @battle.battlers.pbBerryCureCheck
    end
    #### numhits exists here but may not be defined overall ###
    if i==numhits-1
    if isConst?(thismove.id,PBMoves,:SCALESHOT)
    if user.pbCanIncreaseStatStage?(PBStats::SPEED,user,false,self)
    user.pbIncreaseStat(PBStats::SPEED,1,user,false,self)
    end
    if user.pbCanReduceStatStage?(PBStats::DEFENSE,user,false,self)
    user.pbReduceStat(PBStats::DEFENSE,1,user,false,self)
    end
    end
    end

    The error is something to the effect of:

    Message: undefined local variable or method 'numhits' for PokeBattle_Battler

    (Apologies for the formatting, I'm trying to find out how you collapse that stuff / put it in code blocks.)
     
    Last edited:
  • 286
    Posts
    5
    Years
    • Seen May 15, 2024
    >I hope that cleared it up a little.

    Perfect, thanks Marin.

    I'm currently having an error with the fixed/edited code for Scale Shot, it's throwing an error where it says "numhits" doesn't exist. I noticed it wasn't mentioned in the original code before it was fixed?

    def pbEndTurn(choice)
    # True end(?)
    if @effects[PBEffects::ChoiceBand]<0 && @lastMoveUsed>=0 && !self.isFainted? &&
    (self.hasWorkingItem(:CHOICEBAND) ||
    self.hasWorkingItem(:CHOICESPECS) ||
    self.hasWorkingItem(:CHOICESCARF))
    @effects[PBEffects::ChoiceBand]=@lastMoveUsed
    end
    if @effects[PBEffects::GorillaTactics]<0 && @lastMoveUsed>=0 && !fainted? &&
    self.hasWorkingAbility(:GORILLATACTICS)
    @effects[PBEffects::GorillaTactics]=@lastMoveUsed
    end
    @battle.pbPrimordialWeather
    for i in 0...4
    @battle.battlers.pbBerryCureCheck
    end
    #### numhits exists here but may not be defined overall ###
    if i==numhits-1
    if isConst?(thismove.id,PBMoves,:SCALESHOT)
    if user.pbCanIncreaseStatStage?(PBStats::SPEED,user,false,self)
    user.pbIncreaseStat(PBStats::SPEED,1,user,false,self)
    end
    if user.pbCanReduceStatStage?(PBStats::DEFENSE,user,false,self)
    user.pbReduceStat(PBStats::DEFENSE,1,user,false,self)
    end
    end
    end

    The error is something to the effect of:

    Message: undefined local variable or method 'numhits' for PokeBattle_Battler

    (Apologies for the formatting, I'm trying to find out how you collapse that stuff / put it in code blocks.)


    I don't think you put the code in the right place. It works fine for me when I put it in this spot under
    def pbProcessMoveAgainstTarget(thismove,user,target,numhits,turneffects,nocheck=false,alltargets=nil,showanimation=true):
    Code:
          target.pbFaint if target.fainted? # no return
          user.pbFaint if user.fainted? # no return
          break if user.fainted? || target.fainted?
          # Berry check (maybe just called by ability effect, since only necessary Berries are checked)
          for j in 0...4
            @battle.battlers[j].pbBerryCureCheck(true)
          end
         [B] if i==numhits-1
            if isConst?(thismove.id,PBMoves,:SCALESHOT) 
              if user.pbCanIncreaseStatStage?(PBStats::SPEED,user,false,self)
                user.pbIncreaseStat(PBStats::SPEED,1,user,false,self)
              end
              if user.pbCanReduceStatStage?(PBStats::DEFENSE,user,false,self)
                user.pbReduceStat(PBStats::DEFENSE,1,user,false,self)
              end
            end
          end[/B]
          pbEffectsOnMoveEnd(thismove,user,target,damage)
          break if user.fainted? || target.fainted?
    Also you can end a code segment with this tag: [/CODE] and start one with this tag:
    Code:
     
  • 10
    Posts
    15
    Years
    • Seen Sep 7, 2023
    I don't think you put the code in the right place. It works fine for me when I put it in this spot under
    def pbProcessMoveAgainstTarget(thismove,user,target,numhits,turneffects,nocheck=false,alltargets=nil,showanimation=true):

    Thanks man that fixed it. I must've misread which file it went in. Similar looking code block.
     

    Juno and Ice

    Developer of Pokémon Floral Tempus
  • 150
    Posts
    6
    Years
    • Seen May 27, 2024
    So apparently you can't use the mints unless you make a create a whole new Pokémon since already existing Pokémon cause the game to throw up an error when you try to bring them into battle. Even when you haven't used a mint on them.

    This line:
    Code:
    nature=(self.mint!=-1) ? self.mint : self.nature
    Makes it so that you can't implement this in a game that's already been played. The only option is to start a new game.
     
  • 658
    Posts
    7
    Years
    So apparently you can't use the mints unless you make a create a whole new Pokémon since already existing Pokémon cause the game to throw up an error when you try to bring them into battle. Even when you haven't used a mint on them.

    Each Pokemon in Essentials is an instance of the Class Pokebattle_Pokemon. The Mints Code adds a new Class Variable called @mints which is used for the mechanic. When you use a Pokemon from a previous save, the mints variable is not initialized which causes the error. If you give yourself a new Pokemon, this will not happen as the Variable is initialized in the Pokemon Giving Script.

    There's nothing you can do about it afaik because that's just how objects work.
     
  • 2
    Posts
    3
    Years
    • Seen Sep 26, 2020
    Thanks for the scripts. they've worked so far. Only issue is that if Dragon Darts knocks it's original target out, it won't target the second, despite not working like that in the games. I did have to edit the script to work right for me, so I'll include that in case it's helpful. Just a little lost on the issue

    Spoiler:
     
  • 286
    Posts
    5
    Years
    • Seen May 15, 2024
    Expanding Force
    In PokeBattle_Battler under User=pbFindUser(choice,targets) add the following lines
    Spoiler:
    In the moves.txt PBS file add a new move number (YYY) with new function code (XXX)
    Spoiler:
    And finally in PokeBattle_Move_Effects add a new function code XXX
    Spoiler:

    Rising Voltage
    In moves.txt, add this line where YYY is a new move number, and a new function code is XXX.
    Spoiler:
    In Pokebattle_MoveEffects add a new function code XXX
    Spoiler:

    Just realized some problems with the damage calculation of these:

    Expanding Force in the def pbModifyBaseDamage should multiply damage by 1.5 (1.95x total power boost instead of 2x).
    From Bulbapedia: "If Psychic Terrain is in effect and the user is grounded upon its execution, this move gets a 1.5× power increase in addition to the usual 1.3× bonus from terrain"

    Rising Voltage should multiply base damage like you originally did with Expanding Force (2x total power boost instead of 2.6x).
    From Bulbapedia: "If the target is affected by Electric Terrain upon the move's execution, Rising Voltage's base power is doubled to 140 instead of the 1.5× power increase." (I think there's a typo and it should say "1.3× power increase")


    I also fixed Grassy Glide so that it will be stopped by Quick Guard etc. so check that out in the original post.
     
    Last edited:
  • 2
    Posts
    5
    Years
    • Seen Apr 24, 2023
    Sand Spit:

    For ability.txt:
    XXX,SANDSPIT,Sand Spit."The Pokémon creates a sandstorm when it's hit by an attack."

    Now in 'PokeBattle_Battler' script paste above Air Ballon's code (I just copied like SANDSTORM move works):
    Code:
            if target.hasWorkingAbility(:SANDSPIT)
              if @battle.weather!=PBWeather::HEAVYRAIN || @battle.weather!=PBWeather::HARSHSUN || 
                 @battle.weather!=PBWeather::STRONGWINDS || 
                @battle.weather!=PBWeather::SANDSTORM
                @battle.pbAnimation(getConst(PBMoves,:SANDSTORM),self,nil)
                @battle.weather=PBWeather::SANDSTORM
                @battle.weatherduration=5
                @battle.weatherduration=8 if target.hasWorkingItem(:SMOOTHROCK)
                @battle.pbCommonAnimation("Sandstorm",nil,nil)
                @battle.pbDisplay(_INTL("A sandstorm brewed!"))
              end
            end
            if target.hasWorkingItem(:AIRBALLOON,true)
              PBDebug.log("[Item triggered] #{target.pbThis}'s Air Balloon popped")
              @battle.pbDisplay(_INTL("{1}'s Air Balloon popped!",target.pbThis))
              target.pbConsumeItem(true,false)

    Added at the end of the first line: && @battle.wather!=PBWeather:: SANDSTORM
    because if i hit multiple time the ability activate again.
     
  • 286
    Posts
    5
    Years
    • Seen May 15, 2024
    Added at the end of the first line: && @battle.wather!=PBWeather:: SANDSTORM
    because if i hit multiple time the ability activate again.

    There's actually a problem with the second "if" that is making this happen (will also allow you to override primordial weather). If you just change all the "||" to "&&" it will be fixed. Using
    Code:
    if @battle.weather!=PBWeather::HEAVYRAIN || @battle.weather!=PBWeather::HARSHSUN || @battle.weather!=PBWeather::STRONGWINDS || @battle.weather!=PBWeather::SANDSTORM
    will always be true because if the weather isn't Heavy Rain, it will skip all the other checks that occur after, and if it is Heavy Rain, "@battle.weather!=PBWeather::HARSHSUN" will be true, skipping all the checks after that.
     
  • 286
    Posts
    5
    Years
    • Seen May 15, 2024
    Neutralizing Gas:
    V2.0 ("single battle" and "double battle fainted", fixed):
    Spoiler:


    V1.0
    Spoiler:

    P.S: Need to code to not appears the phrases after pokémon with Neutralizing Gas fainted or switched for Unnerve and Imposter abilities.

    BONUS
    Official phrases for Unnever (but IDK how to code when we have 2 pokémon into the same party with that ability :/ Anyway):
    Inside 'PokeBattle_Battler' script, above '# Air Balloon message', paste the code, like:
    Code:
        # Unnerve
        if self.hasWorkingAbility(:UNNERVE) && onactive
          PBDebug.log("[Ability triggered] #{pbThis}'s Unnerve")
          if @battle.pbOwnedByPlayer?(@index)
            @battle.pbDisplay(_INTL("The opposing team is too nervous to eat Berries!"))
          else
            @battle.pbDisplay(_INTL("Your team is too nervous to eat Berries!"))
          end
        end
        # Air Balloon message
        if self.hasWorkingItem(:AIRBALLOON) && onactive
          @battle.pbDisplay(_INTL("{1} floats in the air with its {2}!",pbThis,PBItems.getName(self.item)))
        end
      end
    
      def pbEffectsOnDealingDamage(move,user,target,damage)

    Now, Only the foking Milcery's evo method to finish all gen 8 (Dynamax/Gigantamax and Camping not included)!

    Cya!

    V2.0 doesn't correctly have Neutralizing Gas not work on Stance Change, Schooling, and Neutralizing Gas. You used
    Code:
      def hasWorkingAbility(ability,ignorefainted=false)
        if @battle.field.effects[PBEffects::NeutralizingGas]
          return false if !isConst?(@ability,PBAbilities,:STANCECHANGE) ||
                          !isConst?(@ability,PBAbilities,:SCHOOLING) ||
                          !isConst?(@ability,PBAbilities,:NEUTRALIZINGGAS)
        end
        return false if fainted? && !ignorefainted
        return false if @effects[PBEffects::GastroAcid]
        return isConst?(@ability,PBAbilities,ability)
      end
    But it should be
    Code:
      def hasWorkingAbility(ability,ignorefainted=false)
        return false if fainted? && !ignorefainted
        return false if @effects[PBEffects::GastroAcid]
        if @battle.field.effects[PBEffects::NeutralizingGas]
          return false if !(isConst?(@ability,PBAbilities,:STANCECHANGE) ||
                          isConst?(@ability,PBAbilities,:SCHOOLING) ||
                          isConst?(@ability,PBAbilities,:NEUTRALIZINGGAS))
        end
        return isConst?(@ability,PBAbilities,ability)
      end
     
    Back
    Top