Skip to main content

Pokégear Phone System

Author(s): MrHam88.
Research: pokeheartgold (decomp), Eclipse (Luna), Senate, BlackShark, Mixone (guide feedback), MrHam88.

This guide explains how the Pokégear phone system works and how to edit its data in Pokémon HeartGold and SoulSilver.

info

Unless stated otherwise, offsets and byte values are for US HeartGold; overlay offsets refer to decompressed files.


Overview​

The system is easiest to follow in the same order as a call moves through it:

  1. Phonebook data defines the contacts and their properties; field scripts register their numbers.
  2. Incoming and outgoing calls explains how a call starts and, for a random incoming call, how the caller is chosen.
  3. Phone conversations explains what the chosen contact says and does. A generic contact (contact type 0) uses phone headers and phone scripts; a special contact uses its own selection logic.
  4. Trainer rematches and gifts after calls and rematches explain how battles are selected and items are awarded.

Later sections describe saved phone state, illustrate the system through case studies, and give example edits. Expansion sections cover rematch tiers, queued event calls, and additional contacts.

For concrete walkthroughs of these systems working together, start with the case studies.

Field scripts and game code​

Field scripts control NPC dialogue, command arguments and branches; these can be edited in DSPRE. Script commands invoke compiled game code: their internal checks and side effects require a code patch when their arguments cannot express the desired change. The phone system also runs independently, using compiled code and editable tables to select callers and conversations.

The guide's phone scripts are conversation records read by that system, not field scripts. Editing a record changes its messages and effect; changing how that effect works requires editing the code that reads it.

Data structure​

The following table maps the phone data and code.

ComponentLocationRole
Contact recordstel/pmtel_book.dat75 contacts with their contact type, trainer battle, map, item, local-call phone script, schedule, and random-call group.
Contact text-archive lookupARM9 0x10847C-0x108511One message-archive ID for each contact ID; archive message 0 is the contact name.
Conversation dataOverlay 101 0x1143C-0x13B6BGeneric phone headers, plus phone-script and greeting tables also used by some special contacts.
Contact-specific conversation codeOverlay 101 0xB0A4-0xCD3FSpecial-contact selectors and display routines, with generic-call code interleaved. See the decomp routines.
Queued system-event definitionsOverlay 2 0xE104-0xE151Caller, phone-script ID, and forced-pickup setting for the 13 queued triggers.
Rematch battle lookupOverlay 26 0x20C-0x4FFSix battle IDs for each of 63 ordinary-trainer or Gym Leader rematch rows.
Saved phone stateSave dataRegistered-contact order; 75 per-contact rematch and phone-call-gift records; Mom's five-item purchase queue; random-caller history; and queued event triggers.

Phonebook data​

Research: pokeheartgold: phonebook reader, phone-contact structures, time-of-day conversion.

The ROM file is a direct NitroFS file: tel/pmtel_book.dat. It is not a NARC member.

Graphics​

See the sprite-location reference for Pokégear UI graphics and Pokégear phone graphics.

File layout​

The first four bytes are a little-endian entry count (75). They are followed by 20-byte contact records for each entry.

OffsetSize (bytes)Decomp fieldMeaning
001idContact ID (PHONE_CONTACT_*).
011typeContact type. It chooses the contact's call-selection route: generic headers for type 0, or specialised logic for the other values; see Contact type values.
021unk2Unknown. There is no known consumer of this byte.
031trainerClassTitle label shown in the Pokégear contact list. Standard trainer classes and special phone-contact labels use different text paths; see Title.
042trainerIdThe contact's original trainer battle ID, or TRAINER_NONE (0) for a non-trainer. See the rematch battle table for team selection and gifts for the separate item paths.
062mapIdThe contact's map-header ID. It controls local-call behaviour, random-call filtering, location text, and the limited rematch/gift map marker; see What mapId controls.
082giftRematch reward item. Awarded after the rematch battle by the shared NPC field-script path.
0A2phoneScriptIfLocalGeneric contact's local-call phone-script ID: used for an outgoing call when the player is on this contact's mapId.
0C1unkCGreeting-set index. Values 0-7 select a row from the shared phone-greeting table; FF suppresses the greeting.
0D1rematchWeekday0 to 6 (Sunday to Saturday); 7 prevents a match, i.e. no outgoing rematch call can occur. Used by outgoing rematch schedule checks; see Rematch availability conditions.
0E1rematchTimeOfDay0 Morning (04:00-09:59), 1 Daytime (10:00-19:59), 2 Night (20:00-03:59); 3 prevents a match, i.e. no outgoing rematch call can occur. Used by outgoing rematch schedule checks; see Rematch availability conditions.
0F1unkFRandom incoming-call group. The game chooses group 0 (50% of the time), group 1 (30% of the time), and group 2 (20% of the time).
101sortParam[0]Stored Pokégear title-sort rank.
111sortParam[1]Stored Pokégear alphabetical-sort rank.
121sortParam[2]Stored Pokégear location-sort rank.
131sortParam[3]Padding (00 in vanilla).
caution

The entry count controls only how many 20-byte records the file loader reads. Raising it does not create a usable new contact; the phone system has a hardcoded 75-contact limit. See Expanding beyond 75 contacts for the coordinated work a real expansion needs.

Vanilla phonebook records

Values from tel/pmtel_book.dat, in file order. Record offsets are hexadecimal; other numbers are decimal. Weekdays and times use the labels above; “Unused” denotes weekday 7 or time 3. Names are reader labels, not stored in this file. The omitted unk2 and padding bytes are 0 in all 75 records.

Contact IDNameRecord offsetTypeTitleTrainer battle IDMap-header IDRematch rewardLocal phone scriptGreeting setRematch scheduleRandom-call group
0Mother0x41200-63-23255Unused0 (50%)
1Prof. Elm0x182201-61-1255Unused0 (50%)
2Prof. Oak0x2C3201-505-68255Unused1 (30%)
3Ethan0x4011202-384-101255Unused0 (50%)
4Lyra0x5411202-384-102255Unused0 (50%)
5Kurt0x684203-164-83255Unused1 (30%)
6Day-Care Man0x7C8204-331-94255Unused0 (50%)
7Day-Care Lady0x909204-331-97255Unused0 (50%)
8Buena0xA410205-186-98255Unused1 (30%)
9Bill0xB87206-203-922Unused2 (20%)
10Joey0xCC02834HP Up290Monday Day1 (30%)
11Ralph0xE00115736-464Wednesday Morning0 (50%)
12Liz0xF4052736-537Thursday Day0 (50%)
13Wade0x10806435-360Tuesday Night2 (20%)
14Anthony0x11C096137-614Friday Night0 (50%)
15Bike Shop0x1305205-182-84255Unused1 (30%)
16Kenji0x1446141747PP Up863Unused0 (50%)
17Whitney0x158127030398-175255Saturday Day2 (20%)
18Falkner0x16C126620398-103255Saturday Morning2 (20%)
19Jack0x18006017896-1040Monday Morning0 (50%)
20Chad0x19406039742-1120Friday Morning0 (50%)
21Brent0x1A806813145-1204Monday Morning0 (50%)
22Todd0x1BC046638-1280Saturday Morning0 (50%)
23Arnie0x1D0067839-1340Tuesday Morning0 (50%)
24Baoba0x1E413207-173-140255Unused1 (30%)
25Irwin0x1F81431739-155255Unused0 (50%)
26Janine0x20C12106257398-176255Monday Day2 (20%)
27Clair0x220127635398-177255Friday Night2 (20%)
28Erika0x23412105256398-178255Sunday Morning2 (20%)
29Misty0x24812103254398-179255Wednesday Morning2 (20%)
30Blaine0x25C12108259398-180255Tuesday Day2 (20%)
31Blue0x27012110261398-181255Sunday Night2 (20%)
32Chuck0x284127534398-182255Wednesday Night2 (20%)
33Brock0x2981298253398-183255Saturday Night2 (20%)
34Bugsy0x2AC126721398-184255Thursday Day2 (20%)
35Sabrina0x2C012107258398-185255Sunday Day2 (20%)
36Lt. Surge0x2D412104255398-186255Friday Morning2 (20%)
37Morty0x2E8127231398-187255Tuesday Night2 (20%)
38Jasmine0x2FC127433398-188255Wednesday Day2 (20%)
39Pryce0x310127332398-189255Monday Morning2 (20%)
40Huey0x324046211220Protein1904Wednesday Night1 (30%)
41Gaven0x33802410230-1960Thursday Morning1 (30%)
42Jamie0x34C02511330-2035Friday Day1 (30%)
43Reena0x36002511431-2101Sunday Morning1 (30%)
44Vance0x37406913746Carbos2170Wednesday Night1 (30%)
45Parry0x3880914547Iron2234Friday Day1 (30%)
46Erin0x39C0515148Calcium2295Saturday Night1 (30%)
47Beverly0x3B002118296-2365Unused2 (20%)
48Jose0x3C406941431-2424Saturday Night2 (20%)
49Gina0x3D8056538-2511Sunday Day2 (20%)
50Alan0x3EC0602440-2600Wednesday Day2 (20%)
51Dana0x4000340042-2687Thursday Night2 (20%)
52Derek0x4140204443-2760Unused2 (20%)
53Tully0x42801112344-2834Sunday Day2 (20%)
54Tiffany0x43C0540245-2917Tuesday Day2 (20%)
55Wilton0x45001112446-3004Thursday Morning2 (20%)
56Krise0x4640318496-3081Sunday Morning1 (30%)
57Ian0x478026438Cheri Berry*3150Saturday Morning0 (50%)
58Walt0x48C06438839-3224Monday Day2 (20%)
59Alfred0x4A0034401220-3306Tuesday Day2 (20%)
60Doug0x4B40614010-3370Wednesday Morning1 (30%)
61Rob0x4C8064810-3460Friday Morning1 (30%)
62Kyle0x4DC0115920-3550Wednesday Day2 (20%)
63Kyler0x4F001155820-3620Thursday Day2 (20%)
64Tim & Sue0x504012255921-3695Friday Day2 (20%)
65Kenny0x5180935821-3764Saturday Day2 (20%)
66Tanner0x52C0456121-3830Monday Night2 (20%)
67Josh0x54006956522-3920Tuesday Night2 (20%)
68Torin0x55406056722-4010Wednesday Night1 (30%)
69Hillary0x56807738223-4087Thursday Night0 (50%)
70Billy0x57C06033123-4160Friday Night0 (50%)
71Kay & Tia0x5900856923-4217Saturday Night2 (20%)
72Reese0x5A406531325-4304Sunday Night2 (20%)
73Aiden0x5B806557425-4394Monday Morning2 (20%)
74Ernest0x5CC06557925-4484Sunday Day1 (30%)

