Ir para conteúdo
  • 0

Exevo reclect


jonathasbizerril

Pergunta

5 respostass a esta questão

Posts Recomendados

  • 0

Spell:

local storage = 91831
local time = 5
function onCastSpell(cid, var)
    if getPlayerStorageValue(cid, storage) > os.time() then 
        return doPlayerSendCancel(cid, "You are already under this spell's effect.")
    else
        setPlayerStorageValue(cid, storage, os.time() + time)
        doPlayerSendTextMessage(cid, 27, string.format("Durante %d segundo%s, metade de todo dano que você receber será refletido.", time, time > 1 and "s" or ""))
    end
    return true
end
Creaturescripts (data/creaturescripts/scripts):
--[[
    Tags:
    <event type="statschange" name="Reflect" event="script" value="nome do arquivo.lua"/>
    <event type="login" name="ReflectLogin" event="script" value="nome do arquivo.lua"/>
]]--
local storage = 91831
function onStatsChange(cid, attacker, type, combat, value)
    if isPlayer(cid) and getPlayerStorageValue(cid, storage) > os.time() and type == STATSCHANGE_HEALTHLOSS and isCreature(attacker) then
        local damage = math.ceil(value * 50 / 100)
        doCreatureAddHealth(attacker, -damage)
        doSendAnimatedText(getThingPos(attacker), "-"..damage, 215)
        doSendAnimatedText(getThingPos(cid), "Reflect!", 215)
    end
    return true
end
function onLogin(cid)
    registerCreatureEvent(cid, "Reflect")
    return true
end
Editado por zipter98
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...