Skip to content

Spawn Invisible Player

ghoulslash edited this page Apr 29, 2021 · 1 revision

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 and either add or replace a flag with the following: FLAG_SPAWN_INVISIBLE

Make the flag functional

  1. Open src/field_player_avatar.c and find the function InitPlayerAvatar. Add the following to the end of the function:
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.

Clone this wiki locally