Events
This chapter lists all available events that can be received by characters and items in Eldiron.
Events are categorized as:
- System Events – sent by the engine to the
event()handler
System Events
active
Item-only event.
- Value: active state (bool)
- Description: Called when the state of the item has changed and directly after item creation. This event allows the item to sync its visuals with the current state, for example a torch may use set_emit_light to adjust it's light emission.
arrived
Character-only event.
- Value: destination sector name (string)
- Description: Send by goto when the character arrives at the destination.
bumped_into_entity
- Value:
entity_id(int) - Description: Triggered when this entity bumps into another entity.
bumped_into_item
- Value:
item_id(int) - Description: Triggered when this entity bumps into an item.
bumped_by_entity
- Value:
entity_id(int) - Description: Triggered when another entity collides with this entity or item.
closed_in
- Value:
entity_id(int) - Description: Send when an NPC closed in within the radius of the target entity. Send by the close_in command.
dead
- Value:
entity_id(int) - Description: Send when another entity kills this character. The entity_id of the killer is passed in the value. This is useful for sending messages and taking the next steps. A player character could for example teleport to a graveyard or healer.
entered
- Value:
sector_name(string) - Description: Triggered when the character has entered a named sector. Useful for traps or teleports.
intent
- Value:
dict
{ intent (string), entity_id (int), item_id (int), distance (float)} - Description: Triggered when the player triggers an intent towards another entity or item. Either via a movement based keyboard shortcut or by clicking on the target entity or item.
- When the target is an item, the event is send to the target item and to the originating player entity as the action may be handled by either of them depending on the context, for example a torch would lit itself when used, or a character may take an item.
- When the target is another character, the event is send to both, the originating character and the target entity. For example on an
attackintent the originating player may call deal_damage to the givenentity_id, or the target may want to respond when talked to.
level_up
Sent to a character after gain_xp(...) causes it to reach a new level.
value is the new level number.
kill
- Value:
entity_id(int) - Description: Send when this entity kills another character. The entity_id of the target is passed in the value. This is useful for sending messages and for NPCs to reset what they are doing.
left
- Value:
sector_name(string) - Description: Triggered when the character has left a named sector.
proximity_warning
- Value:
entity_ids(array) - Description: Called when proximity tracking was enabled via set_proximity_tracking and other entities are in radius. Useful for NPCs to interact with other characters (attack, talk, heal, etc.).
startup
- Value: (None)
- Description: Called when the entity or item is created.
time
- Value:
hour(int, 0..23) - Description: Triggered for all characters and items whenever in-game time reaches a full hour (
MM == 00). The value contains the current 24-hour hour value.
take_damage
- Value:
amount(int) - Description: Triggered by the
deal_damage()command after the server has applied the project-wide damage formula.
amountis the final incoming damage,from_idcontains the attacker id,damage_kindcontains the kind such asphysical,spell, orfire, andsource_item_idcontains the weapon or spell item when available. The server applies this final damage automatically after the event returns. If the target has autodamage enabled, this event is not triggered.
Player key input is configured via Input Mapping, not via script events.