* Ian receives a random berry; see the rematch-reward berry special case.

Contact type values​

Research: pokeheartgold: contact-type call dispatcher, contact-type constants.

type is a numeric contact-type selector, not a trainer class and not a random-call frequency. It selects the contact's call-selection route; it does not directly identify one display routine. The vanilla values are:

Click for details...
ValueDecomp nameContacts / effect
0GENERIC45 contacts (60% of the phonebook). Uses generic phone-header and phone-script tables.
1MOMMom's savings and gift-queue logic.
2PROF_ELMElm's story-flag, badge, Egg, and Pokérus logic.
3PROF_OAKOak's dedicated call logic.
4KURTKurt's dedicated call logic.
5BIKE_SHOPBike Shop call logic.
6KENJIBlack Belt Kenji call logic.
7BILLBill call logic.
8DAYCAREMANDay-Care Man call logic.
9DAYCARELADYDay-Care Lady call logic.
10BUENABuena call logic.
11ETHAN_LYRAChildhood-friend call logic.
12GYMLEADERFighting Dojo/Gym Leader rematch logic.
13BAOBASafari Zone Warden call logic.
14IRWINJuggler Irwin call logic.
15UNK15Unused in vanilla; defaults to display type 0 and phone script 0.

Changing this byte changes which selection route reads the contact. For example, changing an ordinary trainer from 0 to 12 does not create a Gym Leader rematch: the Gym Leader logic expects Gym Leader message layouts and Fighting Dojo map, event & script state.

Title​

Research: pokeheartgold: phone contact-list display.

The title label in the phone list comes from the normal trainerClass text archive, from archive 271, or is empty.

title (trainerClass in decomp) range/valueSource of the displayed label
0-199Normal trainer-class formatter. Vanilla class-name data is populated only through class 128; a hack using 129-199 must also supply normal class-name text.
200 (PHONE_MOM)Empty label. Mom displays no title.
201-207Text archive 271, message used = trainerClass value - 163.

The special values are:

  • 201 Pokémon Professor (message 38)
  • 202 Childhood Friend (message 39)
  • 203 Poké Ball Creator (message 40)
  • 204 Day-Care (message 41)
  • 205 Radio Personality (message 42)
  • 206 Poké Maniac (message 43)
  • 207 Safari Warden (message 44)

The contact name comes from message 0 of that contact's own phone text archive.

Compatibility with expanded trainer classes​

Click for details...

The phone UI selects title text by value:

if trainerClass == 200:
show no title
else if trainerClass >= 201:
show message trainerClass - 163 from archive 271
else:
show the normal trainer-class name

For values 201-255, duplicate the desired title into archive 271 at message trainerClass - 163. This also changes the title of any other contact using that value. For example, class 210 reads message 47. Value 200 always displays no title: use another phonebook title value or patch the display logic.

The one-byte field cannot hold a value above 255; exceeding that limit requires changing the record format and its readers.

What mapId controls​

Research: pokeheartgold: generic call display and encounter selection, incoming-call filtering.

mapId has several proven uses:

  • Supplies the contact location name for conversation text; see Text substitutions.
  • Random incoming calls exclude a contact when the player is on the same mapId.
  • For outgoing calls, most special-contact logic and the generic logic use a same-map check to select their "local" response.
  • Supplies the wild-encounter data used for Pokémon names in generic conversations; see Text substitutions.
  • If the contact's map-header ID is exactly 96 (0x60, MAP_NATIONAL_PARK), the random incoming-call manager excludes that contact when flag 0x996 (2454, decomp name: FLAG_UNK_996) is set. The decomp calls its direct helper Save_VarsFlags_CheckBugContestFlag. The generic rematch/gift header conditions use the same check.
  • The Pokégear map shows its pending battle marker when a generic contact (type 0) at that mapId has either a valid ordinary rematch or a queued phone-call gift.

Sorting phone numbers​

Research: pokeheartgold: phone-list sorting and saved order.

There are a number of ways of sorting phone numbers in the Pokégear. The first three use a stored one-byte rank in each contact record. The ordering is not derived or recalculated from displayed text or mapId at runtime, so changes to titles, names, and locations require changes to these sort parameters as well.

  • Title (sortParam[0])
  • Alphabet (sortParam[1])
  • Location (sortParam[2])
  • Manual arrangement

The selected rank determines the displayed order, then the Pokégear saves that resulting contact-ID order when it closes. See Registered contacts for the saved list and its layout.

Hex-editing notes​

For binary hacking, extract and edit this file directly
  1. Extract or open the direct NitroFS file tel/pmtel_book.dat.
  2. Read the 32-bit little-endian count at 0x0.
  3. Contact record n starts at 0x4 + (n * 0x14).
  4. Use the table in Phonebook data for field offsets.
  5. Keep the record count and record size unchanged unless you also understand every contact-ID-indexed table in the game.

For example, record-relative offset 0xA is the two-byte local-call phone-script ID. Record-relative offset 0xF is the random-call group. All multi-byte values are little-endian.

Registering phone numbers​

Research: pokeheartgold: phone-related field commands, DSPRE HGSS script-command reference.

The static phonebook table does not immediately and fully populate contacts in the player's Pokégear. The player’s registered contact IDs are saved separately; see Registered contacts.

Normal field scripts use the following command IDs. The first name is the established scrcmd/DSPRE name; the second is the current decomp name for the same command.

Opcodescrcmd / editor nameDecomp nameUse
0x92RecordPokegearNumber contactRegisterGearNumber contactAdd a valid contact ID to the player's phonebook.
0x93CheckPokegearNumberRegistered contact resultCheckRegisteredPhoneNumber contact resultWrite 0 or 1 depending on registration state.
info

The phonebook can hold every available contact. There is no dedicated vanilla field-script command to de-register a contact.


Incoming and outgoing calls​

Research: pokeheartgold: phone ring manager and queued-event table, map-header phone permissions.

Incoming calls start in three ways:

  • Field-script calls start from a scripted event, such as entering a map or speaking to an NPC.
  • Random incoming calls provide recurring conversations, rematches and gifts, subject to conditions including story progress.
  • Queued event calls follow a recorded event, such as Elm's Egg hatching, without requiring a field script on the player's current map. They wait until incoming calls are permitted.

Incoming and outgoing calls use different map permissions and different dialogue selection paths.

DirectionDecomp functionWhat it controls
OutgoingMapHeader_CanPlacePhoneCallsWhether the player can successfully start a call from the Pokégear.
IncomingMapHeader_CanReceivePhoneCallsWhether random callers and queued event calls can ring on the current map.

These are independent one-bit fields in the map header. A map can permit outgoing calls while blocking incoming calls. DSPRE's map-header editor can be used to set or clear these independently.

The call-mode field (isScriptedCall in decomp) uses 0 for normal outgoing and random incoming calls, 2 for special field-script calls, and 3 for queued event calls; direction is stored separately.

Outgoing​

An outgoing call begins when the player selects a registered contact in the Pokégear. Outgoing calls must be enabled in the current map header. The selected contact's type, mapId, and, for contacts of type 0, the generic outgoing phone headers determine the conversation.

Incoming: time trigger​

Research: pokeheartgold: incoming-call timer and trigger scheduler, pokeheartgold: random-caller selection, recent-caller save helpers.

The game keeps a runtime counter of elapsed real-time minutes for incoming calls. This timing gate is shared by queued system-event calls and ordinary random calls. While the player is in the normal overworld and no field task is running, completed minutes are added to this counter. At 10 minutes, the next normal input update when the player is standing still or has finished a movement checks for a call. It is not based on steps, frames, or a random per-step chance.

Queued system-event calls are checked first. Their triggering code can set the counter to one minute below the current threshold, making the queued call eligible after the next completed minute; this uses the threshold dynamically. A map which disallows incoming calls does not clear the counter; the check instead waits until the player reaches an allowed map. The timer is runtime state, so it is reset when a call is accepted or otherwise cleared.

Disable random calls from one contact

Set the contact's unkF byte (record offset 0xF in pmtel_book.dat) to 3. Only groups 0-2 are selected, so this contact never enters the random-caller pool. Outgoing, queued-event and direct field-script calls are unaffected.

The call starts with isScriptedCall = 0. A contact of type 0 uses the generic call-data route; contact types 10, 11, 12, and 14 each use their own selection logic.

Changing the random-call chance​

In arm9/arm9.bin, replace 32 20 at both 0x92DBA (initialisation) and 0x92F9A (reset) with NN 20, where NN is the desired percentage minus one, expressed in hexadecimal.

For example, 18 20 gives 25%, 31 20 gives 50%, and 63 20 gives 100%. 00 20 still gives 1%, so this edit cannot disable random calls entirely.

This changes the chance of proceeding to random caller selection at each eligible timed opportunity. Queued event calls are unaffected.

Where the allowed-type list is defined​

Click for details...

The five allowed-type comparisons begin at Overlay 2 file offset 0xC4F8 (RAM 0x2252078):

type == 0 || type == 12 || type == 11 || type == 10 || type == 14

These Thumb comparisons must be patched to allow another contact type.

What "recently called" means​

Click for details...

Each unkF group remembers recent callers. Before applying map, recent-caller, Buena and Bug-Catching Contest exclusions, the game counts registered contacts in the selected group whose types are allowed. If this nonzero count equals the number of stored recent callers, it clears that group's history. An empty final candidate pool does not itself clear the history or restart selection.

Only answering an ordinary random incoming call adds its caller to the history. Queued event and field-scripted calls do not use it.

See Random-caller history for the saved layout.

Changing the shared incoming-call threshold​

Binary edits

The vanilla ten-minute interval can be changed with two ARM9 binary edits. Both values must be changed to the same whole-minute value N (1-255).

ARM9 file offsetRAM addressVanilla bytesMeaningChange for N minutes
0x92DB20x2092DB20A 20Sets the call interval to 10 minutes.Replace 0A with N; retain 20.
0x92E440x2092E440A 29Compares the first elapsed-time update against 10 minutes.Replace 0A with N; retain 29.

For example, to use twenty minutes, change 0A 20 to 14 20 at 0x92DB2 and 0A 29 to 14 29 at 0x92E44. The second edit keeps the first-update safeguard consistent with the interval. A queued trigger which sets the timer to one minute below the threshold still becomes eligible after one completed minute, because it uses the changed threshold value dynamically; a queued trigger which does not expedite itself waits for the shared threshold.


Incoming: queued system-event trigger​

