Scripting API ‐ Frame - ipodtouch0218/NSMB-MarioVsLuigi GitHub Wiki

Frame struct

Represents the current state of the game. Use the frame global variable to read or modify the state of the game.

Functions

Function Return Type Description
getStageTile(x, y) StageTileInstance Returns the StageTileInstance at the given coordinates. If at least one of the coordinates given is outside the bounds of the stage, this function returns null.
getPlayerData(playerRef) PlayerData Returns the PlayerData for the given playerRef. Returns null if the player does not exist, or is outside the 0-9 bounds.
findAsset(path) AssetRef Returns the AssetRef of the asset at the given path. Returns null if no asset exists with that path.
create() EntityRef Creates a new blank entity. Returns the EntityRef for the newly created entity.
create(entityPrototype) EntityRef Creates a new entity from an EntityPrototype (prefab). Returns the entityRef for the newly created entity, or null if the entityPrototype was invalid.
exists(entityRef) bool Returns true if the given entity exists within the world.
destroy(entityRef) bool Destroys the given entity. Returns true if successful.
add(entityRef, componentType) bool Adds a given component to the given entity. Returns true if successful, false otherwise. If the given entity already has a component of this type, this function will do nothing and return true. Returns null if the entity does not have a component of the given type, or if the entityRef/componentType do not exist.
has(entityRef, componentType) bool Returns true if the given entity has the given component type. Returns false if the entity does not have a component of the given type, or if the entityRef/componentType do not exist.
get(entityRef, componentType) ... Returns a ComponentRef for the given entity, with the given component type. Returns null if the entity does not have a component of the given type, or if the entityRef/componentType do not exist.
remove(entityRef, componentType) bool Removes a given component from the given entity. Returns true if successful, false otherwise. Returns false if the entity does not exist, or if the componentType does not exist.

Members

Member Type Description Access
number int The frame's number, incrementing every tick. Equivalent to the number of frames since the creation of this room. Counts up within the pre-game lobby, and does not reset when a new game starts. Read only
isVerified bool If this frame is verified by the server. Use this check around important events that are important to not predict, such as collecting items or objectives. Read only
isPredicted bool Inverse of Frame.isVerified. Read only
deltaTime FP The time in seconds between consecutive frames. By default, MvLO runs at 60tps, so deltaTime starts out as 1 / 60. Changing this value will slow down / speed up the game. Note that some timers are currently based on the frame number, and will not work properly with deltaTime. Read / Write
playerCount int The number of valid, connected players in the room. Equivalent to the number of PlayerData entities. Read only
rng FP Generates a random value between 0 (inclusive) and 1 (exclusive). Read only