Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/pmret/papermario/llms.txt

Use this file to discover all available pages before exploring further.

The EVT script API is the collection of C functions that scripts invoke using the Call instruction. These functions bridge the high-level scripting layer and the game engine, handling everything from rotating a map model to playing an audio cue. Every callable exposes a standardized signature, reads its arguments from the script’s read pointer, and signals completion through an ApiStatus return value.

The API_CALLABLE signature

The API_CALLABLE macro (defined in include/macros.h) expands to the full C function declaration:
#define API_CALLABLE(name) ApiStatus name(Evt* script, bool isInitialCall)
So a callable named TranslateModel is declared as:
ApiStatus TranslateModel(Evt* script, bool isInitialCall);
Inside the function body, arguments passed from the script are read sequentially from script->ptrReadPos:
API_CALLABLE(TranslateModel) {
    Bytecode* args = script->ptrReadPos;
    s32 modelIndex = evt_get_variable(script, *args++);
    f32 x = evt_get_float_variable(script, *args++);
    f32 y = evt_get_float_variable(script, *args++);
    f32 z = evt_get_float_variable(script, *args++);
    // ... apply transform ...
    return ApiStatus_DONE2;
}
isInitialCall is true on the first invocation. If the function returns ApiStatus_BLOCK, the VM calls it again next frame with isInitialCall set to false. Use this pattern to implement multi-frame blocking operations:
API_CALLABLE(WaitForSomething) {
    if (isInitialCall) {
        // one-time setup
        script->functionTemp[0] = start_async_operation();
    }
    if (operation_done(script->functionTemp[0])) {
        return ApiStatus_DONE2;
    }
    return ApiStatus_BLOCK; // resume next frame
}

Invoking callables from scripts

Use the Call macro to invoke any API_CALLABLE function. Arguments follow the function pointer:
Call(TranslateModel, MODEL_gate, Float(0.0), Float(5.0), Float(0.0))
Call(SetNpcPos, NPC_Goomba, 100, 0, 200)
Call(DisablePlayerInput, true)
The @evtapi Doxygen tag marks declarations in the source as callable from EVT scripts. You will find it on every function listed below.

Map and model functions

Declared in include/script_api/common.h under the Map group.
FunctionDescription
TranslateModelApplies a translation to a model’s user transform matrix.
RotateModelApplies a rotation to a model’s user transform matrix.
ScaleModelApplies a scale to a model’s user transform matrix.
GetModelIndexReturns the list index of a model from its tree index.
InvalidateModelTransformMarks a model’s transform as dirty.
CloneModelCreates a clone of an existing model.
GetModelCenterRetrieves the center position of a model.
EnableModelShows or hides a model.
SetGroupVisibilityShows or hides all models in a transform group.
EnableGroupEnables or disables a model group.
MakeTransformGroupCreates a new transform group.
TranslateGroupTranslates all models in a transform group.
RotateGroupRotates all models in a transform group.
ScaleGroupScales all models in a transform group.
SetTexPannerAssigns a texture panner to a model.
EnableTexPanningEnables or disables texture panning on a model.
SetTexPanOffsetSets the texture pan offset directly.
SetCustomGfxAssigns custom GFX to a model.
SetModelCustomGfxAssigns custom GFX builders to a specific model.
SetModelTexVariantChanges a model’s texture variant.
SetModelFlagsSets bitfield flags on a model.
ModifyColliderFlagsSets or clears flags on a collision object.
GetColliderCenterRetrieves the center point of a collider.
ParentColliderToModelParents a collider’s transform to a model.
UpdateColliderTransformForces a collider to update from its parent model.
SetZoneEnabledEnables or disables a zone.
GotoMapInitiates a map transition to the named map at the given entry.
GotoMapByIDInitiates a map transition by map ID.
GetEntryIDRetrieves the entry ID used when the current map was loaded.
GetMapIDRetrieves the current map’s ID.
GetLoadTypeReturns how the map was loaded (e.g. LOAD_FROM_FILE_SELECT).
SetRenderModeSets the render mode for a model.
PlaySoundAtModelPlays a sound effect positioned at a model.
PlaySoundAtColliderPlays a sound effect positioned at a collider.
MakeLocalVertexCopyCreates a local vertex copy of a model for vertex animation.
ResetFromLavaResets the player to the last safe position after touching lava.

Animated model functions

FunctionDescription
InitAnimatedModelsInitializes the animated model system.
LoadAnimatedModelLoads an animated model.
LoadAnimatedMeshLoads an animated mesh.
PlayModelAnimationStarts an animation on a loaded model.
PlayModelAnimationStartingFromStarts an animation from a given frame.
ChangeModelAnimationTransitions to a different animation.
SetAnimatedModelRootPositionSets the root position of an animated model.
GetAnimatedModelRootPositionReads the root position.
SetAnimatedModelRootRotationSets the root rotation.
SetAnimatedModelRootScaleSets the root scale.
SetAnimatedModelRenderModeSets the render mode.
DeleteAnimatedModelRemoves an animated model.
GetAnimatedNodePositionGets the world position of a named node.
GetAnimatedNodeRotationGets the rotation of a named node.

