From a5c078945b3af36c8bfa8e149417919a4507f51d Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 19 Aug 2022 10:16:54 -0300 Subject: [PATCH] Added a new scripting macro; setmonball --- Useful-Scripting-Specials.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Useful-Scripting-Specials.md b/Useful-Scripting-Specials.md index 3c871ea..d940071 100644 --- a/Useful-Scripting-Specials.md +++ b/Useful-Scripting-Specials.md @@ -9,6 +9,7 @@ All specials need to be added to the table in `data/specials.inc` following othe - [Check an Object at a Position](#checkobjectat) - [Get Seen/Caught Mon](#getseenmon-and-getcaughtmon) - [Set Seen/Caught Mon](#setseenmon-and-setcaughtmon) +- [Set Mon Ball](#setmonball) ### getobjectposition @@ -180,4 +181,34 @@ Keep in mind that in order to access `FLAG_SET_SEEN` and `FLAG_SET_CAUGHT`, you In other words, you need to add a `#include "pokedex.h"` to the list of headers at the top of the file. -To use them, simply type either `setseenmon` or `setcaughtmon` in your script, followed by the species ID. For example, `setcaughtmon SPECIES_MAGIKARP`. \ No newline at end of file +To use them, simply type either `setseenmon` or `setcaughtmon` in your script, followed by the species ID. For example, `setcaughtmon SPECIES_MAGIKARP`. + +### setmonball + +Credits to Lunos. + +This command will let you modify the caught ball of a Pokémon that is chosen by the Player. + +1. First, our scripting macro: + +```c + @ Changes the caught ball of a selected Pokémon + .macro setmonball ballId:req + special ChoosePartyMon + waitstate + setvar VAR_TEMP_1, \ballId + special SetMonBall + .endm +``` + +2. Next, our special function. You can add it to any .c file, although since it's meant to be used from the overworld, I suggest `src/field_specials.c` specifically. + +```c +void SetMonBall(void) +{ + u8 ballId = VarGet(VAR_TEMP_1); + SetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_POKEBALL, &ballId); +} +``` + +To use it, simply type `setmonball` in your script followed by the desired Poké Ball Item ID. For example, `setmonball ITEM_PREMIER_BALL`. \ No newline at end of file