mirror of https://github.com/pret/pokeemerald.git
Updated Useful Scripting Specials (markdown)
parent
f88dd99657
commit
bcd58c9105
|
@ -86,3 +86,90 @@ u16 CheckObjectAtXY(void)
|
|||
return FALSE;
|
||||
}
|
||||
```
|
||||
|
||||
### 3. getseenmon and getcaughtmon
|
||||
|
||||
Credits to Lunos.
|
||||
|
||||
These commands will check the state of either the Seen or the Caught Pokédex flags of a species whose ID stored in `VAR_TEMP_1`.
|
||||
|
||||
1. First, our scripting macros:
|
||||
|
||||
```c
|
||||
@ Checks the state of the Pokédex Seen flag of the specified Pokemon
|
||||
.macro getseenmon species:req
|
||||
setvar VAR_TEMP_1, \species
|
||||
specialvar VAR_RESULT, GetSeenMon
|
||||
.endm
|
||||
|
||||
@ Checks the state of the Pokédex Caught flag of the specified Pokemon
|
||||
.macro getcaughtmon species:req
|
||||
setvar VAR_TEMP_1, \species
|
||||
specialvar VAR_RESULT, GetSeenMon
|
||||
.endm
|
||||
```
|
||||
|
||||
2. Next, our special functions. You can add them to any .c file, although since these are meant to be used from the overworld, I suggest `src/field_specials.c` specifically.
|
||||
|
||||
Keep in mind that in order to access `FLAG_GET_SEEN` and `FLAG_GET_CAUGHT`, you must use the `#include` directive to read the contents of the `include/pokedex.h`.
|
||||
|
||||
In other words, you need to add a `#include "pokedex.h"` to the list of headers at the top of the file.
|
||||
|
||||
```c
|
||||
bool8 GetSeenMon(void)
|
||||
{
|
||||
return GetSetPokedexFlag(SpeciesToNationalPokedexNum(VarGet(VAR_TEMP_1)), FLAG_GET_SEEN);
|
||||
}
|
||||
|
||||
bool8 GetCaughtMon(void)
|
||||
{
|
||||
return GetSetPokedexFlag(SpeciesToNationalPokedexNum(VarGet(VAR_TEMP_1)), FLAG_GET_CAUGHT);
|
||||
}
|
||||
```
|
||||
|
||||
To use them, simply type either `getseenmon` or `getcaughtmon` in your script, followed by the species ID. For example, `getcaughtmon SPECIES_MAGIKARP`.
|
||||
|
||||
The result *(either `TRUE` or `FALSE`)* will be stored in `VAR_RESULT`.
|
||||
|
||||
### 4. setseenmon and setcaughtmon
|
||||
|
||||
Credits to Lunos.
|
||||
|
||||
These commands will set either the Seen or the Caught Pokédex flags of a species whose ID stored in `VAR_TEMP_1`.
|
||||
|
||||
1. First, our scripting macros:
|
||||
|
||||
```c
|
||||
@ Sets the Pokédex Seen flag of the specified Pokemon
|
||||
.macro setseenmon species:req
|
||||
setvar VAR_TEMP_1, \species
|
||||
special SetSeenMon
|
||||
.endm
|
||||
|
||||
@ Sets the Pokédex Caught flag of the specified Pokemon
|
||||
.macro setcaughtmon species:req
|
||||
setvar VAR_TEMP_1, \species
|
||||
special SetCaughtMon
|
||||
.endm
|
||||
```
|
||||
|
||||
2. Next, our special functions. You can add them to any .c file, although since these are meant to be used from the overworld, I suggest `src/field_specials.c` specifically.
|
||||
|
||||
Keep in mind that in order to access `FLAG_GET_SEEN` and `FLAG_GET_CAUGHT`, you must use the `#include` directive to read the contents of the `include/pokedex.h`.
|
||||
|
||||
In other words, you need to add a `#include "pokedex.h"` to the list of headers at the top of the file.
|
||||
|
||||
```c
|
||||
bool8 SetSeenMon(void)
|
||||
{
|
||||
GetSetPokedexFlag(SpeciesToNationalPokedexNum(VarGet(VAR_TEMP_1)), FLAG_SET_SEEN);
|
||||
}
|
||||
|
||||
bool8 SetCaughtMon(void)
|
||||
{
|
||||
GetSetPokedexFlag(SpeciesToNationalPokedexNum(VarGet(VAR_TEMP_1)), FLAG_SET_SEEN);
|
||||
GetSetPokedexFlag(SpeciesToNationalPokedexNum(VarGet(VAR_TEMP_1)), FLAG_SET_CAUGHT);
|
||||
}
|
||||
```
|
||||
|
||||
To use them, simply type either `setseenmon` or `setcaughtmon` in your script, followed by the species ID. For example, `setcaughtmon SPECIES_MAGIKARP`.
|
Loading…
Reference in New Issue