Camera functions

Declared in include/script_api/common.h under the Camera group.
FunctionDescription
SetCamEnabledEnables or disables a camera.
SetCamPerspectiveSets FOV, near/far clip, and update mode.
SetCamBGColorSets the background clear color.
SetCamLeadPlayerEnables or disables the camera leading ahead of the player.
SetCamLeadScaleSets how far ahead the camera leads.
SetCamTargetPoints the camera at a target position.
SetCamLookTargetSets the camera look-at target.
InterpCamTargetPosSmoothly interpolates the camera to a new target.
ShakeCamApplies a screen shake effect.
PanToTargetPans the camera to focus on a target.
UseSettingsFromCopies camera settings from a zone.
LoadSettingsApplies a full set of camera parameters.
SetCamSpeedSets the camera tracking speed.
GetCamPositionReads the current camera position.
WaitForCamBlocks until the camera finishes interpolating.
ResetCamResets the camera to default parameters.
AdjustCamAdjusts camera parameters incrementally.
GrabCameraLocks the camera to a fixed position.
SetCamViewportSets the rendering viewport for a camera.

NPC functions

Declared in include/script_api/common.h under the NPC group.
FunctionDescription
CreateNpcCreates an NPC instance.
DeleteNpcRemoves an NPC.
SetNpcPosTeleports an NPC to a world position.
GetNpcPosReads an NPC’s current world position.
SetNpcRotationSets NPC rotation angles.
SetNpcScaleSets NPC scale.
SetNpcSpeedSets the NPC’s movement speed.
SetNpcAnimationChanges the NPC’s current animation.
GetNpcAnimationReads the NPC’s current animation ID.
NpcMoveToCommands an NPC to walk to a position.
NpcJump0 / NpcJump1Makes an NPC jump.
NpcFlyToMakes an NPC fly to a position.
SetNpcYawSets the NPC’s facing direction.
GetNpcYawReads the NPC’s facing direction.
NpcFacePlayerTurns the NPC to face the player.
NpcFaceNpcTurns the NPC to face another NPC.
SetNpcFlagBitsSets or clears flags on an NPC.
SetNpcCollisionSizeOverrides the NPC’s collision dimensions.
EnableNpcShadowShows or hides the NPC’s shadow.
DisablePartnerAISuspends the partner’s AI.
EnablePartnerAIResumes the partner’s AI.
GetPartnerPosReads the partner’s current world position.
PlaySoundAtNpcPlays a sound positioned at an NPC.

Encounter and AI functions

FunctionDescription
MakeNpcsInstantiates all NPCs from an NPC table.
RemoveNpcRemoves an NPC from the map.
StartBattleInitiates a battle encounter.
StartBattleWithInitiates a battle with a specific formation.
StartBossBattleInitiates a boss battle.
GetBattleOutcomeReturns the result of the most recent battle.
DoNpcDefeatRuns the defeat sequence for an NPC encounter.
SetBattleMusicSets the music for an upcoming battle.
BindNpcAIBinds an AI script to an NPC.
BindNpcIdleBinds an idle script to an NPC.
BindNpcInteractBinds an interaction script to an NPC.
BindNpcHitBinds a hit-reaction script.
BindNpcDefeatBinds a defeat script.
SetNpcVar / GetNpcVarSets or reads NPC-local state variables.
ClearDefeatedEnemiesClears the defeated-enemy flag table.

Player functions

Declared in include/script_api/common.h under the Player group.
FunctionDescription
SetPlayerPosTeleports the player to a world position.
GetPlayerPosReads the player’s world position.
DisablePlayerInputBlocks all player and partner input.
DisablePlayerPhysicsDisables player collision physics.
SetPlayerSpeedSets the player’s movement speed.
SetPlayerAnimationChanges the player’s current animation.
SetPlayerActionStateForces the player into an action state.
GetPlayerActionStateReads the player’s current action state.
PlayerMoveToCommands the player to walk to a position.
PlayerJump / PlayerJump1 / PlayerJump2Makes the player jump.
InterpPlayerYawSmoothly rotates the player to face a direction.
FacePlayerTowardPointInstantly faces the player toward a world point.
HidePlayerShadowShows or hides the player’s shadow.
SetPlayerCollisionSizeOverrides the player’s collision dimensions.
EnablePartner / DisablePartnerEnables or disables a partner in the party.
FullyRestoreHPandFPRestores the player to full HP and FP.
UseExitHeading / UseEntryHeadingSets the player’s walk direction for map transitions.
WaitForPlayerMoveToCompleteBlocks until a PlayerMoveTo finishes.
WaitForPlayerInputEnabledBlocks until player input is re-enabled.
PlaySoundAtPlayerPlays a sound positioned at the player.

