GU

spell onTagetTile

Por gusinhi, 20 de abr. de 2016 em Scripts

4
1.1k
gusinhiG
20 de abril de 2016 às 14:41

como faço pra usar essa spell em mais de um scrip, eu crio dois scripts diferentes mais quando vou usar so funciona 1 tipo alguem poderia e da uma mao

 

function spellCallback(cid, position, count)
    if Creature(cid) then
        if count > 0 or math.random(0, 1) == 1 then
            position:sendMagicEffect(CONST_ME_MORTAREA)
            doAreaCombatHealth(cid, COMBAT_DEATHDAMAGE, position, 0, -99, -2001, CONST_ME_MORTAREA)
        end

        if count < 5 then
            count = count + 1
            addEvent(spellCallback, math.random(1000, 3000), cid, position, count)
        end
    end
end

function onTargetTile(creature, position)
    spellCallback(creature:getId(), position, 0)
end

local combat = Combat()
combat:setArea(createCombatArea(AREA_CROSS5X5))
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onCastSpell(creature, var, isHotkey)
    return combat:execute(creature, var)
end

Night WolfN
20 de abril de 2016 às 16:20

coloca local na frente do function spellCallback. Tá sendo uma função global e por isso tá conflitando.

gusinhiG
20 de abril de 2016 às 19:52

vlwww mano salvo eu, eu tava empacado nessa spell

 

gusinhiG
20 de abril de 2016 às 20:00

como faço pra adicionar essa formula nessa spell 

 

function onGetFormulaValues(cid, level, skill, attack, element, factor)
    local levelTotal, formula = level / 5, 0.1126
    local normal, elemental = -(skill * attack * formula + levelTotal), math.ceil((skill * element * formula + levelTotal))
    return normal/2, normal, -math.random(elemental/2, elemental)
end