• 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!
  • 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] Issues adding my new "ranger" like feature

  • 465
    Posts
    8
    Years
    • Seen Jun 17, 2024
    So long story short, i have rangers and the stylers/discs in my game and wanting to make them into one of the regions gimmicks.

    idea is, after wild battles if you faint or run away theres a chance the pokemon will want to assist you, got this figured out already.

    now in battle there is a partner effect and depending on your partners type it'll be a different effect, e.g. fire types burn.

    now i have the effect, and detecting if its a fire type partner, but it gives the effect to ALL pokemon and burns them all.

    two bits of code i have are;
    Code:
        if $PokemonGlobal.PartnerObtained==true # Detects if the player has a partner
          # Partner Fire effect initialize
          if self.pbOwnSide.effects[PBEffects::PartnerEffect]!=-1 && [email protected]?(@index)
            self.pbOwnSide.effects[PBEffects::PartnerEffect]=-1
            partnername=PBSpecies.getName($PokemonGlobal.PartnerSpecies)
            @battle.pbDisplay(_INTL("{1} is Assisting You!",partnername))
          end
        end
    This is above Download and below battery/Intimidate in PokeBattle_Battler

    then;
    Code:
        # Partner Effects
        # Fire type 1 partner, Burning.
        for i in 0...2
          if sides[i].effects[PBEffects::PartnerEffect]==-1 && $PokemonGlobal.PartnerType1==getConst(PBTypes,:FIRE)
            for i in priority
              next if i.isFainted?
              if i.pbCanBurn?(nil,false)   #100% Chance for debugging
              #if rand(3)==0 && i.pbCanBurn?(nil,false)
                partnername=PBSpecies.getName($PokemonGlobal.PartnerSpecies)
                i.pbBurn(nil,_INTL("{1} was Burnt by {2}'s Assist!",i.pbThis,partnername))
              end
            end
          end
        end
    this is Above aqua ring and below the healing of grassy terrain in PokeBattle_Battle.

    i just want the foe to get the partner effect thus them getting burned but not having luck (also due to the first parts placing the ability popups appear every bit of the turn with EBS, since its in that bit of ability code even tho it should only trigger once.)
     
    So basically, you want to check whether the player owns i or not? Take a look through PokeBattle_Battler, I'm sure there's a function like that.
     
    So basically, you want to check whether the player owns i or not? Take a look through PokeBattle_Battler, I'm sure there's a function like that.

    well the "@battle.pbOwnedByPlayer?(@index)" is used by frisk in battler to detect if its the players pokemon or not, which i've already included but it does nothing. maybe change @index to i/self?
     
    You probably want i.index.

    okay, only issue is battler uses self more than i. looking up more, self.index is used so ill test that rn.

    tested self.index, same issue, and i.index crashes due to i probably no being defined.

    frisk/ancipitation/forewarn seem wird but have checks.
    like the last two use;
    Code:
          for foe in [pbOpposing1,pbOpposing2]
    might that work? not had a real struggle with something like this in awhile
     
    Last edited:
    Something like that could work too, yeah. It's just a matter of making sure you're calling the appropriate methods on things.
     
    Back
    Top