Megaluavania.lua
This page is still under heavy construction and by no means complete!
Megaluavania is an API that aims to recreate battles in the style of the game Undertale in SMBX.
Installation
Just download this and extract it. Then, copy the contents of the Megaluavania folder into either your level's custom graphics folder for use in a level, along with a lunadll.lua file, or in the same directory as your .wld file along with a lunaworld.lua file for use throughout an entire episode.. Rinkas;Tale, an example level, is included, too.
Setup
To enable the Megaluavania library for a specific level, add this line to lunadll.lua:
local megaluavania = API.load ("megaluavania");
This will load the megaluavania API.
Encounters
You can set up a new encounter with encounter = megaluavania.newEncounter(). Then, you can set any of the following attributes:
Name | Type | Is Optional? | Default Value | Description |
---|---|---|---|---|
name | string | no | nil | The name of the enemy. |
NPCID | number | yes | nil | The NPC ID of the enemy. If this is set to anything other than nil, any NPC of that idea won't disappear during the animation for starting the encounter. |
event | string | no | nil | The event that starts the encounter. |
hideLayers | table of string | no | nil | The layers that should get hidden when the encounter starts. |
enemyHPMax | number | yes | 500 | The maximum HP of the enemy. |
enemyHP | number | yes | Encounter.enemyHPMax or 500 | The current HP of the enemy. |
enemyDef | number | yes | 0 | The current defense of the enemy. |
canflee | boolean | yes | false | If set to true, the player is able to flee from the battle. |
canspare | boolean | yes | false | If set to true, the player is able to spare the enemy. |
overrideDeath | boolean | yes | false | If set to true, the enemy won't die if its HP drops to 0. |
overrideSpare | boolean | yes | false | If set to true, the enemy won't die if it's spared through regular means. |
forceKill | boolean | yes | false | If set to true, the enemy will instantly die. This will ignore Encounter.overrideDeath. |
forceSpare | boolean | yes | false | If set to true, the enemy will instantly get spared. This will ignore Encounter.overrideSpare. |
typeSounds | table of string | yes | {megaluavania.resourcePath.."defaultvoice.ogg"} | Whenever the enemy talks, the sound effects to a random one of these paths gets played. |
music | string | yes | nil | The music used for the fight. |
gold | number | yes | 0 | The amount of gold earned for killing or sparing the enemy. |
exp | number | yes | 0 | The amount of experience earned for killing the enemy. |
sprite | LuaImageResource | no | nil | The sprite used for the enemy. |
spriteHurt | LuaImageResource | no | nil | The sprite used for when the enemy gets hurt. |
initiated | number | yes | megaluavania.BATTLE_NONE | Can be set to either megaluavania.BATTLE_NONE, megaluavania.BATTLE_INTRO, megaluavania.BATTLE_ACTIVE, megaluavania.BATTLE_LOST, megaluavania.BATTLE_EXIT, megaluavania.BATTLE_SPARED or megaluavania.BATTLE_RAN. However, it is recommended that you don't set this manually and instead rely on the other ways to manipulate which phase a battle is in. |