• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    [Spells] error en spell

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1[Spells] error en spell Empty [Spells] error en spell Jue Jun 30, 2022 5:53 pm

    akane

    akane
    Miembro
    Miembro
    hola a todos, tengo problemas con este spell ya da error con la funcion events, estoy usando un otx 3.10

    Código:
    local config = {
        storageSpellDamagePercent = 160000, -- Storage for spell damage percent.
        spellDamage = 10, -- 10%
        spellDamageDuration = 180000, -- 3 minutes.
        events = {}
    }

    function onCastSpell(creature, var)
        local event = config.events[creature:getId()]
        if event then
            creature:sendCancelMessage("You are already casting a spell.")
            return false
        end



    --error---

    Lua Script Error: [Spell Interface]
    data/spells/scripts/support/strength of a paladin.lua:onCastSpell
    data/spells/scripts/support/strength of a paladin.lua:30: attempt to index global 'events' (a nil value)
    stack traceback:
            [C]: in function '__newindex'
            data/spells/scripts/support/strength of a paladin.lua:30: in function <data/spells/scripts/support/strength of a paladin.lua:8>

    3 participantes

    2[Spells] error en spell Empty Re: [Spells] error en spell Jue Jun 30, 2022 7:30 pm

    SoyFabi

    SoyFabi
    Miembro
    Miembro
    Para que sirve ese spell? y porque usa event?



    Última edición por SoyFabi el Jue Jun 30, 2022 8:35 pm, editado 2 veces

    3 participantes

    3[Spells] error en spell Empty Re: [Spells] error en spell Jue Jun 30, 2022 8:01 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Dice que no tiene un valor para comprar y lo que veo tu condicion busca una id o un id de criatura



    [Spells] error en spell YNU5B25
    3 participantes
    http://www.tibiaface.com

    4[Spells] error en spell Empty Re: [Spells] error en spell Jue Jun 30, 2022 8:38 pm

    akane

    akane
    Miembro
    Miembro
    el script se supone que da un % porcentaje de daño adicional a una spell (me lo pasó sevu)

    Código:
    local config = {
        storageSpellDamagePercent = 160000, -- Storage for spell damage percent.
        spellDamage = 10, -- 10%
        spellDamageDuration = 180000, -- 3 minutes.
        events = {}
    }

    function onCastSpell(creature, var)
        local event = config.events[creature:getId()]
        if event then
            creature:sendCancelMessage("You are already casting a spell.")
            return false
        end

        creature:setStorageValue(config.storageSpellDamagePercent, config.spellDamage)
        creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        creature:sendTextMessage(MESSAGE_INFO_DESCR, "You have increased your spell damage by " .. config.spellDamage .. "%.")
       
        local creatureId = creature:getId()
        events[creatureId] = addEvent(function(id)
            config.events[id] = nil
            local creature = Creature(id)
            if not creature then
                return
            end

            creature:setStorageValue(config.storageSpellDamagePercent, 0)
            creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
            creature:sendTextMessage(MESSAGE_INFO_DESCR, "Your spell damage has been reset.")
        end, config.spellDamageDuration, creatureId)
        return true
    end

    este es el script completo

    3 participantes

    5[Spells] error en spell Empty Re: [Spells] error en spell Mar Jul 05, 2022 9:53 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    SoyFabi escribió:Para que sirve ese spell? y porque usa event?

    pienso yo que ahi tendria que ir el ombre de algun monster

    Código:
     events = {}

    por si no encuentra nada no compara nada



    [Spells] error en spell YNU5B25
    3 participantes
    http://www.tibiaface.com

    Contenido patrocinado


    3 participantes

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).