- 64
- Posts
- 10
- Years
- Seen May 29, 2020
Hi all,
I've been trying to add a Type3. With this I mean that pokemon can have 3 types. For example: Gyarados becomes Water, Flying, Dragon, and Masquerain becomes Bug, Water, Flying.
This means adding 'Type3', adding a line to the compiler to read Pokemon.txt, altering the effectiveness check and changing 'modtype' (was 0, 1, 2, -4-, 8, 16; becomes 0, 1, 2, 4, -8-, 16, 32, 64).
So far most things seem to work. Except that I have some problems with the DARK type. When using a DARK-type move, the move is sometimes skipped: Krokorok used Bite! ... Zubat used Supersonic! (and supersonic is executed).
It is not always skipped. I know it fails on Zubat, Wingull, Surskit, Sewaddle, Weepinbell, Emolga,Pansage and Sandile. But it succeeds on for example Marill, Psyduck and Sandshrew.
Because the DARK-type is the last move of Types.txt, I tried switching the DARK-type with, in this case, the FIRE-type. After this, the FIRE-type failed. That makes me think it may be related to PBTypes.maxValue. But I have no clue of the exact location of the error.
I logged every change, but the log is not self-explanatory (without looking into the script). I included it anyway to give an idea of the changes I made:
Thanks in advance for your help,
dexter1o6
EDIT:
...and there's the next thing that apparently doesn't work yet. The FIRE-type seems to be super-effective at Hoothoot. So, that's no good -_- And it means the problem probably doesn't lie with .maxValue...
To make it a bit more clear, all hints help. I may be able to fix the problem myself, but I need guidance through the script. Like, what scripts are likely to be part of the problem?
EDIT2:
I now have a large list of pokemon on which the problem does (not) occur, and I've concluded that pokemon with two types are the problem. If the defending pokemon has one or three types, it works.
I think the problem might be in pbExtraTypes. Does anyone know what kind of parameter is returned by PBTypes.getEffectiveness? Is that a boolean or an integer? And why is the argument 'opponentType2' set to 'nil'? Just to get to know the pieces of code I'm working with...
I've been trying to add a Type3. With this I mean that pokemon can have 3 types. For example: Gyarados becomes Water, Flying, Dragon, and Masquerain becomes Bug, Water, Flying.
This means adding 'Type3', adding a line to the compiler to read Pokemon.txt, altering the effectiveness check and changing 'modtype' (was 0, 1, 2, -4-, 8, 16; becomes 0, 1, 2, 4, -8-, 16, 32, 64).
So far most things seem to work. Except that I have some problems with the DARK type. When using a DARK-type move, the move is sometimes skipped: Krokorok used Bite! ... Zubat used Supersonic! (and supersonic is executed).
It is not always skipped. I know it fails on Zubat, Wingull, Surskit, Sewaddle, Weepinbell, Emolga,
Because the DARK-type is the last move of Types.txt, I tried switching the DARK-type with, in this case, the FIRE-type. After this, the FIRE-type failed. That makes me think it may be related to PBTypes.maxValue. But I have no clue of the exact location of the error.
I logged every change, but the log is not self-explanatory (without looking into the script). I included it anyway to give an idea of the changes I made:
Spoiler:
Adding Type3
Changed def PBTypes.getCombinedEffectiveness (and others) in PBTypesExtra line 27 to:
[FONT="]class PBTypes
@@TypeData=nil # internal
def PBTypes.loadTypeData # internal
if !@@TypeData
@@TypeData=load_data("Data/types.dat")
@@TypeData[0].freeze
@@TypeData[1].freeze
@@TypeData[2].freeze
@@TypeData.freeze
end
return @@TypeData
end
def PBTypes.isPseudoType?(type)
return PBTypes.loadTypeData()[0].include?(type)
end
def PBTypes.isSpecialType?(type)
return PBTypes.loadTypeData()[1].include?(type)
end
def PBTypes.getEffectiveness(attackType,opponentType)
return PBTypes.loadTypeData()[2][attackType*(PBTypes.maxValue+1)+opponentType]
end
# changed this def to add type3
def PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2[/FONT][FONT="][FONT="]=nil[/FONT],opponentType3[/FONT][FONT="][FONT="]=nil[/FONT])
if opponentType2==nil
return PBTypes.getEffectiveness(attackType,opponentType1)*2
else
if opponentType3==nil
mod1=PBTypes.getEffectiveness(attackType,opponentType1)
mod2=(opponentType1==opponentType2) ? 2 : PBTypes.getEffectiveness(attackType,opponentType2)
return (mod1*mod2)
else
mod1=PBTypes.getEffectiveness(attackType,opponentType1)
mod2=(opponentType1==opponentType2) ? 2 : PBTypes.getEffectiveness(attackType,opponentType2)
mod3=(opponentType1==opponentType3||opponentType2==opponentType3) ? 2 : PBTypes.getEffectiveness(attackType,opponentType3)
return (mod1*mod2*mod3)
end
end
end
# changed this def to add type3
def PBTypes.isNotVeryEffective?(attackType,opponentType1,opponentType2[/FONT][FONT="][FONT="]=nil[/FONT],opponentType3[/FONT][FONT="][FONT="]=nil[/FONT])
e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
return e>0 && e<8
end
# changed this def to add type3
def PBTypes.isNormalEffective?(attackType,opponentType1,opponentType2[/FONT][FONT="][FONT="]=nil[/FONT],opponentType3[/FONT][FONT="][FONT="]=nil[/FONT])
e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
return e==8
end
# changed this def to add type3
def PBTypes.isIneffective?(attackType,opponentType1,opponentType2[/FONT][FONT="][FONT="]=nil[/FONT],opponentType3[/FONT][FONT="][FONT="]=nil[/FONT])
e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
return e==0
end
# changed this def to add type3
def PBTypes.isSuperEffective?(attackType,opponentType1,opponentType2=nil,opponentType3[/FONT][FONT="][FONT="]=nil[/FONT])
e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
return e>8
end
end[/FONT]
In PokeBattle_Battler added the extra type around line 16, line 159, line 198, line 386, line 865, line 866 (typemod=8), line 942, line 1663 (typemod<=8), line 2145 (typemod>8), line 2147 (typemod<8), line 2205 (typemod=8), line 2211 (typemod=8), line 2219 (typemod=8).
Also in PokeBattle_Battler around line 457:
[FONT="] # changed this def to support type3[/FONT]
[FONT="] def pbHasType?(type)[/FONT]
[FONT="] if type.is_a?(Symbol) || type.is_a?(String)[/FONT]
[FONT="] ret=isConst?(self.type1,PBTypes,type.to_sym) ||[/FONT]
[FONT="] isConst?(self.type2,PBTypes,type.to_sym) ||[/FONT]
[FONT="] isConst?(self.type3,PBTypes,type.to_sym)[/FONT]
[FONT="] return ret[/FONT]
[FONT="] else[/FONT]
[FONT="] return (self.type1==type||self.type2==type||self.type3==type)[/FONT]
[FONT="]end[/FONT]
[FONT="] end[/FONT]
In PokeBattle_Move added the extra type around line 140 (return 8), line 141 (return 8), line 146, line 163 (typemod3), line 167 (typemod3), line 175 + 176, line 184 + 189, line 191 (edited), line 195 (edited), line 709, line 754 (edited), line 761 (edited), line 798 (edited), line 890 (edited), line 892 (edited), line 912 (edited), line 914 (edited), line 1017 (edited),
Also in PokeBattle_Move around line 157:
[FONT="] # added this if block[/FONT]
[FONT="] if isConst?(otype3,PBTypes,:FLYING) && opponent.effects[PBEffects::Roost][/FONT]
[FONT="] otype3=otype1[/FONT]
[FONT="] end[/FONT]
In PokeBattle_Pokemon added the extra type around line 333 (edited), line 335 (edited)
Added a def Type3 around line 357 in PokeBattle_Pokemon.
In PokeBattle_Battle added the extra type around line 61 (edited), line 71 (edited), line 73 (edited), line 81 (edited), line 1805 (edited), line 1981.
In PokeBattle_AI added the extra type around line 1510 (edited), line 1532 (edited), line 1534 (edited), 1563, 1564, 1569, 1586, 1592 + 1593, 1598, 1600, 1932, 1935, 2044, 2102, 2105.
In PokeBattle_AI around line 1603 edited pbTypeModifier2 (and lines: 2044, 2053)
In PokeBattle_MoveEffects added the extra type around line 2420, 2466, 2504, 2529, 2549, 2552, 2559, 2758, 7187.
In PokemonPokedex around line 583 (and 639, 652, 683, 712, 714, 963) skipped the search on type function!
In PokemonSummary added the extra type around line 258, 262, 265-269, 656, 660, 663-667.
In PokemonStorage added the extra type around line 2335, 2339, 2342-2346.
In PokemonMultipleForms added the extra type around line 21, line 53 (added 'def type3'), line 277 (added type3 as a block).
In PokemonShadowPokemon added the extra type around line 529.
PokemonPurifyChamber?
In PokemonOrgBattleGenerator added the extra type around line 584, 586, 1055.
In PokemonOrgBattleGenerator edited 'def pbDecideWinnerEffectiveness' and 'def getTypes'.
In PokemonEditor added the extra type around line 114, 148, 149, 150, 151.
In Compiler added the extra type around line 2251, 2280, 2288, 2289.
Changed def PBTypes.getCombinedEffectiveness (and others) in PBTypesExtra line 27 to:
[FONT="]class PBTypes
@@TypeData=nil # internal
def PBTypes.loadTypeData # internal
if !@@TypeData
@@TypeData=load_data("Data/types.dat")
@@TypeData[0].freeze
@@TypeData[1].freeze
@@TypeData[2].freeze
@@TypeData.freeze
end
return @@TypeData
end
def PBTypes.isPseudoType?(type)
return PBTypes.loadTypeData()[0].include?(type)
end
def PBTypes.isSpecialType?(type)
return PBTypes.loadTypeData()[1].include?(type)
end
def PBTypes.getEffectiveness(attackType,opponentType)
return PBTypes.loadTypeData()[2][attackType*(PBTypes.maxValue+1)+opponentType]
end
# changed this def to add type3
def PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2[/FONT][FONT="][FONT="]=nil[/FONT],opponentType3[/FONT][FONT="][FONT="]=nil[/FONT])
if opponentType2==nil
return PBTypes.getEffectiveness(attackType,opponentType1)*2
else
if opponentType3==nil
mod1=PBTypes.getEffectiveness(attackType,opponentType1)
mod2=(opponentType1==opponentType2) ? 2 : PBTypes.getEffectiveness(attackType,opponentType2)
return (mod1*mod2)
else
mod1=PBTypes.getEffectiveness(attackType,opponentType1)
mod2=(opponentType1==opponentType2) ? 2 : PBTypes.getEffectiveness(attackType,opponentType2)
mod3=(opponentType1==opponentType3||opponentType2==opponentType3) ? 2 : PBTypes.getEffectiveness(attackType,opponentType3)
return (mod1*mod2*mod3)
end
end
end
# changed this def to add type3
def PBTypes.isNotVeryEffective?(attackType,opponentType1,opponentType2[/FONT][FONT="][FONT="]=nil[/FONT],opponentType3[/FONT][FONT="][FONT="]=nil[/FONT])
e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
return e>0 && e<8
end
# changed this def to add type3
def PBTypes.isNormalEffective?(attackType,opponentType1,opponentType2[/FONT][FONT="][FONT="]=nil[/FONT],opponentType3[/FONT][FONT="][FONT="]=nil[/FONT])
e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
return e==8
end
# changed this def to add type3
def PBTypes.isIneffective?(attackType,opponentType1,opponentType2[/FONT][FONT="][FONT="]=nil[/FONT],opponentType3[/FONT][FONT="][FONT="]=nil[/FONT])
e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
return e==0
end
# changed this def to add type3
def PBTypes.isSuperEffective?(attackType,opponentType1,opponentType2=nil,opponentType3[/FONT][FONT="][FONT="]=nil[/FONT])
e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
return e>8
end
end[/FONT]
In PokeBattle_Battler added the extra type around line 16, line 159, line 198, line 386, line 865, line 866 (typemod=8), line 942, line 1663 (typemod<=8), line 2145 (typemod>8), line 2147 (typemod<8), line 2205 (typemod=8), line 2211 (typemod=8), line 2219 (typemod=8).
Also in PokeBattle_Battler around line 457:
[FONT="] # changed this def to support type3[/FONT]
[FONT="] def pbHasType?(type)[/FONT]
[FONT="] if type.is_a?(Symbol) || type.is_a?(String)[/FONT]
[FONT="] ret=isConst?(self.type1,PBTypes,type.to_sym) ||[/FONT]
[FONT="] isConst?(self.type2,PBTypes,type.to_sym) ||[/FONT]
[FONT="] isConst?(self.type3,PBTypes,type.to_sym)[/FONT]
[FONT="] return ret[/FONT]
[FONT="] else[/FONT]
[FONT="] return (self.type1==type||self.type2==type||self.type3==type)[/FONT]
[FONT="]end[/FONT]
[FONT="] end[/FONT]
In PokeBattle_Move added the extra type around line 140 (return 8), line 141 (return 8), line 146, line 163 (typemod3), line 167 (typemod3), line 175 + 176, line 184 + 189, line 191 (edited), line 195 (edited), line 709, line 754 (edited), line 761 (edited), line 798 (edited), line 890 (edited), line 892 (edited), line 912 (edited), line 914 (edited), line 1017 (edited),
Also in PokeBattle_Move around line 157:
[FONT="] # added this if block[/FONT]
[FONT="] if isConst?(otype3,PBTypes,:FLYING) && opponent.effects[PBEffects::Roost][/FONT]
[FONT="] otype3=otype1[/FONT]
[FONT="] end[/FONT]
In PokeBattle_Pokemon added the extra type around line 333 (edited), line 335 (edited)
Added a def Type3 around line 357 in PokeBattle_Pokemon.
In PokeBattle_Battle added the extra type around line 61 (edited), line 71 (edited), line 73 (edited), line 81 (edited), line 1805 (edited), line 1981.
In PokeBattle_AI added the extra type around line 1510 (edited), line 1532 (edited), line 1534 (edited), 1563, 1564, 1569, 1586, 1592 + 1593, 1598, 1600, 1932, 1935, 2044, 2102, 2105.
In PokeBattle_AI around line 1603 edited pbTypeModifier2 (and lines: 2044, 2053)
In PokeBattle_MoveEffects added the extra type around line 2420, 2466, 2504, 2529, 2549, 2552, 2559, 2758, 7187.
In PokemonPokedex around line 583 (and 639, 652, 683, 712, 714, 963) skipped the search on type function!
In PokemonSummary added the extra type around line 258, 262, 265-269, 656, 660, 663-667.
In PokemonStorage added the extra type around line 2335, 2339, 2342-2346.
In PokemonMultipleForms added the extra type around line 21, line 53 (added 'def type3'), line 277 (added type3 as a block).
In PokemonShadowPokemon added the extra type around line 529.
PokemonPurifyChamber?
In PokemonOrgBattleGenerator added the extra type around line 584, 586, 1055.
In PokemonOrgBattleGenerator edited 'def pbDecideWinnerEffectiveness' and 'def getTypes'.
In PokemonEditor added the extra type around line 114, 148, 149, 150, 151.
In Compiler added the extra type around line 2251, 2280, 2288, 2289.
Thanks in advance for your help,
dexter1o6
EDIT:
...and there's the next thing that apparently doesn't work yet. The FIRE-type seems to be super-effective at Hoothoot. So, that's no good -_- And it means the problem probably doesn't lie with .maxValue...
To make it a bit more clear, all hints help. I may be able to fix the problem myself, but I need guidance through the script. Like, what scripts are likely to be part of the problem?
EDIT2:
I now have a large list of pokemon on which the problem does (not) occur, and I've concluded that pokemon with two types are the problem. If the defending pokemon has one or three types, it works.
I think the problem might be in pbExtraTypes. Does anyone know what kind of parameter is returned by PBTypes.getEffectiveness? Is that a boolean or an integer? And why is the argument 'opponentType2' set to 'nil'? Just to get to know the pieces of code I'm working with...
Last edited: