📓
TFS Guide
  • Preface
  • Progress
  • Unique TFS Concepts
  • Interface - Actions
    • Registration
    • Scripting
    • Revscriptsys
  • Interface - Chatchannels
    • Registration
    • Scripting
  • Interface - Creaturescripts
    • Registration
    • Scripting
    • Revscriptsys
  • Interface - Events
    • Registration
    • Scripting
  • Interface - Globalevents
    • Registration
    • Scripting
    • Revscriptsys
  • Interface - Monster
    • Registration
    • Scripting
    • Revscriptsys
  • Interface - Movements
    • Registration
    • Scripting
    • Revscriptsys
  • Interface - NPC
    • Registration
    • Scripting
  • Interface - Spells
    • Registration
    • Scripting
  • Interface - Talkactions
    • Registration
    • Scripting
  • Interface - Weapons
    • Registration
    • Scripting
  • Source Editing
    • Creating new events
    • Creating new Lua functions
  • Function Documentation
    • Game
Powered by GitBook
On this page
  • Structure
  • Examples
  • Notes

Was this helpful?

  1. Interface - Creaturescripts

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.

PreviousScriptingNextScripting

Last updated 5 years ago

Was this helpful?