Research: pokeheartgold: queued-event table and ring manager, queued-trigger constants.

A queued event records a call for the next permitted timed check. Each trigger selects a caller, conversation and pickup behaviour.

The 13 trigger IDs (0-12) are bits in a separate two-byte saved field, rather than normal script flags or variables.

In vanilla, native game code sets these bits when it detects its own condition, such as an Egg hatching, cycling 1,024 steps, or a full PC. Field scripts can also set one with command ScrCmd_148 (0x94): it takes two bytes, triggerId (0-12) and expedite (0 or nonzero). It sets that trigger bit; when expedite is nonzero, it advances the shared incoming-call timer to one minute before its threshold if necessary. Command UnsetPhoneCallTrigger (0x95) takes one triggerId byte and clears that bit.

The caller, predefined phone script, and pickup behaviour come from a 13-record table at Overlay 2 file offsets 0xE104-0xE151 (decomp: ov02_02253C84). Record n is the definition for trigger bit n; its file offset is 0xE104 + (n * 6).

callerId (u8), unknown (u8), phoneScriptId (u16 little-endian), forcePickUp (u8), unknown (u8)
Phone-script selection

The contact's code interprets the supplied phone-script ID. For triggers 4 and 5, Oak and the Day-Care Man ignore it and select scripts from Pokédex progress or an Egg-call flag respectively. For trigger 6, Baoba interprets 0 as his specialised Safari Zone conversation, which chooses dialogue from the saved list of changed areas. Changing this field therefore cannot universally force a particular phone script.

warning

Although stored as two bytes, phoneScriptId is truncated to one byte when passed to the call manager: only values 0-255 survive unchanged. Higher IDs require widening that interface and its stored fields.

Vanilla system-event triggers
BitFile offsetTrigger IDCaller IDPhone script IDCondition that queues itForced Pickup
00xE104ELM_EGG_HATCHED1 Elm13The gift Togepi Egg hatches.No
10xE10AELM_POKERUS1 Elm7Pokérus is discovered.No
20xE110BIKE_SHOP_STEPS15 Bike Shop851,024 bicycling steps, before the Bike Shop call flag is set.Yes
30xE116BILL_PC_FULL9 Bill93Every PC storage slot is full; the one-time Bill condition allows it.Yes
40xE11COAK_DEX_PROGRESS2 Oak0A National Dex ownership milestone is reached before its acknowledgement flag is set.No
50xE122DAYCARE_HAS_EGG6 Day-Care Man0An egg is available and the Day-Care call flags allow it.No
60xE128BAOBA_NEW_POKEMON24 Baoba0Safari Zone encounters change after the daily object-level update.No
70xE12EBAOBA_NEXT_TEST24 Baoba142The timer permits the next-test invitation (second challenge; see dialogue context below).Yes
80xE134BAOBA_OBJECT_ARRANGEMENT24 Baoba143The timer permits the Object Arrangement introduction.Yes
90xE13ABAOBA_MORE_OBJECTS24 Baoba144The timer permits another batch of objects.Yes
100xE140BAOBA_EVEN_MORE_OBJECTS24 Baoba145The timer permits the final batch of objects.Yes
110xE146BAOBA_MEMORY_LOSS24 Baoba146Inferred failsafe at the play-time limit: combined Object Arrangement/new-objects announcement.Yes
120xE14CMOM_BOUGHT_SOMETHING0 Mom27Mom spends the player's saved money on an item.No

Pending events exclude callers on the player's map header, except the Day-Care Man, whose number must be registered instead. If several events remain eligible, one is chosen randomly.

When a set trigger is selected, the ring manager reads its matching table record, assigns the caller and phoneScriptId, and marks the call as an event call (isScriptedCall = 3). The forcePickUp byte decides what happens next:

forcePickUpResult
0 (No)The phone rings normally; the player can answer or ignore it.
1 (Yes)The game begins the call immediately. The player does not get a normal opportunity to ignore the ring.

Both unknown bytes are 00 in every record; their purpose is not known.

An unanswered ring times out after about 30 seconds. Battles, map transitions and most menu actions cancel it; opening the Start menu or selecting Save or Pokégear does not. Cancellation resets the timer but preserves the trigger bit, allowing a later call unless another script or game condition clears it. Answering clears the bit when the phone application opens.

caution

The bytes after the queued-event table are occupied. Adding a record would require table relocation and code changes; see Expanding queued event calls.

Vanilla trigger setters (decomp references)​
Click for details...

Research: pokeheartgold: trigger scheduling, queued-event definitions.

The event-record table above defines what each pending bit does. This table instead records every vanilla path which sets a bit. It is a source map for advanced edits: most paths call sub_02092E14, which sets the persistent bit and, when its final argument is true, advances the shared incoming-call timer. Bit 1 is set by a field script, and bit 6 writes the persistent bit directly.

BitVanilla setter and conditionExpedites the incoming timer?
0sub_02093134 in src/unk_02092BE8.c, called by src/hatch_egg_task.c after an egg hatches. It sets the bit only when MonIsFromTogepiEgg identifies the special Elm Egg.Yes
1The shared Nurse Joy field script, files/fielddata/script/scr_seq/scr_seq_0003.s, uses ScrCmd_148 CALL_TRIGGER_ELM_POKERUS, FALSE when it first detects Pokérus after healing.No
2FieldSystem_UpdateBikeShop in src/field/field_control.c: the Bike Shop call has not already happened, bit 2 is not already pending, and GAME_STAT_STEPS_BIKED is at least 1024.Yes
3sub_02093070 in src/unk_02092BE8.c: Bill is registered, the full-PC call flag is clear, and every PC storage slot is full. This helper is called after several battle and storage-related return paths.Yes
4sub_020930C4 in src/unk_02092BE8.c: Oak is registered, at least 50 Pokémon are owned in the National Dex, and the acknowledgement flag for the highest reached 50-Pokémon milestone (capped at 450) is clear.No
5sub_0209316C in src/unk_02092BE8.c, called when the Day-Care generates an Egg in src/get_egg.c: the Day-Care Man is registered, and the script-flag guard permits the Egg call.Yes
6SaveData_SafariZone_CheckAreasWithUpdatedEncounters in src/unk_02097268.c: after at least one day has passed outside an active Safari session, it compares the Safari Zone's encounter lists before and after the daily object-level update. It sets bit 6 if an area now has changed encounters, and clears it when none do.No
7sub_02092E54 in src/unk_02092BE8.c: no Baoba bits 7-11 are already pending, Safari progress variable 0x4057 (16471, decomp name: VAR_UNK_4057) is 3, and the Safari Zone's three-hour timer has elapsed.Yes
8sub_02092E54: Safari progress is at least 6, the player has the National Dex, the three-hour timer reports its ordinary elapsed state, and the Safari object-unlock level is 0.Yes
9sub_02092E54: the same post-National-Dex three-hour branch, with object-unlock level 1 or 2.Yes
10sub_02092E54: the same branch, with object-unlock level 3; also selected at that level by the play-time-limit condition below.Yes
11sub_02092E54: Safari progress is at least 6, the National Dex is obtained, object-unlock level is below 3, and sub_0202F798 returns 2: play time is at least 59,999 minutes (999:59), but fewer than three hours have elapsed since the stored Safari timestamp. No Baoba trigger 7-11 may already be pending.Yes
12src/battle/battle_setup.c calls MomGift_TryEnqueueGiftOnBalanceChange after Mom's savings balance changes. If that helper successfully queues a purchase, it sets bit 12. The purchase and its quantity are stored in Mom's separate gift queue; see Mom's purchases for item collection.Yes

VAR_UNK_4057 is a normal script variable, separate from the queued-call bits. Baoba's outgoing dialogue associates value 3 with waiting for the second challenge, 5 with catching Sandshrew, and 6 with waiting for a new activity. These story labels are supported by archive 667's dialogue and community progression descriptions, but aren't directly traced from game code.

Baoba's call logic uses archive 667 messages 4-13 for triggers 7-11 (successive male/female pairs). Trigger 6 instead uses messages 14-23 to name one to five changed areas through buffers 10-14, messages 24-25 for six or more areas without listing names, or 38-39 if the stored list is empty.

The Safari timer checks the normal three-hour interval before the play-time limit. Trigger 11 advances object-unlock level to 4: an inferred failsafe against stalled unlocks at the play-time cap, not verified in-game.


Incoming: field-script trigger​

Research: pokeheartgold: SetPhoneCall and RunPhoneCall.

Not every incoming call uses the queued trigger-bit table. A normal field script can configure and immediately launch a phone call with these commands. Elm's stolen-Pokémon call is a vanilla direct field-scripted call: it selects PHONE_SCRIPT_002 and does not set or consume any queued event-trigger bit.

Opcodescrcmd / editor nameSource nameUse
0x1AESetPhoneCall contact scriptedFlag predefinedScriptSetPhoneCallConfigure a field-scripted phone call.
0x1AFRunPhoneCallRunPhoneCallLaunch the configured phone call.
info

SetPhoneCall can select any valid contact, but cannot universally force a particular phone script. The contact's selection logic interprets scriptedFlag (call mode) and predefinedScript (phone script ID). With call mode 2, Elm accepts indices 0-4 for scripts 2-6; Mom starts her savings conversation, Oak selects script 82, and Baoba selects script 141.

predefinedScript is also limited to 0-255 by the call manager.

Generic contacts ignore the supplied script value and use their incoming phone headers if SetPhoneCall [contactId] 2 0, followed by RunPhoneCall were used.

Starting a call on map entry​

Use a Variable/Value level-script trigger for the call. Map-initialisation scripts cannot run the waiting commands and common-script sequence required.

The trigger can check a story variable, or an unused map-cleared temporary variable (0x4000-0x401F) against 0. Change that variable in the event script so the trigger stops matching. A persistent flag can prevent the call on later visits; the 0x8000 script variables are not suitable for this level-trigger condition.

Use ScrCmd_609 (0x261, legacy name MecScript) to reset the following Pokémon's movement before the phone call commands. Set 0x8004 to the contact, 0x8005 to the call mode and 0x8006 to the predefined script, then use CallStd 2039 for ringing, fades and the call. See the Elm example.


Phone conversations​

Research: pokeheartgold: phone-call dispatch and effects.

A phone conversation is the interaction shown to the player. Its messages and effects come from a phone-script record or specialised call code.

  • Generic contacts (type 0; 45 of the 75 contacts) use phone headers to select phone scripts. Their conversations are linear, with no Yes/No choices.
  • Special contacts (all other types) use their own selection code and may reuse phone scripts. Some conversations are interactive: Mom can ask about savings, and Gym Leaders can ask whether to arrange a rematch.

