From 9aad480b6ffb30ec66ab9e3e8d9e1b606de3b6a7 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Thu, 29 Apr 2021 09:02:12 -0600 Subject: Created Spawn Invisible Player (markdown) --- Spawn-Invisible-Player.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Spawn-Invisible-Player.md 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. -- cgit v1.2.3