The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.


Advertise here

Reply
 
Thread Tools
  #1    
Old August 2nd, 2013, 05:41 PM
dexter1o6
 
Join Date: Jul 2013
Age: 26
Gender: Male

Advertise here
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:

Spoiler:
Adding Type3


Changed def PBTypes.getCombinedEffectiveness (and others) in PBTypesExtra line 27 to:

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
=nil,opponentType3=nil)
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
=nil,opponentType3=nil)
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
=nil,opponentType3=nil)
e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
return e==8
end

# changed this def to add type3
def PBTypes.isIneffective?(attackType,opponentType1,opponentType2
=nil,opponentType3=nil)
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
=nil)
e=PBTypes.getCombinedEffectiveness(attackType,opponentType1,opponentType2,opponentType3)
return e>8
end
end



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:

# changed this def to support type3
def pbHasType?(type)
if type.is_a?(Symbol) || type.is_a?(String)
ret=isConst?(self.type1,PBTypes,type.to_sym) ||
isConst?(self.type2,PBTypes,type.to_sym) ||
isConst?(self.type3,PBTypes,type.to_sym)
return ret
else
return (self.type1==type||self.type2==type||self.type3==type)
end
end

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:

# added this if block
if isConst?(otype3,PBTypes,:FLYING) && opponent.effects[PBEffects::Roost]
otype3=otype1
end

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 by dexter1o6; August 3rd, 2013 at 07:54 PM. Reason: Your double post has been automatically merged.
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 05:27 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.