Message and dialogue functions

Declared under the Message group.
FunctionDescription
SpeakToPlayerDisplays a dialogue bubble from an NPC directed at the player.
SpeakToNpcDisplays a dialogue bubble between two NPCs.
EndSpeechCloses the current dialogue bubble.
ContinueSpeechContinues dialogue from the same speaker.
ShowMessageAtScreenPosShows a message box at a screen-space position.
ShowMessageAtWorldPosShows a message box anchored to a world position.
CloseMessageCloses the active message box.
ShowChoiceDisplays a choice prompt and blocks for selection.
CloseChoiceDismisses a choice prompt.
SetMessageTextSets the text string used in the next message.
SetMessageValueSets a numeric value displayed inside a message.
SetMessageImagesSets images embedded in a message box.

Audio functions

Declared under the Audio group.
FunctionDescription
SetMusicStarts a song on a music player with a given volume.
FadeInMusicFades in the current song.
FadeOutMusicFades out the current song.
PushSong / PopSongSaves and restores the current song on a stack.
PushBattleSong / PopBattleSongSaves and restores the battle song.
SetBattleSongSets the track used for battle music.
SetTrackVolumesSets per-track volume levels.
PlaySoundPlays a one-shot sound effect.
PlaySoundWithVolumePlays a sound at a specific volume.
PlaySoundAtPlays a sound at a world position.
StopSoundStops a currently playing sound.
PlayAmbientSoundsStarts ambient audio loops for the current area.
ClearAmbientSoundsStops ambient audio.
RegisterMusicEventsRegisters music event callbacks.
PollMusicEventsPolls active music events.

Item functions

Declared under the Item group.
FunctionDescription
AddItemAdds an item to the player’s inventory.
AddKeyItemAdds a key item to the player’s inventory.
RemoveItemRemoves an item by ID.
RemoveItemAtRemoves an item at a specific inventory slot.
RemoveKeyItemAtRemoves a key item at a specific slot.
FindItemSearches the inventory for an item by ID.
FindKeyItemSearches for a key item.
HasKeyItemReturns true if the player holds a given key item.
ShowKeyChoicePopupShows a popup prompting the player to choose a key item.
ShowConsumableChoicePopupShows a popup for consumable items.
CloseChoicePopupDismisses an item choice popup.

Math and utility functions

Declared under the Math group.
FunctionDescription
MakeLerpInitializes a linear interpolation from a start value to an end value over a number of frames, with an easing mode.
UpdateLerpAdvances the lerp by one frame; stores the current value in LVar0 and a completion flag in LVar1.
RandIntGenerates a random integer in a given range.
GetDist2DComputes the 2D distance between two points.
AddVectorPolarAdds a vector defined by angle and length to a position.
GetAngleBetweenNPCsComputes the angle from one NPC to another.
GetAngleToPlayerComputes the angle from a world point to the player.
IsPlayerWithinTests whether the player is within a given radius.
AwaitPlayerApproachBlocks until the player is within a radius.
AwaitPlayerLeaveBlocks until the player is outside a radius.
LoadPathLoads a world-space path for path-following movement.
GetNextPathPosAdvances along a loaded path and returns the next position.
SetTimeFreezeModeFreezes or unfreezes game time.
ClampAngleInt / ClampAngleFloatClamps an angle to the range [0, 360).

Effects and FX

The convenience macro PlayEffect(effect, ...) (declared in include/script_api/macros.h) expands to Call(PlayEffect_impl, ...) and accepts 1–14 arguments. Pass the effect ID as the first argument and an optional subtype and positional parameters depending on the effect.

Battle-specific API

include/script_api/battle.h declares additional callables available only during battles. These include camera presets (UseBattleCamPreset, SetBattleCamTarget, MoveBattleCamOver), actor movement (SetActorPos, SetGoalPos, SetGoalToTarget), animation (SetAnimation, GetAnimation), damage application (ItemDamageEnemy, ItemCheckHit), status effects, and actor speech (ActorSpeak, EndActorSpeech).

Map-specific API

include/script_api/map.h declares callables available only in world maps. These include MakeNpcs (instantiate NPCs from a table), MakeShop, MakeShopOwner, CreatePushBlockGrid, and trigger-bound common scripts such as EnterWalk, ExitWalk, EnterSingleDoor, ExitDoubleDoor, and others declared as extern EvtScript.
Functions whose names begin with func_ (e.g. func_802CF54C) are not yet reverse-engineered. Their behavior is unknown; do not rely on them in new scripts.

Build docs developers (and LLMs) love