Events
Megalo allows you to define "event handlers" for a number of situations that can occur during play. You may assign one block to handle each event. The available events are:
- pregame
- This event fires once, before the start of the match.
- init
- This event fires once, at the very start of the match.
- local init
- This event is not networked, and fires once at the very start of the match.
- host migration
- This event fires after a host migration has occurred.
- double host migration
- This event fires after a double host migration has occurred.
- object death
- This event fires when certain objects die.
- local
- This event fires every script tick, but it is not networked. Community testing indicates that most script code is run on host and the results are synchronized, while local code is run individually on the host and on each client.
To set a top-level block as an event handler, prefix it with the "on" keyword followed by the event name and a colon:
on object death: do end
Object death
This event fires when certain objects "die." It does not necessarily fire when objects are destroyed; for example, shooting a Fusion Coil does not trigger this event. The following values are available in this event: