• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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.

Encounter Densities

Nickalooose

--------------------
  • 1,309
    Posts
    17
    Years
    • Seen Dec 28, 2023
    What's these actually mean, looking in the original Encounters.txt, some land encounters have 25,25,10, others have 25,10,10... What do these actually do? what do they mean?
     
    I guess that's the chance of a wild encounter, 25 means that you have a chance of 25% of a battle with an encounter, 10 means 10% etc. But I'm not sure.
     
    taken from pokemon essentials wiki
    the likelihood of an encounter while walking around in long grass, caves and when surfing respectively. This line is optional, and if it does not exist, the densities are set to "25,10,10". A higher number means a greater chance of an encounter with each step.
     
    taken from pokemon essentials wiki

    I know this, I meant, what do they mean? What do they do? why call them densities? I like to know all things about Essentials so I fully understand things, and this is one thing I don't understand...

    25, is Land
    10, is Cave
    10, is Water

    But why isn't it 10,10,25 when on a water map?

    Do you see my dilemma haha

    I guess that's the chance of a wild encounter, 25 means that you have a chance of 25% of a battle with an encounter, 10 means 10% etc. But I'm not sure.

    You're right, but it's not the answer I'm looking for unfortunately.
     
    This is not really a major problem, but I would've like to know what they did, at least I know I don't neccessarily have to add them to encounters, thanks for trying anyways
     
    The values need to exist, although if you don't include them in encounters.txt some default values are provided instead.

    The higher the number, the more likely it will be to have a wild encounter. The highest useful number (ignoring items/abilities that affect encounter rate) is 180. A strange limit, I know.

    They're called densities because that's how you measure how much of something is in something else. A high density means there's a lot of things (Pokémon) in the thing (grass). Traditionally, Pokémon are more common in grass than they are in caves/water - this is because caves and water are larger than grass patches, and having to stop for an encounter every 6 paces or so while surfing/traversing a cave is excessive. Therefore the Pokémon density in caves/water (10) is lower than the density in grass (25).

    The calculation in Essentials is basically: on each step, there will be an encounter if rand(180)<density. There will never be an encounter during the first 3 steps after a battle/starting surfing.
     
    Oh I get it.

    I thought it was something to do with size (stating the obvious), because of the word "density", but, I thought it only mattered for water, thanks for clearing that up, so it doesn't neccessarily need to be 25,25,10, it could be 35,25,10, or even 25,35,10, etc.?

    Because that is actually a good thing to know if some part of your game Pokémon become savage and attack willy nilly for any reason.
     
    That's right. No map would use both the grass and cave numbers, but either kind of map could use the water number as well.

    I thought the wiki's explanation (quoted above) was sufficient.
     
    Yes haha, it's all good, I understand now! It was a general wanderringment as I didn't have it defined in encounters.txt at one point, and I deifned it in the script section, so was wanderring what it done and it's importance really... I do know that because it's defined in the scripts, I don't have to add it to encounters.txt, but it's fine, I know what it does now.

    I don't particulaly want to open a new thread (unless you want me too), but in this line:

    "Abilities"=>[29,"eg",PBAbilities,PBAbilities]

    What does the "29" and "eg" mean? What is it trying to read or write?

    I believe "eg" is the abilities name, and the "29" I actually have no clue, I figure it's how many letters and 0 being infinate, but I'd still like to know to understand this too.
     
    When pokemon.txt is compiled, that compiled information is stored in a different form. Specifically, it's stored in a series of 76 bytes per species in the file dexdata.dat (as well as a few other places). Byte number 29 is where the first ability is stored, and byte 30 is where the second ability is stored. These numbers can be seen when pbDexDataOffset is used when recalling some of that information.

    There are several kinds of information that something could be in pokemon.txt. You could have a number (e.g. a base stat or a level), a word or phrase that can be translated (e.g. the species name or Dex description), a word that corresponds to an item/ability/move, and so on. The various letters used tell the game what kind of information to expect, and tells it what to do with them. "e" and "g" both mean that a word corresponding to an item/ability/move is expected (an ability in this case, as implied by the two PBAbilities), and that the resulting information is to be saved into a single byte. "g" is just the same as "e", except its ability is ignored if it doesn't exist (i.e. the second one). The game therefore translates each provided ability name into that ability's ID number, and saves it into a single byte (byte 29 and then byte 30).

    The information that list a byte of 0 are actually stored elsewhere, rather than in this set of bytes. This includes any words, movesets, egg moves, evolutions and regional numbers. Words can be translated and need to be stored separately because of how they work, and the other four are of variable length and thus can't be stored in set bytes. The battler heights are also stored separately, perhaps because they can be changed by a Debug function and it's simpler to keep them separate (but that's just a guess).

    BaseStats lists "uuuuuu". "u" is simply a 1-byte number, and there's 6 of them so there's 6 base stats (they go in bytes 10, 11, 12, 13, 14 and 15). An asterisk means "repeat the other letters however many times you need". And there's a few more letters too. Capitalisation is important.

    That's the basics.
     
    Ooh I get it... I was wanderring why some numbers were missing, that's because they are counting from a number not in a number, the more data, the more bytes it will use, i.e. with basestats being "uuuuuu" and saved from 10, not all saved to 10.

    That makes alot more sence than what I was thinking... And now I can do what I planned to do in the first place knowing what does what now.

    I'm going to try this myself but I may need a little help later on, oh also, I don't have to edit the editor scripts, really, unless I'm going to use the editor for anything, right? Because I don't understand any of the 0xBF and things like that, kinda how move effects are I believe, and by looking through the editor scripts, it looks like I would need these and I don't like using things I'm not familiar with yet.
     
    If you're not going to use the Editor, you won't need to edit its scripts.

    I don't know what those 0xBF things are about either. They might be something to do with starting a new line in the file, since they appear in those places.
     
    0xBF mean BF in hexadecimal that mean 191 = (16*11+15 ) since B=11 and F=15 in hexadecimal. This is generally used for bit storage (memory access) and colors. Putting 0xBF, 0x0BF, 191, 0d191 or 0b10111111 do the exact same thing in Ruby.

    The line $PokemonGlobal.stepcount&=0x7FFFFFFF executes an 'and' operation on the number, so if stepcount is above 2147483647 them it starts on 0 again. This is probably made to save memory space and stop the stepcount for go to infinity.
     
    I know what they literally are, and how hex numbers work. I don't know what that particular sequence does in a text file, though (although as I said, I'm guessing it means "this is the start of a new line").
     
    I know what they literally are, and how hex numbers work. I don't know what that particular sequence does in a text file, though (although as I said, I'm guessing it means "this is the start of a new line").
    Yes, I know that you high probably know this. I was trying to explain to Nickalooose the things that I know about this.

    Continuing, the 0xBF.chr picks the ASCII char value of it (take a look in ASCII table).

    I take an quick search and found that 0xEF 0xBB 0xBF are the byte order marks (BOM) to check if the txt codification is UTF-8 (take a look in https://www.haypocalc.com/tmp/unicode-2011-03-25/html/encodings.html#byte-order-marks-bom).
     
    Last edited:
    Back
    Top