- 64
- Posts
- 10
- Years
- Seen May 29, 2020
Dear all,
In the 12th version of essentials I had a third, fourth and fifth type per pokemon working. All it did was add STAB to moves of the 3rd through 5th type, effectiveness remained unedited. Now in the 13th version of essentials it's not working anymore.
I think 4 major script sections are involved (tell me if I'm missing something):
It starts in the compiler:
Then it goes to PokemonMap, to the small def pbDexDataOffset:
Next comes the part (PokeBattle_Pokemon) where it *seems* to go wrong, but the error would be hard to miss if it indeed goes wrong here:
Finally, to check the type, here is the part of the PokemonSummary, in def drawPageOne (note that type 5 is NOT shown in the summary, this type has a special purpose that is not important here):
The way it works now, is that it shows only the first two types. For example, zubat shows POISON FLYING, while it should be POISON FLYING SOUND AIR.
If I force the summary to show all types, I get POISON FLYING POISON POISON.
If I then change the pbDexDataOffset numbers in PokeBattle_Pokemon of type 2 to those of type 3 and vice versa, I get POISON SOUND POISON POISON.
This last test indicates that the compiler and the pbDexDataOffset do their work right, but the def Pokemon.type3 is not working. Somewhere, the types 3 and 4 (and 5) seem to be overwritten after they are loaded.
Questions that may help me if answered:
- is there some important piece of code I'm missing here?
- is there a new piece of code in essentials 13 that messes with the pokemon types?
- is there a reason why a 3rd type would not be 'picked up', because of, for example, a piece of code telling it that any pokemon cannot have more than 2 types?
For the record:
- it did work in version 12 and it still does.
- I tried looking for differences in the code of version 12 and version 13, but found none.
- it doesn't show in the summary, but it also doesn't work in battle. That means the summary itself is probably not at fault.
- Obviously, I did add all extra types in the PBS text-files, and these extra types work as long as they are type 1 or type 2.
- The fifth type is only present to be able to give every pokemon the invisible type 'AIRBORNE'. Basically, AIRBORNE works as LEVITATE. Now all pokemon that seem to float or fly cannot be hit by ground-type moves. The functionality of AIRBORNE is handled in the def pbTypeModifier, and displays '[move] doesn't effect [pokemon]...' like all other imune moves.
Thank you for looking into this complex matter, I would appreciate any comment that can point me in the right direction. But at the moment I'm just clueless :S
dexter1o6
In the 12th version of essentials I had a third, fourth and fifth type per pokemon working. All it did was add STAB to moves of the 3rd through 5th type, effectiveness remained unedited. Now in the 13th version of essentials it's not working anymore.
I think 4 major script sections are involved (tell me if I'm missing something):
It starts in the compiler:
Spoiler:
Code:
def pbCompilePokemonData
sections=[]
requiredtypes={
"Name"=>[0,"s"],
"Kind"=>[0,"s"],
"InternalName"=>[0,"c"],
"Pokedex"=>[0,"S"],
"Moves"=>[0,"*uE",nil,PBMoves],
"Color"=>[6,"e",["Red","Blue","Yellow","Green","Black","Brown","Purple","Gray","White","Pink"]],
"Type1"=>[8,"e",PBTypes],
"BaseStats"=>[13,"uuuuuu"],
"Rareness"=>[19,"w"],
"GenderRate"=>[21,"e",{"AlwaysMale"=>0,"FemaleOneEighth"=>31,"Female25Percent"=>63,
"Female50Percent"=>127,"Female75Percent"=>191,"AlwaysFemale"=>254,"Genderless"=>255}],
"Happiness"=>[22,"u"],
"GrowthRate"=>[23,"e",["Medium","Erratic","Fluctuating","Parabolic","Fast","Slow"]],
"StepsToHatch"=>[24,"w"],
"EffortPoints"=>[26,"uuuuuu"],
"Compatibility"=>[34,"uu"],
"Height"=>[36,"f"],
"Weight"=>[38,"f"],
"BaseEXP"=>[41,"w"],
}
optionaltypes={
"BattlerPlayerY"=>[0,"i"],
"BattlerEnemyY"=>[0,"i"],
"BattlerAltitude"=>[0,"i"],
"EggMoves"=>[0,"*E",PBMoves],
"FormNames"=>[0,"S"],
"RegionalNumbers"=>[0,"*w"],
"Evolutions"=>[0,"*ses",nil,["Unknown",
"Happiness","HappinessDay","HappinessNight","Level","Trade",
"TradeItem","Item","AttackGreater","AtkDefEqual","DefenseGreater",
"Silcoon","Cascoon","Ninjask","Shedinja","Beauty",
"ItemMale","ItemFemale","DayHoldItem","NightHoldItem","HasMove",
"HasInParty","LevelMale","LevelFemale","Location","TradeSpecies",
"Custom1","Custom2","Custom3","Custom4","Custom5","Custom6","Custom7"]],
"Habitat"=>[7,"e",["","Grassland","Forest","WatersEdge","Sea","Cave","Mountain","RoughTerrain","Urban","Rare"]],
"Type2"=>[9,"e",PBTypes],
"Type3"=>[10,"e",PBTypes],
"Type4"=>[11,"e",PBTypes],
"Type5"=>[12,"e",PBTypes],
"Abilities"=>[32,"eg",PBAbilities,PBAbilities],
"HiddenAbility"=>[43,"eggg",PBAbilities,PBAbilities,PBAbilities,PBAbilities],
"WildItemCommon"=>[51,"*E",PBItems],
"WildItemUncommon"=>[53,"*E",PBItems],
"WildItemRare"=>[55,"*E",PBItems]
}
currentmap=-1
dexdatas=[]
eggmoves=[]
entries=[]
kinds=[]
speciesnames=[]
moves=[]
evolutions=[]
regionals=[]
formnames=[]
metrics=[SignedWordArray.new,SignedWordArray.new,SignedWordArray.new]
constants=""
maxValue=0
File.open("PBS/pokemon.txt","rb"){|f|
FileLineData.file="PBS/pokemon.txt"
pbEachFileSection(f){|lastsection,currentmap|
dexdata=[]
for i in 0...79
dexdata[i]=0
end
thesemoves=[]
theseevos=[]
if !lastsection["Type5"] || lastsection["Type5"]==""
if !lastsection["Type4"] || lastsection["Type4"]==""
if !lastsection["Type3"] || lastsection["Type3"]==""
if !lastsection["Type2"] || lastsection["Type2"]==""
if !lastsection["Type1"] || lastsection["Type1"]==""
raise _INTL("No Pokémon type is defined in section {2} (PBS/pokemon.txt)",key,sectionDisplay) if hash==requiredtypes
next
end
lastsection["Type2"]=lastsection["Type1"].clone
end
lastsection["Type3"]=lastsection["Type2"].clone
end
lastsection["Type4"]=lastsection["Type3"].clone
end
#lastsection["Type5"]=lastsection["Type4"].clone
end
(...blahdiblah... the rest of this def is unaltered)
Then it goes to PokemonMap, to the small def pbDexDataOffset:
Spoiler:
Code:
def pbDexDataOffset(dexdata,species,offset)
dexdata.pos=79*(species-1)+offset
end
Next comes the part (PokeBattle_Pokemon) where it *seems* to go wrong, but the error would be hard to miss if it indeed goes wrong here:
Spoiler:
Code:
################################################################################
# Types
################################################################################
# Returns whether this Pokémon has the specified type.
def hasType?(type)
if type.is_a?(String) || type.is_a?(Symbol)
return isConst?(self.type1,PBTypes,type) || isConst?(self.type2,PBTypes,type) || isConst?(self.type3,PBTypes,type) || isConst?(self.type4,PBTypes,type) || isConst?(self.type5,PBTypes,type)
else
return self.type1==type || self.type2==type || self.type3==type || self.type4==type || self.type5==type
end
end
# Returns this Pokémon's first type.
def type1
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,@species,8)
ret=dexdata.fgetb
dexdata.close
return ret
end
# Returns this Pokémon's second type.
def type2
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,@species,9)
ret=dexdata.fgetb
dexdata.close
return ret
end
# Returns this Pokémon's third type.
def type3
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,@species,10)
ret=dexdata.fgetb
dexdata.close
return ret
end
# Returns this Pokémon's fourth type.
def type4
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,@species,11)
ret=dexdata.fgetb
dexdata.close
return ret
end
# Returns this Pokémon's fifth type.
def type5
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,@species,12)
ret=dexdata.fgetb
dexdata.close
return ret
end
Finally, to check the type, here is the part of the PokemonSummary, in def drawPageOne (note that type 5 is NOT shown in the summary, this type has a special purpose that is not important here):
Spoiler:
Code:
type1rect=Rect.new(0,pokemon.type1*28,64,28)
type2rect=Rect.new(0,pokemon.type2*28,64,28)
type3rect=Rect.new(0,pokemon.type3*28,64,28)
type4rect=Rect.new(0,pokemon.type4*28,64,28)
overlay.blt(355,114,@typebitmap.bitmap,type1rect) # added/edited this line
if pokemon.type1!=pokemon.type2 # added/edited this line
overlay.blt(430,114,@typebitmap.bitmap,type2rect) # added/edited this line
if pokemon.type2!=pokemon.type3 && pokemon.type1!=pokemon.type3 # added/edited this line
overlay.blt(355,146,@typebitmap.bitmap,type3rect) # added/edited this line
if pokemon.type3!=pokemon.type4 && pokemon.type2!=pokemon.type4 && pokemon.type1!=pokemon.type4 # added/edited this line
overlay.blt(430,146,@typebitmap.bitmap,type4rect) # added/edited this line
end # added/edited this line
end # added/edited this line
end # added/edited this line
The way it works now, is that it shows only the first two types. For example, zubat shows POISON FLYING, while it should be POISON FLYING SOUND AIR.
If I force the summary to show all types, I get POISON FLYING POISON POISON.
If I then change the pbDexDataOffset numbers in PokeBattle_Pokemon of type 2 to those of type 3 and vice versa, I get POISON SOUND POISON POISON.
This last test indicates that the compiler and the pbDexDataOffset do their work right, but the def Pokemon.type3 is not working. Somewhere, the types 3 and 4 (and 5) seem to be overwritten after they are loaded.
Questions that may help me if answered:
- is there some important piece of code I'm missing here?
- is there a new piece of code in essentials 13 that messes with the pokemon types?
- is there a reason why a 3rd type would not be 'picked up', because of, for example, a piece of code telling it that any pokemon cannot have more than 2 types?
For the record:
- it did work in version 12 and it still does.
- I tried looking for differences in the code of version 12 and version 13, but found none.
- it doesn't show in the summary, but it also doesn't work in battle. That means the summary itself is probably not at fault.
- Obviously, I did add all extra types in the PBS text-files, and these extra types work as long as they are type 1 or type 2.
- The fifth type is only present to be able to give every pokemon the invisible type 'AIRBORNE'. Basically, AIRBORNE works as LEVITATE. Now all pokemon that seem to float or fly cannot be hit by ground-type moves. The functionality of AIRBORNE is handled in the def pbTypeModifier, and displays '[move] doesn't effect [pokemon]...' like all other imune moves.
Thank you for looking into this complex matter, I would appreciate any comment that can point me in the right direction. But at the moment I'm just clueless :S
dexter1o6