diff options
author | ghoulslash <41651341+ghoulslash@users.noreply.github.com> | 2021-04-29 09:02:12 -0600 |
---|---|---|
committer | ghoulslash <41651341+ghoulslash@users.noreply.github.com> | 2021-04-29 09:02:12 -0600 |
commit | 9aad480b6ffb30ec66ab9e3e8d9e1b606de3b6a7 (patch) | |
tree | 5ccc09f34389e4c5f8b0300913646e524e820c0a | |
parent | 3de235281618725887f3e6d469b419df7499fda6 (diff) |
Created Spawn Invisible Player (markdown)
-rw-r--r-- | Spawn-Invisible-Player.md | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Spawn-Invisible-Player.md b/Spawn-Invisible-Player.md new file mode 100644 index 0000000..dd029b9 --- /dev/null +++ b/Spawn-Invisible-Player.md @@ -0,0 +1,36 @@ +## Spawn Invisible Player + +credits to ghoulslash + +This feature allows us to spawn the player object as invisible after a warp, which can be useful for cutscenes, etc. Note that the camera will still be centered on the player. + +## Define a flag + +We'll use a flag to toggle whether or not we want to spawn the player as an invisible object. Open up [include/constants/flags.h](../blob/master/include/constants/flags.h) and either add or replace a flag with the following: `FLAG_SPAWN_INVISIBLE` + +## Make the flag functional + +1. Open [src/field_player_avatar.c](../blob/master/src/field_player_avatar.c) and find the function `InitPlayerAvatar`. Add the following to the end of the function: +```c +if (FlagGet(FLAG_SPAWN_INVISIBLE)) +{ + FlagClear(FLAG_SPAWN_INVISIBLE); + objectEvent->invisible = TRUE; +} +``` + +## Use the flag + +Now, we can use this in a script as so: +``` +EventScript_SetupCutscene:: + lock + setflag FLAG_SPAWN_INVISIBLE + warp MAP_PETALBURG_CITY, -1, 30, 40 + release + end +``` + +And you would need to then add a map script to run your cutscene in petalburg city. + +When you want the player to appear again, you must use the `applymovement` command that includes a `set_visible` movement command. |