Registration

File Location: data/creaturescripts/creaturescripts.xml

Structure

  • type: Event type

  • login

    logout

    think

    preparedeath

    death

    kill

    advance

    healthchange

    manachange

    textedit

    modalwindow

    extendedopcode

  • name: Unique identifier for the event

  • script: Lua script file name & location (base directory is data/creaturescripts/scripts/)

Examples

<!-- Register a new login event, referred to as "custom login" -->
<event type="login" name="custom login" script="custom_login.lua" />

<!-- Register a new preparedeath event, referred to as "custom preparedeath" -->
<event type="preparedeath" name="custom preparedeath" script="custom_preparedeath.lua" />

<!-- Register a new kill event, referred to as "custom kill" -->
<event type="kill" name="custom kill" script="custom_kill.lua" />

Notes

When registering a new event that is not a login/logout event, the event must be registered to a creature in order for the script to execute, this is done by using creature:registerEvent(name), where name is the event name provided in creaturescripts.xml. If the event is intended to be registered to a player immediately, the event should be registered in login.lua located in data/creaturescripts/scripts/login.lua where the rest of the player:registerEvent(name) methods are.

Last updated