From 73d0a06843d5ebb8864c7622bb48c936109dab5b Mon Sep 17 00:00:00 2001 From: tustin2121 Date: Sat, 4 Mar 2023 17:12:04 -0500 Subject: [PATCH] Final bits of copying from the tutorial --- The-Basics-of-Scripting.md | 99 +++++++++++++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) diff --git a/The-Basics-of-Scripting.md b/The-Basics-of-Scripting.md index 4a3ae07..505b732 100644 --- a/The-Basics-of-Scripting.md +++ b/The-Basics-of-Scripting.md @@ -23,7 +23,9 @@ Table of Contents: - [Door Commands](#Door-Commands) - [Display Pokémon Sprite](#display-pok%C3%A9mon-sprite) - [Screen Fading Effects](#Screen-Fading-Effects) - +- [Play Pokémon Cry](#play-pok%C3%A9mon-cry) +- [Time-Based Scripts](#time-based-scripts) +- [Sound Effects & Fanfares](#sound-effects--fanfares) # Labelling @@ -844,4 +846,99 @@ Text_FadescreenExample: ``` +# Play Pokémon Cry + +Using Pokémon cries as a sound effect is another super easy thing to do, all you need is the playmoncry command: + +```gas +playmoncry [Pokémon], 0 +``` +Followed by `waitmoncry`, which doesn't have any arguments. Just as it looks, it simply means the script will continue after the cry has finished playing. + +```gas +Script_CryDemo:: + lock + faceplayer + playmoncry SPECIES_ARBOK, 0 + msgbox Text_CryDemo, MSGBOX_DEFAULT + waitmoncry + release + end + +Text_CryDemo: + .string "Arbok: Hisssss!$" +``` + + +# Time-based Scripts + +The `gettime` command can be used to set the values of variables `VAR_0x8000`, `VAR_0x8001`, and `VAR_0x8002` to the in-game hour, minute, and second respectively. To make sure the time is up to date, you should also call `dotimebasedevents` before that. This is an example script for a NPC who gives different greetings depending on the hour: + +```gas +Script_HourDemonstration:: + lock + faceplayer + dotimebasedevents + gettime + compare VAR_0x8000, 4 + goto_if_le Script_Night + compare VAR_0x8000, 12 + goto_if_lt Script_Morning + compare VAR_0x8000, 18 + goto_if_ge Script_Night + msgbox Text_Day, MSGBOX_DEFAULT + release + end + +Script_Morning:: + msgbox Text_Morning, MSGBOX_DEFAULT + release + end + +Script_Night:: + msgbox Text_Night, MSGBOX_DEFAULT + release + end + +Text_Morning: + .string "Good morning.$" + +Text_Day: + .string "Good day.$" + +Text_Night: + .string "Good evening.$" +``` + +You could swap out the values to check for a particular minute or second too, if you wanted to run a very specific event that only occurs at a very specific time! + + +# Sound Effects & Fanfares + +Sound effects can bring a lot of life to overworld gameplay. To play sounds, use the following: + +```gas +playse [Label] +``` +If you want to make the script wait for the sound to finish before continuing, you can add `waitse` if you want to. For example, if you'd have liked to use a sound effect for an exclamation point emote on your player: + +```gas +playse SE_PIN +applymovement OBJ_EVENT_ID_PLAYER, Movement_Exclamation +waitmovement +``` +A fanfare is a short jingle, like the healing sound in Pokémon Centers. To use one in your script, use these commands: + +```gas +playfanfare [Label] +waitfanfare +``` +`waitfanfare` means the script will wait for the jingle to finish playing before continuing. So, let's say we wanted to play the fanfare sound for obtaining a Gym Badge: + +```gas +playfanfare MUS_OBTAIN_BADGE +waitfanfare +``` + +You can find a list of labels for sound effects and music in `include\constants\songs.h`.