Level (class)
Jump to navigation
Jump to search
This class provides fields/functions for managing Levels in the overworld.
Static functions
| Static Level Functions (Level Only) | ||
|---|---|---|
| Function | Return values | Description |
| Level.exit() | nil | Exit the level. |
| Level.filename() | string | Returns the filename of the level. |
| Level.name() | string | Returns the Title/Name of the level. |
| Level.winState() | int | Returns the current state of hitting the goal. If currently not winning then this value is 0. SMB3 Roulette: 1. SMB3 Orb: 2. Keyhole: 3. SMB2 Orb: 4. Game End: 5. SMB3 Star: 6. SMW Tape: 7. |
| Level.winState(int value) | nil | Sets the current state of hitting the goal. If currently not winning then this value is 0. SMB3 Roulette: 1. SMB3 Orb: 2. Keyhole: 3. SMB2 Orb: 4. Game End: 5. SMB3 Star: 6. SMW Tape: 7. |
| Level.loadPlayerHitBoxes(int characterId, int powerUpId, string iniFilename) | nil | Loads the hitbox settings for specific player and it's power-up state from INI file made by Special Calibration tool. |
| Static Level Functions (Overworld Only) | ||
|---|---|---|
| Function | Return values | Description |
| Level.count() | number | Returns the number of levels on the overworld. |
| Level.get() | table of Level | Returns all levels on the overworld. |
| Level.get(number or table ids) | table of Level | Returns all levels with the matching item ids. |
| Level.getByName(string name) | Level or nil | Returns the level with the given level title. If the level is not found, then nil is returned. |
| Level.getByFilename(string name) | Level or nil | Returns the level with the given level filename. If the level is not found, then nil is returned. |
| Level.findByName(string searchText) | table of Level | Returns all levels where the level title contains searchText |
| Level.findByFilename(string searchText) | table of Level | Returns all levels where the level filename contains searchText |
Instance functions
These fields and functions are part of Level Objects and have to be called for that object. Trying to call them from the static Level class will result in an error. Example (feel free to copy it into your lua file to see how it works):
function onStart()
for index,myLevel in ipairs(Level.get()) do
myLevel.visible = true
end
end
| Level class | |||
|---|---|---|---|
| Type | Function/Field | Return values/Value type | Description |
| function | Level:mem(int offset, int fieldtype, object value) | nil | Sets a value of the Level struct at a specific address-offset. |
| function | Level:mem(int offset, int fieldtype) | object | Returns a value of the Level struct at a specific address-offset. |
| Field | Level.x | double | The x position of the level. |
| Field | Level.y | double | The y position of the level. |
| Field | Level.goToX | double | The x position to the destination position. (LunaLua ≥ v0.7.2) |
| Field | Level.goToY | double | The y position to the destination position. (LunaLua ≥ v0.7.2) |
| Field | Level.topExitType | number | The exit type which triggers the top path. (LunaLua ≥ v0.7.2) |
| Field | Level.leftExitType | number | The exit type which triggers the left path. (LunaLua ≥ v0.7.2) |
| Field | Level.bottomExitType | number | The exit type which triggers the bottom path. (LunaLua ≥ v0.7.2) |
| Field | Level.rightExitType | number | The exit type which triggers the right path. (LunaLua ≥ v0.7.2) |
| Field | Level.levelWarpNumber | number | The warp id in the level which should be used, when the Player enters the level. (LunaLua ≥ v0.7.2) |
| Field | Level.isPathBackground | boolean | If the level item has a path background. (LunaLua ≥ v0.7.2) |
| Field | Level.isBigBackground | boolean | If the level item has a big path background. (LunaLua ≥ v0.7.2) |
| Field | Level.isGameStartPoint | boolean | If the level item is the game start point. (LunaLua ≥ v0.7.2) |
| Field | Level.isAlwaysVisible | boolean | If the level is always visible. (LunaLua ≥ v0.7.2) |
| Field | Level.visible | boolean | Whether the object is visible or not. (LunaLua ≥ v0.7.3.2) |
| Field (ro) | Level.title | string | The level title. |
| Field (ro) | Level.filename | string | The level filename. |
Offsets
(Section under construction)
| Level Memory (0x__ bytes) | |||
|---|---|---|---|
| Name | Memory address | Memory type | Description |
| Unknown | Level+0x00 | FIELD_WORD | Unknown |
| Unknown | Level+0x02 | FIELD_WORD | Unknown |