Method WorldObject:RegisterEvent [-] [+]

Registers a timed event to the WorldObject When the passed function is called, the parameters (eventId, delay, repeats, worldobject) are passed to it. Repeats will decrease on each call if the event does not repeat indefinitely

Note that for Creature and GameObject the timed event timer ticks only if the creature is in sight of someone For all WorldObjects the timed events are removed when the object is destoryed. This means that for example a Player's events are removed on logout.

local function Timed(eventid, delay, repeats, worldobject)
worldobject:RegisterEvent(Timed, 1000, 5) -- do it after 1 second 5 times
worldobject:RegisterEvent(Timed, {1000, 10000}, 0) -- do it after 1 to 10 seconds forever


eventId = WorldObject:RegisterEvent( function, delay )

eventId = WorldObject:RegisterEvent( function, delaytable )

eventId = WorldObject:RegisterEvent( function, delay, repeats )

eventId = WorldObject:RegisterEvent( function, delaytable, repeats )


function function

Function to trigger when the time has passed.

number delay

Set time in milliseconds for the event to trigger.

Valid numbers: integers from 0 to 4,294,967,295.

table delaytable

A table {min, max} containing the minimum and maximum delay time.

number repeats (1)

How many times for the event to repeat, 0 is infinite.

Valid numbers: integers from 0 to 4,294,967,295.


number eventId

Unique ID for the timed event used to cancel it or nil.

Valid numbers: integers from -2,147,483,647 to 2,147,483,647.

Generated on
©2016 - Eluna Lua Engine