mercredi 25 juillet 2018

How to make a delay for a function in if statement

how can I make a delay for 1 second before executing the function 'avatar.StopCasting()' ?

local function main(avatarId)
if className ~= avatar.GetClass() then
    return
end
local eventActionProgressStart = {
    name = 'EVENT_ACTION_PROGRESS_START',
    handler = function(event)
        if not object.IsInCombat(avatarId) then
            **avatar.StopCasting()**
        end
    end,
    params = {name = userMods.ToWString(spellName)}
}
aspectd:init(avatarId, aspectName, function(state)
    toggleEvent(eventActionProgressStart, state)
end)
end

Aucun commentaire:

Enregistrer un commentaire