1 Change Time Based Evolution Times
BuffelSaft edited this page 2020-07-06 21:51:29 +12:00

For whatever reason, Game Freak decided that day time in Ruby, Sapphire and Emerald should be from 12:00 p.m. to 11:59 p.m. (and night time should be 12:00 a.m. to 11:59 a.m.). As there's no day/night cycle in these games, this only really affected Eevee's evolution into Espeon or Umbreon.

This tutorial will explain how to change these to more sensible values, as seen in most other Pokémon games.

First, open up include/pokemon.h and define two new constants:

#define DAY_START 4
#define NIGHT_START 18

These values will be used to determine what time day and night start in your game; note that they're in 24 hour time. Feel free to customize them.

Next, open up src/pokemon.c and replace all instances of the following code:

  • Replace gLocalTime.hours >= 12 && gLocalTime.hours < 24 with gLocalTime.hours >= DAY_START && gLocalTime.hours < NIGHT_START
  • Replace gLocalTime.hours >= 0 && gLocalTime.hours < 12 with (gLocalTime.hours >= NIGHT_START || gLocalTime.hours < DAY_START)

If you're using Dizzy Egg's repos in your project you may have a few instances of these, but otherwise there's only one of each.

Lastly, if you've chosen different day/night start times, you should double check that the AND and OR conditions above still make sense.

For example: if you did #define DAY_START 12 and #define NIGHT_START 0, you'd have gLocalTime.hours >= 12 && gLocalTime.hours < 0, which won't work as gLocalTime.hours can't be greater than 12 and less than 0 at the same time.