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

Changeing Opponent's Hidden Power Type

Sir_Tman

Overworked game Dev
201
Posts
8
Years
Hidden Power works based off the amount ivs a pokemon has. How would I change an oppoents ivs so I can change the type of hidden power.
 
824
Posts
8
Years
I'm in agreement with Phigo. Under standard Essentials, you can only make opponents have either Dark or Fighting type (with Fighting being the default). In basic Essentials, you can only all of the IVs of a trainer Pokemon at once, not each one individually.

The script in the link Phigo provided allows you to give specific values to any of a Pokemon's stats - IVs, EVs, Natures, etc. Which in turn gives them a specific Hidden Power.

However, note that the way Hidden Power is coded in basic Essentials is not quite the way it works in the official games. It gives the same results as the official games, though...until you add Fairy type to your game (either on your own or by using the Gen VI pack). I think that the intention of coding it differently from normal was so that if people made their own type chart (like that satire game that has over 40 types), that Hidden Power wouldn't be a game-crasher by calling for a type that didn't exist.

The code that makes Hidden Power work, found in PokeBattle_MoveEffects, is as follows:
Code:
################################################################################
# Power and type depends on the user's IVs.
################################################################################
class PokeBattle_Move_090 < PokeBattle_Move
  def pbType(type,attacker,opponent)
    hp=pbHiddenPower(attacker.iv)
    return hp[0]
  end
  
  def pbBaseDamage(basedmg,attacker,opponent)
    return 60 if @battle.gen>=6
    hp=pbHiddenPower(attacker.iv)
    return hp[1]
  end
end

def pbHiddenPower(iv)
  powermin=30
  powermax=70
  type=0; base=0
  types=[]
  for i in 0..PBTypes.maxValue
    types.push(i) if !PBTypes.isPseudoType?(i) [COLOR="Red"]&& !isConst?(i,PBTypes,:FAIRY)[/COLOR] &&
                     !isConst?(i,PBTypes,:NORMAL) [COLOR="Blue"]&& !isConst?(i,PBTypes,:SHADOW)[/COLOR]
  end
  type|=(iv[PBStats::HP]&1)
  type|=(iv[PBStats::ATTACK]&1)<<1
  type|=(iv[PBStats::DEFENSE]&1)<<2
  type|=(iv[PBStats::SPEED]&1)<<3
  type|=(iv[PBStats::SPATK]&1)<<4
  type|=(iv[PBStats::SPDEF]&1)<<5
  type=(type*(types.length-1)/63).floor
  hptype=types[type]
  base|=(iv[PBStats::HP]&2)>>1
  base|=(iv[PBStats::ATTACK]&2)
  base|=(iv[PBStats::DEFENSE]&2)<<1
  base|=(iv[PBStats::SPEED]&2)<<2
  base|=(iv[PBStats::SPATK]&2)<<3
  base|=(iv[PBStats::SPDEF]&2)<<4
  base=(base*(powermax-powermin)/63).floor+powermin
  return [hptype,base]
end
Add in the red code if your game has Fairy type but you still want to use the official Hidden Powers (where 31/31/31/31/31/31 results in a Dark type HP). Add in the blue code if your game has Shadow Pokemon.
 

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
While it's true that base Essentials doesn't have a ready-to-roll IV modifier for trainers' Pokémon, it DOES have the Events.onTrainerPartyLoad procedure, which lets you edit a trainer's Pokémon after they're loaded. See script section PField_EncounterModifiers and add in whatever code you want to make it modify the appropriate IVs for the appropriate Pokémon. There's no need for third party scripts, such as the one Phigo mentioned.

However, note that the way Hidden Power is coded in basic Essentials is not quite the way it works in the official games. It gives the same results as the official games, though...until you add Fairy type to your game (either on your own or by using the Gen VI pack). I think that the intention of coding it differently from normal was so that if people made their own type chart (like that satire game that has over 40 types), that Hidden Power wouldn't be a game-crasher by calling for a type that didn't exist
The most likely reason why GF doesn't have Fairy-type Hidden Powers is consistency. If you change the type calculation to incorporate Fairy, then Pokémon transferred from older games into Gen 6 would be affected by this change and potentially end up with a different HP type. The players who'd spent ages breeding for the perfect Hidden Power wouldn't like this. And since GF introduced Incense items to breed certain Pokémon (i.e. ones that could breed previously but which didn't produce the baby species), clearly they care a lot about consistency.

Fortunately, Essentials has no such concerns about keeping in line with previous Gens, because Essentials has no previous Gens. It gets upgraded, and doesn't worry about interacting with older iterations. Players generally aren't as devoutly attached to their Pokémon in an Essentials game either, because of the complete lack of a competitive scene and, more generally, much less popularity than the GF games. So it's not a concern if the Hidden Power type calculation changes. It doesn't concern me, anyway.

I just thought that Hidden Power should have access to all the types (except Normal and pseudo-types like Shadow and ???). Yes, that's not exactly how the GF games do it, but so what? If I wanted to do it exactly like how GF does it, I would have ONLY allowed the use of the 16 types it could have been, regardless of a user adding in Fairy or Light or Sound or Bird or Banana-type by themselves. If you want to exclude specific types, go right ahead; I didn't want to, so I didn't.
 
Back
Top