Special-contact conditions are defined in the phone scripts source directory. The sections below cover Professor Elm and all 16 Gym Leaders.

Conversation selection and display run in the phone application’s compiled code. A field script can launch the call, but does not perform the phone-header checks or apply the phone-script effect itself.

Phone conversations: the four parts​

Research: pokeheartgold: generic phone headers and greetings, phone-script definitions, generic call selection.

The same four parts explain generic and special-contact conversations:

PartPurposeHow it works
Conversation selectionChooses what the contact will discuss.Generic contacts use phone headers, or their local-call phone script. Special contacts use type-specific code. Queued and field-script calls can supply a script ID or selection index.
Messages and effectsDetermines dialogue, choices and changes to game state.A phone-script record supplies message IDs and an optional automatic effect, or specialised code controls the conversation.
Greeting selection (optional)Selects a separate opening remark.Calls using the shared greeting routine select from the greeting table. Other conversations can include their greeting in their own text.
Dialogue textSupplies the displayed words, including substitutions.The contact's text archive supplies its messages; shared greetings use archive 0640.

For calls using the basic phone-script display routine, the automatic effect is applied first, followed by any shared greeting and the main message.

Phone headers: selecting a conversation​

Research: pokeheartgold: generic phone headers, generic header conditions and selection.

Every contact has 16 six-byte phone-header slots: eight incoming and eight outgoing, regardless of contact type. The table occupies Overlay 101 offsets 0x11F4C-0x13B6B. Only the generic contact route (type 0) uses these headers to select a conversation; special-contact logic uses its own selection route.

For contact ID c, the outgoing block begins at 0x11F4C + (c × 0x60) and the incoming block at 0x11F7C + (c × 0x60). Each block holds eight six-byte slots; add slot × 6 for slot 0-7.

Each slot has this layout:

byte 0: condition type
byte 1: chance value
bytes 2-3: `scriptType` - selects the code which displays the selected phone script
bytes 4-5: little-endian phone-script ID

The generic selector checks up to eight slots for the current direction, in order. Unused slots use NIL (00 64 00 00 00 00), a terminator with unused 100%-chance/script-0 fields, or NONE (FF 00 00 00 00 00), a zeroed placeholder. An outgoing call made while the player is on the contact's own mapId bypasses those outgoing slots. It forces scriptType to 0 and uses the contact record's phoneScriptIfLocal value as the phone-script ID.

Phone-header condition types​

The first byte of a phone header determines whether its phone script is eligible. Where a condition reaches its final chance test, it makes a random roll from 0 through 99 and succeeds when the result is less than or equal to the header's chance byte. Thus chance 100 always succeeds, while values 0-99 succeed 1%-100% of the time.

Click for details...
ByteDecomp nameHeader is eligible when...
00NILStops the current group of up to eight phone headers. Vanilla uses 00 64 00 00 00 00; the chance and phone-script fields are not read.
01RAND1Its chance roll succeeds. Identical to RAND6.
02FIGHTPOSTROCKETSNo rematch is pending and no phone-call gift is queued (PhoneRematch.seeking and PhoneRematch.giftItem are clear); if this header uses scriptType 0 and selects a REMATCH phone script, flag 0xC6 (198, decomp name: FLAG_BEAT_RADIO_TOWER_ROCKETS) is set; then its chance roll succeeds.
03POSTROCKETWEEKTIMEFLAG_BEAT_RADIO_TOWER_ROCKETS (0xC6) is set, the contact's weekday (rematchWeekday) and time-of-day (rematchTimeOfDay) fields match the current time, and its chance roll succeeds.
04BUGCONTESTDAYSThe current RTC weekday is Tuesday, Thursday, or Saturday, and its chance roll succeeds. The Bug-Catching Contest need not be active.
05DURINGROCKETSScript variable 0x4077 (16503, decomp name: VAR_SCENE_ROCKET_TAKEOVER) is 2, 3, or 4, and its chance roll succeeds.
06RAND6Its chance roll succeeds. Identical to RAND1.
07FIGHTPOSTROCKETSNOTBUGCONTESTFLAG_BEAT_RADIO_TOWER_ROCKETS (0xC6) is set; a rematch is already pending (PhoneRematch.seeking is set); either the contact's mapId is not National Park or FLAG_UNK_996 (0x996) is clear; then its chance roll succeeds.
08GIFTNOTBUGCONTESTA phone-call gift is already queued (PhoneRematch.giftItem is set); either the contact's mapId is not National Park or FLAG_UNK_996 (0x996) is clear; then its chance roll succeeds.
FFNONEStops the current group of up to eight phone headers. Vanilla uses FF 00 00 00 00 00 for unused slots.

NIL and NONE stop the scan. If no header passes, the selector uses the last tested header even though its condition failed; an initial terminator returns script 0. Keep an unconditional final candidate when editing headers.

scriptType is unrelated to the contact type and to the result stored in the phone script. For generic phone headers, vanilla uses these three values:

Click for details...
scriptTypeWhat the selected code does
0Applies the record's automatic effect, prints the greeting, then prints the record's gender-specific message.
1Does the same, but first prepares a random Pokémon from the caller's trainer party and a random wild Pokémon from the caller's map for text substitutions.
2Does the same, but randomly chooses one of eleven consecutive message variants before printing it.

The field is a direct index into the game's table of call code. It is not another contact category; special-contact selection logic can select other values from that same table.

Phone-header binary reference

The generic selector is PhoneCall_GetScriptId_Generic. The generic display-code pointers for scriptType 0, 1, and 2 are in the Overlay 101 dispatch table at file offset 0x10F3C; they point to RAM addresses 0x21F2681, 0x21F2F51, and 0x21F2FFD respectively.

Phone scripts: message and automatic effect​

Research: pokeheartgold: phone-script definitions, phone-script lookup and automatic effects.

A phone-script record is six bytes; the table occupies Overlay 101 offsets 0x1143C-0x11EEB. Generic contacts and some special contacts use these records. The first two bytes select messages for male and female players in the caller's archive; the remaining bytes describe an optional automatic effect.

byte 0: message ID for a male player
byte 1: message ID for a female player
bytes 2-3: little-endian word: low 4 bits = result value; upper 12 bits = parameter 0
bytes 4-5: little-endian parameter 1

The packed word is (parameter 0 × 16) + result; parameter 0 therefore ranges from 0 to 4095. Parameter 1 is a separate 16-bit value. Their meanings below are established by PhoneCall_ApplyGenericNPCcallSideEffect; the vanilla column counts records in the table, not necessarily reachable conversations.

Result / decomp nameEffectParameter 0Parameter 1Vanilla records
0 / NONEDialogue only.Ignored.Ignored.382; both parameters are 0.
1 / UNK1Sets or clears a script flag.0: clear; nonzero: set.Flag ID.None.
2 / FLAGSets or clears a script flag.0: clear; nonzero: set.Flag ID.12; only used to set flags.
3 / REMATCHSets the caller's pending-rematch state.Ignored; it does not select a tier or enable/disable the effect.Ignored.43; parameters are 1, 0.
4 / ITEMQueues a phone-call gift.Ignored.Item ID; see the gift special cases. Item 0 clears the queued gift.17; parameter 0 is always 1.
5 / WORDChooses text from the caller's archive and inserts it into message buffer 4.Number of consecutive messages to choose from; must be greater than 0.First message ID in that range.Two: script 59 and 296.

For WORD, the main dialogue must reference buffer 4 to show the chosen text, and every message in the selected range must exist. This selects a text substitution, not another phone-script record.

For example, Gina's Leaf Stone script 257 at Overlay 101 offset 0x11A42 is 0D 0D 14 00 55 00: message 13 for either player gender, result 4, parameter 0 = 1, and parameter 1 = 85 (0x55, Leaf Stone). The item ID occupies the last two bytes.

Reusing existing phone-script records​

The table has 456 records (IDs 0-455). Only script 0 is all zeroes; it is the shared PHONE_SCRIPT_NONE record, not a spare slot.

The following 15 populated records appear to have no vanilla selection path (phone headers, phonebook local-call IDs, queued events, field-script calls and special-contact selectors), they are possible candidates for reuse without enlarging the table.

Unreferenced records and Overlay 101 offsets
Original contactPhone-script ID (file offset)
Mom24 (0x114CC); 28 (0x114E4)
Liz54 (0x11580); 55 (0x11586)
Professor Oak78 (0x11610); 79 (0x11616)
Jack105 (0x116B2); 106 (0x116B8); 107 (0x116BE)
Chad113 (0x116E2); 114 (0x116E8); 115 (0x116EE)
Brent121 (0x11712); 122 (0x11718); 123 (0x1171E)

All contain message IDs with result NONE and both parameters 0. Be aware that any existing contact archive's messages may still be used by other conversation code. Supply message IDs from the intended caller's archive and select the reused record through that caller's phone headers or special-call logic.

Elm's script 6 is a separate case: his direct-call table references it, but no vanilla field script selects that table entry. It is therefore not included in the unreferenced list.

Greeting selection: selecting an opening remark​

Research: pokeheartgold: greeting table, greeting display code.

Calls using the shared greeting routine select an opening remark independently of the phone script. The Overlay 101 table occupies 0x11EEC-0x11F4B: eight rows of 12 one-byte message IDs. The contact record's unkC byte selects the row; row g begins at 0x11EEC + (g × 0xC). FF suppresses this separate greeting.

Each selected byte is a message ID in shared archive 0640. The 12 bytes in each row are arranged as follows:

Byte within rowCall directionTime of dayPlayer gender
00-01OutgoingMorningMale / female
02-03OutgoingDayMale / female
04-05OutgoingNightMale / female
06-07IncomingMorningMale / female
08-09IncomingDayMale / female
0A-0BIncomingNightMale / female

The table contains only rows 0-7. A generic contact can safely reuse one of those rows or use FF.

Dialogue: common greeting text and contact-specific text​

Research: pokeheartgold: phone text-archive mapping.

