Force Save - pret/pokeemerald GitHub Wiki
This code forces a save rather than asks if you want to save.
src/start_menu.c
add to end of file:
void Script_ForceSaveGame(struct ScriptContext *ctx)
{
SaveGame();
ShowSaveInfoWindow();
gMenuCallback = SaveCallback;
sSaveDialogCallback = SaveSavingMessageCallback;
}
asm/macros/event.inc
add to end of file:
.macro forcesave
callnative Script_ForceSaveGame
waitstate
.endm
To use, add forcesave to your script (and release if your script doesn't already have it).
code script for the example in the gif:
LittlerootTown_EventScript_TownSign::
msgbox LittlerootTown_Text_TownSign, MSGBOX_SIGN
forcesave
release
end