📓
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
  • Script Structure
  • Examples

Was this helpful?

  1. Interface - Movements

Revscriptsys

Script Structure

Constructor:

  • MoveEvent()

Events:

  • onEquip(player, item, slot)

  • onDeEquip(player, item, slot)

  • onStepIn(creature, item, position, fromPosition)

  • onStepOut(creature, item, position, fromPosition)

  • onAddItem(moveitem, tileitem, pos)

  • onRemoveItem(moveitem, tileitem, pos)

Methods:

  • register(): Finalizes the definition of the move event and registers it.

  • type(eventType):

  • eventType: Equivalent to the event tag in XML.

  • level(reqLevel):

  • reqLevel: Equivalent to the level tag in XML.

  • magicLevel(reqMagLevel):

  • reqMagLevel: Equivalent to the maglevel tag in XML.

  • aid(actionIds):

  • actionIds: List of action ids, equivalent to the aid tag in XML, but with multiple AIDs in 1 method (if needed)

  • uid(uniqueIds):

  • uniqueIds: List of unique ids, equivalent to the uid tag in XML, but with multiple UIDs in 1 method (if needed)

  • slot(slotType):

  • slotType: Equivalent to the slot tag in XML.

    CONST_SLOT_HEAD

    CONST_SLOT_NECKLACE

    CONST_SLOT_BACKPACK

    CONST_SLOT_ARMOR

    CONST_SLOT_RIGHT

    CONST_SLOT_LEFT

    CONST_SLOT_LEGS

    CONST_SLOT_FEET

    CONST_SLOT_AMMO

    CONST_SLOT_RING

  • vocation(vocName[, showInDescription[, lastVoc]])

  • vocName: Vocation name, equivalent to the vocation tag in XML.

    showInDescription [Optional]: Boolean value to determine if the vocation will show in the item description.

    Default: false

    lastVoc [Optional]: Boolean value to fix the vocation string with, should be true when adding the last vocation to the item.

    Default: false

  • position(positions):

  • positions: List of positions where the move event will be executed.

  • premium(reqPremium):

  • reqPremium: Equivalent to the premium tag in XML.

Examples

local moveEvent = MoveEvent()

moveEvent:type("equip")

function moveEvent.onEquip(player, item, slot)
    if player:getName() == "Delusion" then
        return true
    end
    return false
end

moveEvent:register()
local moveEvent = MoveEvent()

moveEvent:type("stepin")
moveEvent:aid(2001, 2002, 2003)

function moveEvent.onStepIn(creature, item, position, fromPosition)
    -- Push the creature back if they are not a player
    if not creature:isPlayer() then
        creature:teleportTo(fromPosition, true)
    end
end

moveEvent:register()
PreviousScriptingNextRegistration

Last updated 5 years ago

Was this helpful?