summaryrefslogtreecommitdiff
path: root/Toggle-Trainer-Sight.md
blob: 1b56d926d9255a3c53dcb825fb8ca698b170b7e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Toggling Trainers "Seeing" You

Credit to ghoulslash

Likely more useful for a debug menu feature, this may have utility for game events. **Note** that this only prevents them from noticing you. Talking directly to the trainer will still initiate the battle.

### Create a flag to toggle trainer sight
Open [include/constants/flags.h](../blob/master/include/constants/flags.h). Replace an unused flag with `FLAG_SYS_TOGGLE_TRAINER_BATTLES`. For example:
```c
#define FLAG_UNUSED_0x881                           (SYSTEM_FLAGS + 0x21) // Unused Flag
```
becomes
```c
#define FLAG_SYS_TOGGLE_TRAINER_BATTLES             (SYSTEM_FLAGS + 0x21)
```

### Prevent the trainers from seeing you
Open [src/trainer_see.c](../blob/master/src/trainer_see.c). Find `CheckForTrainersWantingBattle` And replace with the following:
```c
bool8 CheckForTrainersWantingBattle(void)
{
    u8 i;
    
    if (FlagGet(FLAG_SYS_TOGGLE_TRAINER_BATTLES))
        return FALSE;
    
    gNoOfApproachingTrainers = 0;
    //etc...
```

### Finally, set your flag via a script or function, and watch the magic (not) happen!