Hello i made this script, and i dont know how to add:
When spell is active (Buff ON) then this spell remove -5% health per seconds, can you help me?
When spell is active (Buff ON) then this spell remove -5% health per seconds, can you help me?
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, 8)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition, CONDITION_SPEED, 25)
setCombatCondition(combat, condition)
local function healthCheck(cid)
player.add(cid)
if isPlayer(player:get()) and getCreatureCondition(player:get(), CONDITION_ATTRIBUTES) then
if player:health() > player:healthMax()/200 then
player:health(-player:healthMax()/200, true, false)
addEvent(healthCheck, 1000, player:get())
return true
else
doRemoveCondition(player:get(), CONDITION_ATTRIBUTES)
end
end
return false
end
function onCastSpell(cid, var)
if not getCreatureCondition(cid, CONDITION_ATTRIBUTES) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Buff On")
doCombat(cid, combat, var)
healthCheck(cid)
else
doRemoveCondition(cid, CONDITION_ATTRIBUTES)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Buff Off")
stopEvent(healthCheck)
return false
end
return true
end