The greeting table uses shared archive 0640. For both generic and special contacts, an ARM9 lookup maps each contact ID to its caller-specific archive: 75 little-endian u16 archive IDs at 0x10847C-0x108511 (RAM 0x210847C-0x2108511, decomp's sPhoneMessageGmm table). The lookup has 75 entries and no count field; see contact expansion for adding entries.

The caller's contact ID indexes it directly: contact ID c reads the two-byte archive ID at 0x10847C + (c × 2). For example, contact ID 0 (Mom) contains 0x298, selecting archive 664; contact ID 1 (Elm) contains 0x2CC, selecting archive 716.

A phone script supplies a main-message ID, but that ID is always read from the current caller's archive. The same phone script can therefore show different wording when used by another contact. Changing text changes wording only; it does not change the condition or automatic effect which selected it.

Text substitutions​

Research: pokeheartgold: generic call display and encounter selection.

Conversation code prepares names in message buffers for dialogue to reference:

BufferText suppliedWhen prepared
2Player’s current location name.Conversation initialisation.
3Contact’s location name, from mapId.Conversation initialisation.
10A random Pokémon from the caller’s trainerId battle party.Generic display type 1 (scriptType = 1).
11A wild Pokémon species from the contact’s mapId.Generic display type 1.

Buffer 11 uses these rules:

  • Phonebook trainerClass = 11 (0xB, Fisherman): choose one of the five Good Rod slots, including the night-fishing replacement at night.
  • Other title values: choose one of the twelve land slots for the current morning/day/night.
  • No wild encounters on the map: use Rattata.

The Pokémon selections are implemented by GearPhoneCall_Generic and getRandomEncounterSlot in Overlay 101.

Special contacts​

This section includes some details on some of the special call logic (that doesn't use the generic flow). It isn't exhaustiive, but intends to provide an example of what that logic can look like.

Professor Elm: story calls and status calls​

Research: pokeheartgold: Professor Elm call logic, Route 30's direct call.

Click for details...

Elm is contact type 2, so he does not use generic phone headers. His selector has three routes:

Call routeHow the conversation is chosen
Direct field-script callCall mode 2 treats the supplied index as one of five fixed entries, selecting phone scripts 002-006. Vanilla map scripts use indices 0-3: the stolen-Pokémon call, the Egg collection call, the Team Rocket radio call, and a request to visit Elm's Lab. Index 4 is defined as another Lab request, but has no field-script use in the supplied source.
Queued incoming callThe queued-event record supplies the phone-script ID directly. This route includes the hatched-Egg call (013) and the Pokérus call (007).
Player's outgoing callThe selector walks the priority list below and returns the first matching phone script.

Elm's selector, PhoneCall_GetScriptId_ProfElm, starts at Overlay 101 offset 0xB2E8 (RAM 0x21F2A28).

All three routes use display handler 0, the ordinary phone-script display routine (GearPhoneCall_Simple at Overlay 101 offset 0xAF40). The direct-call and queued-call routes therefore choose an existing phone script; they do not use generic phone headers.

Outgoing calls: priority conditions and phone-script IDs

For an outgoing call, the first matching condition wins:

First matching conditionPhone scriptPurpose
Player is on Elm's map001Local-call conversation.
FLAG_GOT_ELMS_PANIC_CALL (0xEE, 238) is clear008Before the stolen-Pokémon call has happened.
FLAG_GAVE_RIVAL_NAME_TO_OFFICER (0x79, 121) is clear009Before the player names the rival.
FLAG_GOT_PICK_UP_EGG_CALL_FROM_ELM (0x9F, 159) is clear010Before Elm directs the player to collect the Egg.
FLAG_GOT_EGG_FROM_ELMS_ASSISTANT (0x70, 112) is clear011Before the player receives the Egg.
Fewer than seven badges; FLAG_SYS_HATCHED_TOGEPI_EGG (0x983, 2435) is clear012Egg has not hatched.
Fewer than seven badges; Egg hatched; FLAG_GOT_EVERSTONE_FROM_ELM (0x11A, 282) is clear013Egg has hatched, before Elm gives the Everstone.
Fewer than seven badges; Egg hatched; Everstone flag set014 or 015Random ordinary conversation.
VAR_SCENE_ROCKET_TAKEOVER (0x4077, 16503) is 2-4016Radio Tower takeover.
Seven badges017Before the eighth badge.
FLAG_GAME_CLEAR (0x964, 2404) is clear018Before the first Hall of Fame completion.
FLAG_GOT_SS_TICKET_FROM_ELM (0xF2, 242) is clear019Before Elm gives the S.S. Ticket.
Everstone flag clear012 or 013Selected by whether the Egg has hatched.
FLAG_WAS_TOLD_ABOUT_POKERUS (0x65, 101) is set020-022One of three random late-game conversations.
Otherwise020 or 021One of two random late-game conversations.

Gym Leader conversations​

Research: pokeheartgold: Gym Leader call logic.

Click for details...

All sixteen Gym Leaders use contact type 12. They do not use generic phone headers or the ordinary Radio Tower availability condition. Their shared selector chooses display handler 13 for an outgoing call and 14 for an incoming call; these are handler indexes, not contact types or phone-script IDs.

The shared routines start at these Overlay 101 offsets:

RoutineFile offsetDecomp name
Conversation selection0xC768PhoneCall_GetScriptId_GymLeader
Outgoing conversation0xC7D0GearPhoneCall_GymLeader_Outgoing
Incoming conversation0xC924GearPhoneCall_GymLeader_Incoming

The outgoing handler uses the following sequence:

ConditionConversation result
Player is on the Gym Leader's mapLocal-call message; no rematch offer.
Player has fewer than 16 badgesMessage explaining that the rematch cannot yet be arranged.
A rematch with that leader is already pendingPending-rematch message.
The contact's rematchWeekday or rematchTimeOfDay does not matchSchedule message.
OtherwiseThe leader asks whether to arrange a rematch. Choosing Yes sets that leader's PhoneRematch.seeking bit; choosing No does not.

An incoming Gym Leader call does not offer a rematch. It either acknowledges that leader's existing pending rematch or selects one of three ordinary incoming messages.

The unused capacity limit

The handler contains a five-Leader capacity check on the Fighting Dojo, but its vanilla helper only inspects Falkner's pending state and can count at most one pending rematch. It therefore always accepts an otherwise valid offer; the handler's capacity-full message is not reached in unmodified gameplay.


Trainer rematches​

Research: pokeheartgold: rematch-table selector, shared phone-trainer field script.

Rematch availability conditions​

Research: pokeheartgold: ordinary generic rematch conditions.

Rematch availability conditions decide whether a phone call can set PhoneRematch.seeking. They are separate from tier unlocks, which decide which battle is selected after seeking is set.

Ordinary trainers use different conditions depending on who starts the call:

DirectionHow a new rematch is offeredRequirements
Player calls trainerA scheduled offerRadio Tower cleared; matching weekday and time of day; chance roll.
Trainer calls playerA random offerRadio Tower cleared; chance roll; no weekday or time check.

For a scheduled outgoing rematch offer, both weekday (0-6) and time (0-2) must be valid and match the current clock; weekday 7 or time 3 prevents the offer, even when the other field matches.

The player-call route applies when the trainer is on a different map. A call to a trainer on the current map uses that contact's local-call phone script instead. If a rematch is already pending, the ordinary-trainer phone scripts select an existing-rematch message rather than making another offer.

Weekday and time are therefore not universal rematch requirements: they apply to ordinary trainers only when the player initiates the new offer. Gym Leaders are a separate case; their outgoing logic also checks those fields, as described under Gym Leader conversations.

Radio Tower availability condition (ordinary contacts only)​

For ordinary generic contacts, flag 0xC6 (198, FLAG_BEAT_RADIO_TOWER_ROCKETS) controls rematch availability. It is separate from tier flag 0x97D, which unlocks entry 2 in the battle table, although vanilla Radio Tower completion sets both.

Changing the availability flag: binary locations and alternative milestones

The three phone-header conditions below read this flag. File offsets are in Overlay 101, which loads at 0x21E7740:

Header conditionWhat the condition addsFunction entry0xC6 load
FIGHTPOSTROCKETSRejects a rematch script before Radio Tower; also rejects a caller already seeking a rematch or holding a phone-call gift.0xB578 (RAM 0x21F2CB8)0xB5A4
FIGHTPOSTROCKETSNOTBUGCONTESTRequires Radio Tower, rejects National Park during an active Bug-Catching Contest, and requires an already-pending rematch.0xB608 (RAM 0x21F2D48)0xB612
POSTROCKETWEEKTIMERequires Radio Tower, then checks the contact's weekday and time-of-day bytes.0xB5D0 (RAM 0x21F2D10)0xB5D8

Overlay 101 calls these three conditions separately at 0xB4C4, 0xB4CE, and 0xB4E2. Each condition loads 0xC6 with the Thumb instruction MOVS R1, #0xC6, so patch every condition whose availability rule should change. A replacement flag from 0x0 through 0xFF can use the existing one-byte immediate; 0x100 or above, including 0x97C, requires code that loads a full 16-bit flag ID. Do not move the normal setter for 0xC6 without caution: the flag also controls unrelated game behaviour.

The following existing low-byte milestone flags could be substituted for some other vanilla conditions:

Vanilla milestone flagImmediate byteReplacement availability condition first passes after
FLAG_GOT_POKEGEAR (0x9C, 156)9CReceiving the Pokégear.
FLAG_GOT_EGG_FROM_ELMS_ASSISTANT (0x70, 112)70Receiving the Togepi Egg; Route 32 progression is blocked until this flag is set.
FLAG_GOT_TM30_FROM_MORTY (0xA6, 166)A6Beating Morty and receiving TM30.
FLAG_GOT_HM03 (0xA2, 162)A2Receiving HM03 at the Dance Theatre.

Use these existing flags as read-only conditions; changing their setters affects their original behaviour. Tier unlocks and the other phone-header conditions still apply.

Rematch battle table​

Ordinary trainers and Gym Leaders share a trainer-ID table in Overlay 26 at 0x20C. It has 63 rows of 12 bytes (0x20C-0x4FF), each holding six little-endian u16 trainer battle IDs: the original trainer ID and five possible rematch teams.

EntryRelative offsetTier unlock flagMeaning
000NoneOriginal/base battle ID. It identifies the row and is the selector’s final fallback.
1020x97C (2428)Duplicate base battle ID. Vanilla never sets this flag. It is a redundant positive-index fallback: selecting it produces the same battle as entry 0.
2040x97D (2429)First distinct rematch team. Set by the Radio Tower story sequence.
3060x97E (2430)Second distinct rematch team. Set by the Hall of Fame sequence.
4080x97F (2431)Third distinct rematch team. Set when the player receives the Earth Badge at Viridian Gym.
50A0x980 (2432)TRAINER_NONE (0x0) in every vanilla ordinary-trainer row. It is a terminator in vanilla, but can hold a fourth distinct rematch team in a hack.

An entry is a physical slot in a table row. A rematch tier is an entry used as a progressively unlocked battle team: entries 1 through 5 can serve as tiers, while entry 0 is the base battle and fallback. The decomp calls the corresponding flag check a “rematch group”; there is no separate tier data structure.

Rows 0-46 are ordinary trainers; rows 47-62 are Gym Leaders.

Vanilla Overlay 26 table
RowOverlay 26 offsetTrainerEntry 0Entry 1Entry 2Entry 3Entry 4Entry 5
00x20CBird Keeper Jose4144143034466020
10x218Picnicker Erin1511513354536030
20x224Picnicker Liz27272762775180
30x230School Kid M Chad3973974344355070
40x23CSailor Huey2112114404415090
50x248Bug Catcher Wade444614605120
60x254Youngster Joey882792805100
70x260School Kid M Jack1781784304315030
80x26CAce Trainer M Gaven1021024564576040
90x278Black Belt Kenji17172502786050
100x284Hiker Parry1451454514526060
110x290Picnicker Tiffany4024024664675220
120x29CHiker Anthony61611001555230
130x2A8Ace Trainer F Reena1141144444456070
140x2B4Fisherman Wilton1241243254506080
150x2C0Ace Trainer F Jamie1131134584596090
160x2CCJuggler Irwin774544555270
170x2D8Poké Maniac Brent1311311721735300
180x2E4School Kid M Alan24244324335050
190x2F0Pokéfan M Derek*44444384396100
200x2FCPicnicker Gina65651423345200
210x308Fisherman Tully1231233233245170
220x314Pokéfan F Beverly*1821824364376110
230x320Bird Keeper Vance1371374474486120
240x32CFisherman Ralph57574624635150
250x338Camper Todd66662742755250
260x344Bug Catcher Arnie78783604495130
270x350Lass Dana4004004644655280
280x35CLass Krise1841846136146150
290x368Youngster Ian64646166176180
300x374Firebreather Walt3883886196206210
310x380Bug Catcher Doug1401406226236240
320x38CBug Catcher Rob48486256266270
330x398Biker Reese3133136286296300
340x3A4Biker Aiden5745746316326330
350x3B0Biker Ernest5795796346356360
360x3BCTeacher Hillary3823826376386390
370x3C8School Kid M Billy3313316406416420
380x3D4Twins Kay & Tia5695696436446450
390x3E0Bird Keeper Josh5655656466476480
400x3ECSchool Kid M Torin5675676496506510
410x3F8Young Couple Tim & Sue5595596526536540
420x404Hiker Kenny3583586556566570
430x410Camper Tanner5615616586596600
440x41CFisherman Kyle59596616626630
450x428Fisherman Kyler5585586646656660
460x434Gentleman Alfred4014016726736740
470x440Gym Leader Falkner2020712000
480x44CGym Leader Bugsy2121713000
490x458Gym Leader Whitney3030714000
500x464Gym Leader Morty3131715000
510x470Gym Leader Jasmine3333717000
520x47CGym Leader Chuck3434718000
530x488Gym Leader Pryce3232716000
540x494Gym Leader Clair3535719000
550x4A0Gym Leader Brock253253720000
560x4ACGym Leader Misty254254721000
570x4B8Gym Leader Lt. Surge255255722000
580x4C4Gym Leader Erika256256723000
590x4D0Gym Leader Janine257257724000
600x4DCGym Leader Sabrina258258725000
610x4E8Gym Leader Blaine259259726000
620x4F4Gym Leader Blue261261727000

* Beverly and Derek have rematch teams, but their vanilla phone conversations never arrange a rematch. Their gift scripts (240 and 280, respectively) queue Nuggets instead. Changing their unused weekday/time values alone will not enable rematches.

Rematch flow​

After a phone call sets a pending rematch, the NPC field script calls GetPhoneBookRematch. The entry scan and tier selection below run in compiled game code invoked by that command. The field script then starts the returned battle and handles the result:

This means rematch teams can be fought repeatedly. Trainer flags normally move selection towards the next team, but they do not prevent a selected fallback team from being fought again after another qualifying phone call.

Entry 0 is therefore a real fallback, not only the row's lookup ID. For example, a custom unbeaten entry 1 with 0x97C clear falls back to entry 0.

In vanilla, entry 1 duplicates the base battle and entry 5 is TRAINER_NONE. Once entry 4 has been beaten, the scan reaches entry 5, selects entry 4, and allows that final upgraded team to be fought repeatedly.

Field-script support for phone-trainer NPCs​

Research: pokeheartgold: relevant script commands, trainer-message commands, shared phone-trainer field script.

Vanilla's shared phone-trainer field script uses these commands to turn the pending state into a battle or an item.

OpcodeCommand nameArgumentsEffect
0x8EGetPhoneBookRematchcontact, resultWrites the selected rematch trainer battle ID to result, or 0 when that contact has no usable pending rematch. The field script passes the nonzero result to its trainer-battle path.
0xD8GetRematchMsgParamsresult0, result1, result2Writes three trainer-message type selectors for the active trainer script, including the rematch introduction. Does not read or change phone state.
0x1CCLoadPhoneDattrainerBattleId, resultFinds the phonebook record whose trainerId matches, copies it into the current caller context, and writes its contact ID to result; writes FF if no matching record exists. Vanilla uses it before the shared trainer-NPC flow.
0x1CDGetPhoneContactMsgIdsmessageIndex, archive, messageWrites the current caller's phone text-archive ID and one of the shared trainer-NPC message IDs. Vanilla uses indices 0-4 for registration, refusal, and item dialogue.
0x1CEScrCmd_462 (unnamed)contactClears that contact's pending-rematch bit (seeking). It does not clear a phone-call gift. Vanilla calls it after winning a rematch.

The field script loads the contact from the trainer battle ID and calls GetPhoneBookRematch. A nonzero result leads to a battle; victory clears seeking and checks for a rematch reward. Defeat leaves the rematch pending. If no rematch is selected, the script instead retrieves and clears any phone-call gift. This script ordering gives rematches priority over gifts.

When assigning a generic contact to a different existing trainer, add rematch-introduction text to that trainer's messages: type 17 for a single trainer, or 18/19 for double trainers. Registration and gift dialogue remain in messages 1-5 of the contact's phone text archive; update their wording as needed. An NPC using the standard trainer script needs no common-script changes.

Special contacts may have additional rematch rules: Kenji (type 6, contact 16) can only be rematched during daytime (10:00-19:59), enforced by the rematch lookup.

Gym Leader rematches​

Accepting an outgoing Gym Leader rematch sets its pending state. The Fighting Dojo script checks the Overlay 26 lookup result to decide whether the leader appears, but launches a fixed trainer battle ID. Changing or adding rematch tiers therefore also requires editing the Dojo field script (832) to battle the returned trainer ID. Editing the existing fixed trainer's team requires no script change.

To add earlier or later rematch teams, see Extending rematch tiers.


Gifts after calls and rematches​

Research: pokeheartgold: phone gift commands, phone-script item effects, Mom's purchases.

Rematch rewards​

A rematch reward remains the raw PhoneBookEntry.gift value until the shared NPC field script calls GetPhoneContactRandomGiftBerry (0x265) after the battle. The command’s compiled code replaces Cheri Berry (149, 0x95, ITEM_CHERI_BERRY) with a random one of the first ten berries by item ID. Every other item ID, including Poké Ball (4, 0x4, ITEM_POKE_BALL), is returned unchanged.

OpcodeCommand nameArgumentsEffect
0x265GetPhoneContactRandomGiftBerryresultWrites the current caller's rematch reward item, applying the berry special case described above.

For a nonzero reward, the shared field script always displays message 5 from the contact's phone text archive, then checks Bag space and awards the item. When adding a reward, supply suitable dialogue there; if a phone script already uses that message, move its dialogue and update its message IDs. See the Ralph example.

In vanilla, the nonzero rewards are Joey (HP Up), Kenji (PP Up), Huey (Protein), Vance (Carbos), Parry (Iron), Erin (Calcium), and Ian (a random berry through the Cheri special case).

Phone-call gifts​

A phone-call gift is resolved earlier, by the Overlay 101 phone code when it applies a PHONESCRIPTTYPE_ITEM phone script. It uses its own RNG to convert either special-case item before saving the result in PhoneRematch.giftItem: Cheri Berry (149, 0x95) becomes one of the first ten berries by item ID and Poké Ball (4, 0x4) becomes an Ultra Ball, Great Ball, or Poké Ball. The field command below retrieves this already-selected item without another roll.

OpcodeCommand nameArgumentsEffect
0x266GetPhoneContactGiftItemresultWrites the current caller's already-resolved phone-call gift, then clears that gift and its hasGift bit immediately.

Consequently, a normal PHONESCRIPTTYPE_ITEM definition cannot award a fixed Cheri Berry or Poké Ball. In contrast, PhoneBookEntry.gift = ITEM_POKE_BALL is a fixed Poké Ball rematch reward.

The NPC field script checks for an available rematch before retrieving a phone-call gift, so the player collects a queued gift only when no rematch battle is selected.

caution

The field script checks Bag space after retrieving the gift. A full Bag therefore displays the full-Bag message but loses the gift.

Mom's purchases​

Mom's purchases use their own five-entry queue rather than PhoneRematch.giftItem. The Poké Mart deliveryman's field script uses these commands:

OpcodeCommand nameArgumentsEffect
0x32DMomGiftCheckresultWrites 1 when Mom's queue has a first entry, otherwise 0.
0x32BScrCmd_811 (unnamed)item, quantityReads the first queued Mom item and its quantity without removing it.
0x32CScrCmd_812 (unnamed)NoneRemoves the first queued Mom item and shifts the remaining entries forwards.

The queued call announces the purchase. The deliveryman's field script checks Bag space, then removes the queued item and clears CALL_TRIGGER_MOM_BOUGHT_SOMETHING only after a successful award. A full Bag leaves the purchase queued.


Saved phone state​

Research: pokeheartgold: Pokégear save data, recent-caller save helpers, BlackShark’s earlier contact-list research.

Offsets below are relative to the named save structure, not absolute save-file offsets. Multi-byte values are little-endian.

Saved dataLocationLayout / purpose
Registered contactsSavePokegear + 0x60C75 contact IDs; FF marks empty trailing slots. The app saves the resulting manual or sorted order when it closes; sort ranks remain ROM data.
Recent callersSAVE_MISC_DATA + 0x280Eight contact IDs: four for group 0, two each for groups 1 and 2; FF marks empty slots. History update rules.
Rematches and phone-call giftsSavePokegear + 0x4B875 four-byte records, each holding pending-rematch and gift-present bits, followed by the gift item ID. Record details.
Queued event triggersSavePokegear + 0x606Two bytes; vanilla uses bits 0–12 for the event-call records. Trigger n uses bit n % 8 of byte n / 8 (integer division).
Mom’s purchase queueSavePokegear + 0x5E4Five four-byte records, each holding a u16 item ID and u16 quantity, collected in queue order. See Mom’s purchases.

Unused bits and adjacent bytes are not automatically expansion space. Mom’s bank balance immediately follows her queue at SavePokegear + 0x5F8, leaving no sixth slot.

Recent-caller history: layout and updates

Within SAVE_MISC_DATA.unk_0280, bytes 0–3 hold group 0, bytes 4–5 group 1, and bytes 6–7 group 2.

Answering an ordinary random call fills the first empty history slot. If full, the history normally discards its oldest entry. If the original candidate count is exactly one greater than the group’s capacity, it instead clears the history and stores only the new caller. See caller selection for the separate clearing check before exclusions.

The save helpers are sub_0202AA44, sub_0202AA9C, sub_0202AAD4, and sub_0202AB18.

Rematch and phone-call-gift records: layout and code locations

Contact c has one record at SavePokegear + 0x4B8 + (c × 4) in PhoneCallPersistentState.rematches, whether or not vanilla uses its rematch or gift state.

Record offsetSizeMeaning
00u16Bit 0: pending rematch (seeking). Bit 1: phone-call gift present (hasGift).
02u16Gift item ID (giftItem), meaningful while bit 1 is set.

ARM9 helpers at 0x2F0C4 (set/clear seeking), 0x2F100 (set/clear gift and hasGift) and 0x2F128 (read gift) reject contact IDs 75 and higher.

Within PhoneCallPersistentState, Mom’s queue begins at 0x12C, the following bank balance at 0x140, and callTriggerFlags[2] at 0x14E.


Case studies​

Picnicker Gina's Leaf Stone call​

Research: pokeheartgold: generic phone headers, phone-script definitions, shared phone-trainer field script.

Gina's Leaf Stone call is an incoming generic call and a phone-call gift. It is not a rematch reward.

First, the incoming random-call selector must choose Gina: she must be registered, eligible for the chosen unkF group, and not excluded by the current map or her group's recent-caller history. The generic code then checks Gina's incoming phone headers in priority order. Her seven candidate headers are followed by a terminating control row:

PriorityConditionChance valuePhone scriptPurpose
1DURINGROCKETS100259Rocket-takeover conversation.
2FIGHTPOSTROCKETSNOTBUGCONTEST100255Conversation while a rematch is already pending.
3GIFTNOTBUGCONTEST100258Conversation while a phone-call gift is waiting.
4FIGHTPOSTROCKETS30254Offers a rematch.
5FIGHTPOSTROCKETS10257Offers a Leaf Stone.
6RAND150252Ordinary conversation.
7RAND1100253Ordinary fallback conversation.

The first eligible row wins. The Rocket-takeover, pending-rematch and queued-gift rows take precedence when their conditions pass. If none apply, Gina's rematch row is tested before the Leaf Stone row. A chance value of 30 succeeds 31% of the time, and a value of 10 succeeds 11% of the time; the Leaf Stone row is reached when the preceding rematch row is ineligible or its chance roll fails.

Phone script 257 selects Gina's archive message 13 and has the ITEM result with ITEM_LEAF_STONE. Its automatic effect queues one Leaf Stone before the text appears. Gina's contact record has greeting-set value 1, so the game chooses the appropriate incoming greeting from shared archive 0640 before it prints message 13.

The call does not give the item directly. When the player next talks to Gina, her shared NPC field script first checks that a rematch is not pending, then retrieves the queued phone-call gift. The Leaf Stone is awarded only if there is Bag space; a full Bag displays the full-Bag message but loses the queued gift. This behaviour is the shared gift path described in Gifts after calls and rematches.

Youngster Joey's rematch​

Research: pokeheartgold: generic phone headers, ordinary generic call logic, Overlay 26 rematch selector.

Joey is a generic (type 0) phone trainer on Route 30. His contact record supplies the original trainer battle, a Monday/day schedule, and a fixed HP Up rematch reward.

If no rematch is already pending and the player calls from another map on Monday during the day, Joey's outgoing POSTROCKETWEEKTIME phone header selects phone script 033. It requires the Radio Tower flag 0xC6 and sets Joey's pending-rematch state. If Joey is chosen for an ordinary random incoming call, his separate incoming header can offer the same rematch without the weekday/time requirement. Either route leads to the same pending state; see Rematch availability conditions.

When the player next speaks to Joey, the shared trainer field script finds his Overlay 26 row from his trainer ID. For his first upgraded team, two separate flags matter: 0xC6 (198) allows the phone call to offer a rematch; 0x97D (2429) unlocks entry 2 when the battle is selected. Vanilla Radio Tower completion sets both. With only 0xC6 set and no tier flags unlocked, a rematch can be arranged but falls back to Joey's original team. After a victory, the field script clears the pending rematch and awards his HP Up reward if there is Bag space. See Rematch flow and Gifts after calls and rematches.

Professor Elm's stolen-Pokémon call​

Research: pokeheartgold: Route 30 field script, Professor Elm's phone logic.

Elm's stolen-Pokémon call is a direct field-scripted call, not a random or queued incoming call. The Route 30 field script sets flag 0xEE (238, decomp name: FLAG_GOT_ELMS_PANIC_CALL), then configures Elm with call mode 2 and predefined script index 0 before launching the call. Elm's special-contact logic maps that index to PHONE_SCRIPT_002.

The call does not wait for the ten-minute timer, use the random-caller pool, or consume a queued trigger bit. The map script supplies the caller and conversation, while Elm's specialised call code displays it. See Incoming: field-script trigger and Phone conversations.

Mom's purchase call​

Research: pokeheartgold: Mom's purchases and trigger scheduling, Poké Mart deliveryman field script.

Mom's savings code first puts an item and quantity into her separate five-entry purchase queue. It then sets queued trigger bit 12, CALL_TRIGGER_MOM_BOUGHT_SOMETHING. At the next permitted timed incoming-call check, the queued-call path takes priority over ordinary random callers. Overlay 2 record 12 selects Mom and PHONE_SCRIPT_027, which announces the purchase.

Answering clears trigger bit 12, but leaves the purchase queued. At a Poké Mart, the deliveryman's field script checks Bag space and removes the first purchase only after awarding it; it also clears any still-pending purchase-call trigger. A full Bag preserves the purchase. See Mom's purchase queue and Mom's purchases.

Falkner's Gym Leader rematch​

Research: pokeheartgold: Gym Leader phone logic, Overlay 26 rematch selector.

Falkner is a special contact (type 12), so his outgoing call does not use generic phone headers or the ordinary Radio Tower availability condition. The player must call from another map, hold all 16 badges, have no rematch already pending, and call at Falkner's configured weekday and time. The call then asks whether to arrange the battle; accepting sets Falkner's pending-rematch state.

The Fighting Dojo script checks Falkner's Overlay 26 row 47 through GetPhoneBookRematch. A nonzero result makes him appear, but his interaction launches the fixed trainer battle ID 712. Changing the row alone will not change his team; see Gym Leader rematches.


Example edits​

Reduce the frequency of random incoming calls​

  1. Open the decompressed arm9/arm9.bin from your DSPRE contents folder in a hex editor. See Changing the shared incoming-call threshold.
  2. At file offset 0x92DB2, replace 0A 20 with 14 20.
  3. At file offset 0x92E44, replace 0A 29 with 14 29. Together, these edits increase the incoming-call interval from 10 to 20 minutes. This also affects queued event calls.
  4. Save the file, move any automatically generated backup files outside the contents folder, then rebuild the ROM from that folder using DSPRE.

Add a Lure Ball rematch reward for Fisherman Ralph​

  1. Open files/tel/pmtel_book.dat from your DSPRE contents folder in a hex editor.
  2. Go to file offset 0xE8: Ralph's record starts at 0xE0, and its rematch reward is at +0x08. See File layout.
  3. Replace 00 00 with EE 01 (Lure Ball, item ID 494 or 0x1EE, stored little-endian).
  4. In DSPRE's text editor, copy message 5 from Ralph's text archive 712 into a new message at the end of that archive. Note the new message ID (12 in vanilla), which must fit within 0-255.
  5. Open decompressed ov101.bin from your DSPRE contents folder. At 0x11550, replace 05 05, the male and female message IDs for local-call phone script 46, with the new message ID twice (0C 0C for message 12). Leave the remaining four bytes unchanged. See Phone scripts.
  6. Replace archive 712, message 5, with suitable reward dialogue. The shared field script uses this message before giving the item; the local call now uses the copied message. See Rematch rewards.
  7. Save all changes, move any automatically generated backup files outside the contents folder, then rebuild the ROM from that folder using DSPRE. Ralph will award one Lure Ball after a rematch victory, provided there is Bag space.

Create a direct field-scripted call from Professor Elm​

Command names follow Rotom nomenclature.

  1. Identify an unused, persistent flag to record that the call has occurred.
  2. In DSPRE's text editor, append the desired dialogue to Elm's text archive 716. Note its message ID, which must fit within 0-255. See Dialogue.
  3. Open decompressed ov101.bin from your DSPRE contents folder. At 0x11460, replace the six bytes for phone script 6, 29 2A 00 00 00 00, with WW XX 12 00 YY ZZ: WW and XX are the male and female message IDs, and YY ZZ is your flag ID in little-endian order. Each placeholder represents one byte. Use the same message ID twice if both genders share the dialogue. 12 00 selects the flag-setting effect. See Phone scripts.
  4. In DSPRE, add a Variable/Value level-script trigger for the desired map, pointing to a new script. Use a designated story variable or an unused map-cleared variable, such as 0x4000, with comparison value 0. See Starting a call on map entry.
  5. Start the new script with SetVar 0x4000 9 to disable the trigger for this visit. Check your chosen persistent flag and end if it is already set (CheckFlag, then GoToIf EQUAL to an End). Use your selected temporary variable throughout if different from 0x4000.
  6. If the flag is clear, continue with:
    ScrCmd_609
    LockAll
    SetVar 0x8004 1
    SetVar 0x8005 2
    SetVar 0x8006 4
    CallStd 2039
    ReleaseAll
    End
    ScrCmd_609 prepares the following Pokémon before locking. The call selects Elm's phone script 6, which sets the persistent flag configured in step 3. See Professor Elm's calls.
  7. Save the text, scripts, level trigger and edited overlay, move any automatically generated backup files outside the contents folder, then rebuild the ROM using DSPRE. Fully reopen the rebuilt ROM in the emulator.

Enable early rematches and add tier 1 teams​

  1. In DSPRE, open the Violet City Poké Mart script file 858. Immediately after the assistant sets flag 0x70 (112) for giving the Togepi Egg, add SetFlag 0x97C (2428) to unlock tier 1. The player must receive the Egg after applying this edit for the new flag to be set. See Extending rematch tiers.
  2. Open decompressed ov101.bin from your DSPRE contents folder. At offsets 0xB5A4, 0xB5D8 and 0xB612, replace C6 21 with 70 21. Ordinary rematch availability now requires receiving the Egg instead of clearing Radio Tower. See Radio Tower availability condition.
  3. In DSPRE's trainer editor, repurpose some unused Mickey trainer slots (e.g. 514 and 524) as new teams for Wade and Anthony. Update their names, classes, settings and configure teams suitable for early rematches.
  4. Open decompressed ov26.bin. At 0x24A, replace 04 00 with 02 02 to assign trainer 514 to Wade's entry 1. At 0x29E, replace 3D 00 with 0C 02 to assign trainer 524 to Anthony's entry 1. See Rematch battle table.
  5. Other ordinary trainers with rematch-offer conversations also gain earlier availability, but retain their original teams until later tiers unlock unless you edit entry 1 too.
  6. Save all changes, move any automatically generated backup files outside the contents folder, then rebuild the ROM using DSPRE.

Reveal Joey as the real superboss (add tier 5 rematches)​

  1. In DSPRE's trainer editor, repurpose unused Youngster Mickey trainer (e.g. 511) as Joey's new rematch team: six level-100 rodents with perfect IVs. Red was only the warm-up.
  2. Open decompressed ov26.bin from your DSPRE contents folder. At 0x25E, replace 00 00 with FF 01 to assign trainer 511 to Joey's entry 5. See Rematch battle table.
  3. In DSPRE, open Red's summit script file 107. Add SetFlag 0x980 (2432) to the first-victory branch that sets variable 0x4131 to 1. This unlocks tier 5 after Red's first defeat, which must occur after applying this edit. See Extending rematch tiers.
  4. Leave other trainers' entry 5 values unchanged. The unlock flag is shared, but only Joey receives a new team.
  5. Save all changes, move any automatically generated backup files outside the contents folder, then rebuild the ROM using DSPRE. Joey's new team becomes available through the normal rematch flow after his preceding teams have been beaten.

Increase Gina's Leaf Stone gift opportunities​

These options can be used independently or combined to increase Gina's incoming gift opportunities or add a gift offer when the player calls her. For incoming calls, reducing her rematch-offer chance only improves the gift's chance while the rematch header remains first; skip that option if you move the gift header ahead of it.

Increase Gina's gift-offer chance​

  1. Open decompressed ov101.bin from your DSPRE contents folder. See Phone headers.
  2. At 0x131F5, replace 0A with 31. This increases the gift-offer chance from 11% to 50% when its header is reached and eligible. If you have already swapped the gift and rematch headers, edit 0x131EF instead.
  3. Save the file, move any automatically generated backup files outside the contents folder, then rebuild the ROM using DSPRE.

Prioritise Gina's gift over a rematch​

  1. Open decompressed ov101.bin from your DSPRE contents folder. See Gina's Leaf Stone call.
  2. Swap the complete six-byte records at 0x131EE and 0x131F4. In vanilla, these contain 02 1E 00 00 FE 00 and 02 0A 00 00 01 01, respectively. Preserve any chance edits already made.
  3. Leave the preceding headers unchanged. The gift will be considered before a new rematch offer, while the story, pending-rematch and pending-gift restrictions remain.
  4. Save the file, move any automatically generated backup files outside the contents folder, then rebuild the ROM using DSPRE.

Reduce Gina's competing rematch offers​

  1. Open decompressed ov101.bin from your DSPRE contents folder. See Phone-header condition types.
  2. At 0x131EF, replace 1E with 09. This reduces the rematch-offer chance from 31% to 10%, allowing more calls to reach the gift header.
  3. Save the file, move any automatically generated backup files outside the contents folder, then rebuild the ROM using DSPRE.

Change Gina's random-call group​

  1. Open files/tel/pmtel_book.dat from your DSPRE contents folder in a hex editor. See File layout.
  2. At 0x3E7, replace 02 with 00 to move Gina from group 2 to group 0.
  3. Group 0 is selected more frequently, but competing contacts and caller history mean Gina is not guaranteed to call more often. See Incoming: time trigger.
  4. Save the file, move any automatically generated backup files outside the contents folder, then rebuild the ROM using DSPRE.

Trigger an on-demand incoming call from Gina​

Command names follow Rotom nomenclature.

  1. In DSPRE, create an NPC interaction or another field-script event from which to launch Gina's call. An NPC interaction can let the player trigger calls repeatedly. See Incoming: field-script trigger.
  2. Add this command sequence to the field script:
    SetVar 0x8004 49
    SetVar 0x8005 2
    SetVar 0x8006 0
    CallStd 2039
  3. End the field script after the call returns. This bypasses timed caller selection and Gina's random-call group, but uses her incoming headers with their conditions, chance rolls and any edits above.
  4. Save the script and rebuild the ROM using DSPRE.

Allow Gina to offer a Leaf Stone when called by the Player​

  1. Open decompressed ov101.bin from your DSPRE contents folder. See Phone headers.
  2. Copy the six-byte fallback record 01 64 00 00 00 01 from 0x131C4 to 0x131CA, replacing the unused record there.
  3. At 0x131C4, write 02 05 00 00 01 01. This adds a 6% chance of selecting Gina's existing Leaf Stone phone script 257 when earlier headers do not take precedence and no rematch or gift is pending.
  4. Save the file, move any automatically generated backup files outside the contents folder, then rebuild the ROM using DSPRE.
  5. Call Gina from another map to use her outgoing headers. Calling from her own map uses her local conversation instead. See Gina's Leaf Stone call.

Extending rematch tiers​

For ordinary phone trainers, the selected Overlay 26 entry supplies the battle ID. The following edits change team progression without changing rematch availability conditions. Gym Leaders also require Dojo field-script changes to use the selected team.

Add a later tier: entry 5​

Replace TRAINER_NONE in entry 5 with a new trainer battle ID, then set tier flag 0x980 from a field script at the desired later milestone (after defeating Trainer Red, for example). Once entry 4 has been beaten, the selector can use the new entry 5 team. This does not require a new table or a larger row.

Vanilla ordinary-trainer rows already populate entries 1-4. Gym Leader rows end at entry 3; when extending them, populate every preceding entry because the first TRAINER_NONE ends the scan.

Add an earlier tier: entry 1​

Replace the duplicate base battle ID in entry 1 with a new trainer battle ID, then set tier flag 0x97C from a field script at the desired milestone. After the base battle has been beaten, the selector uses this new team when 0x97C is set; before then, it falls back to entry 0.


Expanding queued event calls​

The existing save field supports up to 16 triggers: vanilla uses IDs 0-12, leaving 13-15 available. To add calls:

  1. Choose one to three additional trigger IDs.
  2. Relocate the definitions, append the new records and update the four pointers.
  3. Update the six count limits to include the new IDs.
  4. Set each new trigger from a field script or game code.

New triggers can reuse existing contacts. See Incoming: queued system-event trigger for the record layout and its one-byte effective phone-script limit.

Why the table cannot grow in place

The 13-record table ends at Overlay 2 offset 0xE151, but the six following zero-looking bytes are not free space. The Celebi cutscene's live VecFx32 { 0, 0x1000, 0 } constant begins at 0xE154 and occupies 0xE154-0xE15F; its first u32 is zero, which makes 0xE154-0xE157 appear unused in a hex editor. Writing record 13 at 0xE152 would overwrite that vector's x component.

Only 0xE152-0xE153 are alignment padding. A fourteenth record requires a relocated or expanded table and matching code changes.

Relocating the trigger definitions​

Copy the original 13 six-byte records to a new location and append one record per new trigger, keeping record order aligned with trigger IDs. The new table must remain loaded whenever the incoming-call manager reads it. Use suitably allocated, two-byte-aligned space; the pointer values below are RAM addresses, not file offsets.

Total triggersNew trigger IDsTable sizeCount byte
141384 bytes (0x54)0E
1513-1490 bytes (0x5A)0F
1613-1596 bytes (0x60)10

For a new table at RAM address T, replace these four little-endian 32-bit pointers in Overlay 2:

File offsetReplacement pointerData read
0xC68CT + 2Phone-script ID.
0xC690TCaller ID.
0xC694T + 4Forced-pickup setting.
0xC728TCaller ID during candidate selection.

Accepting the additional trigger IDs​

Research: pokeheartgold: queued-call state, queued-event selection.

Set all six count bytes below to the chosen total: 0E, 0F or 10 for 14, 15 or 16 triggers respectively. In the replacement column, NN means that count byte. The count is one greater than the highest accepted trigger ID.

FileFile offsetVanilla bytesReplacement bytesPurpose
ARM90x2F01E0D 29NN 29Set bits for the expanded ID range.
ARM90x2F0520D 29NN 29Clear bits for the expanded ID range.
ARM90x2F08E0D 29NN 29Read bits for the expanded ID range.
Overlay 20xC6A20D 21NN 21Allocate one candidate byte per trigger.
Overlay 20xC6AC0D 22NN 22Clear the full candidate buffer.
Overlay 20xC6FA0D 2CNN 2CScan the expanded ID range.

The ARM9 comparisons are in src/save_pokegear.c; the Overlay 2 values are in ov02_02252218 in src/field/overlay_2_gear_phone.c.

Setting and checking new triggers​

Set the new trigger from a field script with command 0x94, supplying its ID and expedite byte. To trigger it automatically from a gameplay event, add code that detects that event and sets the same trigger.


Expanding beyond 75 contacts​

Adding additional contacts would be an involved piece of work, this guide does not claim to have identified every required edit, but a complete expansion needs to address at least all of the following:

  • The phonebook count and every contact-ID range check or fixed loop;
  • The saved registered-contact/order list and the per-contact rematch/phone-call-gift array, including the data which immediately follows them and the total save-block size;
  • Contact-indexed UI data and sort ranks;
  • For each new generic contact: 16 phone headers, a text-archive mapping and dialogue, and phone-script records for its conversations, including the local call. Repurpose suitable records or expand and repoint the phone-script table as needed; and
  • Migration or deliberate invalidation of existing saves.

Greeting rows may be reused, as they are already shared in vanilla. The individual limits described elsewhere on this page are parts of this one expansion task, not separate data-only edits.

It is also uncertain how the Pokégear UI would behave with more than 75 contacts.