Então galera ,
Estou com um problema , tenho uma spell no meu server que ele adicionar uma porcentagem de vida, porem quando a pessoa desativa esse buff ou acaba o tempo dela , o personagem as vezes acaba morrendo.
O que eu queria era colocar coldown nela. E que n fizesse o personagem morrer.
OBS: é um servidor de naruto
a Skill é essa.
local giantStamina = {50, 45, 40, 35, 30}
local giantGain = {100, 125, 150, 175, 200}
local conditions = {}
for i = 1,5 do
conditions[i] = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(conditions[i], CONDITION_PARAM_TICKS, 9999999999)
setConditionParam(conditions[i], CONDITION_PARAM_SKILL_FIST, 5)
setConditionParam(conditions[i],CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 100 + (giantGain[i]))
end
local function finishJutsu(cid)
if not isCreature(cid) then return true end
local giant = getStorage(cid, 10721)
if giant > 0 then
setStorage(cid, 10721, 0)
local jutsuLv = getJutsuLevel(cid, "chou_baika")
local healthGainPercent = giantGain[jutsuLv]*0.01
local maxHealth = getPlayerHealthMax(cid)
local healthChange = - math.ceil(maxHealth * healthGainPercent)
doCreatureAddHealth(cid, healthChange)
doRemoveCondition(cid, CONDITION_ATTRIBUTES)
doSendMagicEffect(getCreaturePosition(cid), 10)
normalizeOutfit(cid)
end
end
local function checkHorengan(cid, stamina)
if not isCreature(cid) then return true end
if(getStorage(cid, 10721) == 1) and canDoJutsu(cid) and getPlayerState(cid) ~= 'rest' and getPlayerStamina(cid) > 0 then
changeStamina(cid, stamina)
changeLookType(cid, 430, 0)
if isCreature(cid) then
addEvent(valid(checkHorengan), 1000, cid, stamina)
end
else
return finishJutsu(cid)
end
end
local function preHorengan(cid, stamina)
if not isCreature(cid) then return true end
doSendMagicEffect(getCreaturePosition(cid), 10)
changeLookType(cid, 430, 0)
doCreatureSay(cid, "BAIKA NO JUTSU!!!", TALKTYPE_ORANGE_1)
checkHorengan(cid, stamina)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, 10721) > 0 then
return finishJutsu(cid)
end
local pill = getStorage(cid, 10238)
if pill > 0 then
return doPlayerSendCancel(cid, "You cannot use chou baika while on effect of pills.")
end
if getPlayerStorageValue(cid, 9000) == 'doing jutsu' then
return doPlayerSendCancel(cid, "You are already doing a jutsu.")
end
if doJutsu(cid, 'chou_baika') then
doCreatureSay(cid, "Chou!!", TALKTYPE_ORANGE_1)
setStorage(cid, 10721, 1)
local jutsuLv = getJutsuLevel(cid, 'chou_baika')
local preHealth = getCreatureHealth(cid)
local preMaxHealth = getCreatureMaxHealth(cid)
local percent = getPercent(preHealth, preMaxHealth)
-- add condition
doAddCondition(cid, conditions[jutsuLv])
---
local buffedMaxHealth = getCreatureMaxHealth(cid)
local healthChange = math.floor(buffedMaxHealth * ((100 - percent)/100))
doCreatureAddHealth(cid, buffedMaxHealth)
doCreatureAddHealth(cid, - healthChange)
local stamina = giantStamina[jutsuLv]
changeLookType(cid, 428, 0.5)
addEvent(changeLookType, 500, cid, 429, 2.5)
addEvent(preHorengan, 1000, cid, stamina)
end
end