~Azura
Alright, purple is good.
- 512
- Posts
- 19
- Years
- Seen Jun 21, 2012
I see, you're using plain text files to load data, isn't it (although I don't use rxdata extensions)? I use a method similar to that and then store the information on global variables, so I can load properly later.
However, some of the information I just input normally on RMXP's database, like battler graphic, Exp, Item held, Base Stats, etc, what saves me a lot of unnecessary work.
I have two classes to store Pokémon information: (comments are from my scripts)
As I write my code, I add new information to $game.
You can use that list if it helps you.
And dude... why bother using hex? To me it just makes things more complicated and your code more dirty...
And about Effort Values... they're are constant. You're mistaking with Internal Values (that are random, 0~31)
Check this:
~Azura.
However, some of the information I just input normally on RMXP's database, like battler graphic, Exp, Item held, Base Stats, etc, what saves me a lot of unnecessary work.
I have two classes to store Pokémon information: (comments are from my scripts)
Code:
#================================================================
#GAME_DATABASE
#================================================================
# This class converts values entered into RmXP's default
# database and create new variables to store those values,
# so it's more easy to read and update the code.
#
# NOTE:
# game_id: unique ID for each Pokémon (even if they are the same kind)
# pk_id: normal ID for each Pokémon
#
# So:
# Two Charizards have the same pk_id, but different game_id.
#
# Edit: (Build 6806)
#
# - removed setup_exp and setup_ev methods because they might
# be unstable at the moment. They're not used.
# - created methods for returning data from database (build 3
# directly retrieved that data to the hashes).
# - variable 'pk_id' is now a class variable.
#================================================================
class Game_Database
(...)
#==========================================================
#SETUP
#==========================================================
# This method create a hash (Hash.new) for every 'slot'
# in $database. Each slot will be accessed via 'pk_id'.
def setup(pk_id)
@pk_id = pk_id
$database[@pk_id] = Hash.new(nil)
$database[@pk_id]["Name"] = name
$database[@pk_id]["Type1"] = type1
$database[@pk_id]["Type2"] = type2
$database[@pk_id]["Growth Rate"] = growth_rate
$database[@pk_id]["Gender Ratio"] = gender_ratio
$database[@pk_id]["MaxHP"] = maxhp
$database[@pk_id]["Attack"] = attack
$database[@pk_id]["Defense"] = defense
$database[@pk_id]["Sp.Attack"] = sp_attack
$database[@pk_id]["Sp.Defense"] = sp_defense
$database[@pk_id]["Speed"] = speed
$database[@pk_id]["Base Exp"] = base_exp
$database[@pk_id]["Rareness"] = rareness
$database[@pk_id]["Wild Item"] = wild_item
$database[@pk_id]["Wild Item %"] = wild_item_rate
$database[@pk_id]["Battler Front"] = battler_front
$database[@pk_id]["Battler Back"] = battler_back
end
Code:
#================================================================
#GAME_POKÉMON
#================================================================
# This class controls all the data that is unique
# for each Pokémon, like Nickname, Gender, Nature,
# Effort Values, Individual Values, etc.
# For Trainer's unique variables, refer to Game_Trainer class.
#
#
# Edit: (Build 6806)
#
# - removed methods and variables that might be unstable or
# not used.
# - variable 'game_id' is now a class variable.
#================================================================
class Game_Pokemon
(...)
#==============================================================
#SETUP
#==============================================================
def setup(pk_id, level, where, nickname)
# Generate next unique ID:
refresh_game_id
# Correct level, if greater than MAX_LEVEL constant:
level = level > MAX_LEVEL ? MAX_LEVEL : level
# Create a hash for $game slot:
$game[@game_id]
$game[@game_id]["Name"]
$game[@game_id]["Nickname"]
$game[@game_id]["Level"]
$game[@game_id]["Gender"]
$game[@game_id]["Nature"]
$game[@game_id]["Type1"]
$game[@game_id]["Type2"]
$game[@game_id]["Met In Where"]
$game[@game_id]["Met In Level"]
$game[@game_id]["Name Gender"]
$game[@game_id]["Default ID"]
$game[@game_id]["OT ID"]
$game[@game_id]["OT Name"]
$game[@game_id]["Item"]
$game[@game_id]["Battler Front"]
$game[@game_id]["Battler Back"]
$game[@game_id]["Lucky Flag"]
$game[@game_id]["Exp Now"]
$game[@game_id]["Exp"]
$game[@game_id]["IV"]
$game[@game_id]["IV"]["MaxHP"]
$game[@game_id]["IV"]["Attack"]
$game[@game_id]["IV"]["Sp.Attack"]
$game[@game_id]["IV"]["Defense"]
$game[@game_id]["IV"]["Sp.Defense"]
$game[@game_id]["IV"]["Speed"]
$game[@game_id]["EV"]
$game[@game_id]["EV"]["MaxHP"]
$game[@game_id]["EV"]["Attack"]
$game[@game_id]["EV"]["Sp.Attack"]
$game[@game_id]["EV"]["Defense"]
$game[@game_id]["EV"]["Sp.Defense"]
$game[@game_id]["EV"]["Speed"]
$game[@game_id]["Base Stat"]
$game[@game_id]["Base Stat"]["MaxHP"]
$game[@game_id]["Base Stat"]["Attack"]
$game[@game_id]["Base Stat"]["Sp.Attack"]
$game[@game_id]["Base Stat"]["Defense"]
$game[@game_id]["Base Stat"]["Sp.Defense"]
$game[@game_id]["Base Stat"]["Speed"]
$game[@game_id]["Stat"]
$game[@game_id]["Stat"]["MaxHP"]
$game[@game_id]["Stat"]["HP"]
$game[@game_id]["Stat"]["Attack"]
$game[@game_id]["Stat"]["Sp.Attack"]
$game[@game_id]["Stat"]["Defense"]
$game[@game_id]["Stat"]["Sp.Defense"]
$game[@game_id]["Stat"]["Speed"]
$game[@game_id]["Move Name"]
$game[@game_id]["Move PP"]
$game[@game_id]["Move PP Now"]
$game[@game_id]["Move Critical Flag"]
$game[@game_id]["Move Type"]
$game[@game_id]["Move HM"]
$game[@game_id]["Move Damage"]
$game[@game_id]["Move Effect Type"]
$game[@game_id]["Move Effect Rate"]
$game[@game_id]["Move Accuracy"]
$game[@game_id]["Move Priority"]
end
As I write my code, I add new information to $game.
You can use that list if it helps you.
And dude... why bother using hex? To me it just makes things more complicated and your code more dirty...
And about Effort Values... they're are constant. You're mistaking with Internal Values (that are random, 0~31)
Check this:
https://www.upc.pkmn.co.uk/games/rs/guides/id.html said:Individual Values
Individual Values range from 0 to 31. These values are important in determining the Pokemon's final stats. There are six Individual Values for HP, Attack, Defense, Speed, Special Attack, and Special Defense. They are randomly determined when you encounter a wild Pokemon or obtain a Pokemon internally.
https://www.upc.pkmn.co.uk/games/rs/guides/id.html said:Effort Values
The Effort Values or EVs, indicate the amount of training that a Pokemon has made. Whenever a Pokemon defeats another Pokemon in an internal battle (wild or trainer), it will earn a number of EVs depending on the species of the Pokemon defeated. The limit that a Pokemon can earn is 510. A Pokemon can earn up to 255 EVs per stat (HP, Attack, Defense, Speed, Special Attack, Special Defense). The stat enhancers (HP Up, Protein, Iron, Carbos, Calcium, and Zinc, respectively) increase the EVs of the respective stat by 10. Each stat enhancer only takes effect if the EV for that stat would increase to 100 or less. In the Emerald version, certain Berries can decrease a Pokemon's effort values by 10 (Pomeg Berry, Kelpsy Berry, Qualot Berry, Tamato Berry, Hondew Berry, and Grepa Berry, respectively).
The Macho Brace and the PokeRus virus each will double the EVs that a Pokemon will earn.
Using Exp.Share gives the same amount of EVs to each participant in defeating a Pokemon. The Macho Brace and the PokeRus virus have no effect on this distribution.
When your Pokemon has earned the maximum of 510 EVs, it can receive an Effort Ribbon in Slateport's outdoor market.
~Azura.