Modding: Lua Callbacks

Noita's modding API features a system of script callbacks through which we are able to listen to a variety of different events that happen in-game. This page is an attempt to compile, explain and exemplify each of them. Each event is listened to with a specific callback we must attach to specific entities.

In Noita, events are listened to through messages sent by the engine when an event happens, and each message has a related function that is executed whenever the message is sent, provided they are implemented within the correct callback environment.

On Spell Cast
We are able to detect when a spell has been cast by the player.

On Damaged
Any entity in the game that is able to take damage can be added a callback that triggers when it happens.

On Enemy Kill
Enemy deaths can also generate event messages, allowing us to listen to them and run code when any creature dies.

On Item Pickup
When the player collects an item, we can also listen to this action using the item pickup listener.

On Item Dropped
Naturally, when an item is dropped by the playe, we can also detect it.

On Wand Fired
Whenever you cast a spell with a wand, a message is also generated, so we can capture it too.

On Collision
Under specific circumstances we are also able to detect when a collision box has been touched.